:root {
  --navy: #002c59;
  --teal: #149d8d;
  --text: #1d2433;
  --muted: #5b6475;
  --line: #d8dee8;
  --soft: #eef3f9;
  --error: #c62828;
  --demo: #c62828;
  --demo-soft: #fdecea;
  --bg: #f6f8fb;
  --card: #ffffff;
  font-family: "PT Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
#page { min-height: 100vh; display: flex; flex-direction: column; }
#page > main { flex: 1; width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--card); border-bottom: 3px solid var(--navy); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { height: 44px; }
.partners { display: flex; align-items: center; gap: 24px; }
.partner-medlinx { height: 32px; }
.partner-helix { height: 30px; }

.intro { padding-top: 24px; }
.badge { display: inline-block; color: var(--demo); background: var(--demo-soft); border: 1px solid rgba(198, 40, 40, 0.35); border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 700; }
.intro h1 { color: var(--navy); font-size: 24px; margin: 10px 0 6px; }
.intro p { color: var(--muted); margin: 0 0 16px; }
.intro .demo-banner { color: var(--demo); background: var(--demo-soft); border-left: 4px solid var(--demo); border-radius: 6px; padding: 12px 16px; margin: 0 0 20px; }

form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.fields { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
fieldset { border: none; margin: 0; padding: 0; display: grid; gap: 12px 16px; align-content: start; }
fieldset:last-child { grid-template-columns: 1fr 1fr; }
legend { color: var(--navy); font-weight: 700; font-size: 16px; padding: 0 0 8px; border-bottom: 2px solid var(--soft); width: 100%; margin-bottom: 8px; }
.legend-note { display: block; color: var(--demo); font-weight: 400; font-size: 13px; }

.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.input { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.input:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 157, 141, 0.15); }
.input input { flex: 1; min-width: 0; border: none; padding: 8px 10px; font: inherit; outline: none; }
.unit { padding: 8px 10px; color: var(--muted); background: var(--soft); font-size: 13px; white-space: nowrap; min-width: 72px; text-align: center; }
.hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
.error { color: var(--error); font-size: 13px; margin-top: 2px; }
.error:empty { display: none; }
.field.invalid .input { border-color: var(--error); }
.field.invalid .hint { display: none; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented label { flex: 1; margin: 0; text-align: center; padding: 8px; cursor: pointer; font-weight: 400; }
.segmented label + label { border-left: 1px solid var(--line); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--navy); color: #fff; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: -2px; }
.field.invalid .segmented { border-color: var(--error); }

.exclusions { margin-top: 18px; color: var(--muted); font-size: 14px; }
.exclusions summary { cursor: pointer; color: var(--navy); }
.exclusions ul { margin: 6px 0 0; padding-left: 20px; }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.spacer { flex: 1; }
button { font: inherit; border-radius: 6px; cursor: pointer; padding: 10px 18px; border: 1px solid transparent; }
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--navy); color: #fff; }
.primary:not(:disabled):hover { background: #0a3c72; }
.secondary { background: #fff; color: var(--teal); border-color: var(--teal); }
.secondary:not(:disabled):hover { background: #e9f7f5; }
.link { background: none; color: var(--muted); padding: 6px 8px; text-decoration: underline; }
.status { margin-top: 12px; padding: 10px 12px; border-radius: 6px; background: #fdecea; color: var(--error); }

.results { margin: 28px 0 48px; }
.results h2 { color: var(--navy); margin: 0 0 6px; }
.demo-note { color: var(--demo); font-weight: 700; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; }
.result { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.result header { display: flex; justify-content: space-between; align-items: baseline; }
.result h3 { margin: 0; color: var(--navy); font-size: 17px; }
.target { color: var(--muted); font-size: 13px; }
.result .desc { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.result .model-note { color: var(--demo); font-size: 12px; margin: 0 0 4px; }
.gauge { position: relative; padding: 30px 0 22px; }
.gauge-stage { position: absolute; top: 0; transform: translateX(-50%); font-size: 22px; font-weight: 700; line-height: 26px; color: var(--teal); }
.gauge-score { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 13px; line-height: 18px; color: var(--text); }
.scale { position: relative; display: flex; height: 22px; border-radius: 4px; overflow: visible; }
.segment { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: rgba(0, 0, 0, 0.65); min-width: 0; overflow: hidden; border-right: 1px solid rgba(255, 255, 255, 0.7); }
.segment:first-child { border-radius: 4px 0 0 4px; }
.segment:last-of-type { border-radius: 0 4px 4px 0; border-right: none; }
.marker { position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px; background: var(--navy); border-radius: 2px; box-shadow: 0 0 0 2px #fff; }
.stage-desc { margin: 8px 0 0; font-size: 14px; }

.bottom { border-top: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; }
.bottom .wrap { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.bottom a { color: var(--muted); }

.consent { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 28, 56, 0.55); backdrop-filter: blur(4px); }
.consent[hidden] { display: none; }
.consent-box { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 28, 56, 0.3); }
.consent-box h2 { color: var(--demo); margin: 0 0 8px; font-size: 20px; }
.consent-lead { color: var(--muted); margin: 0 0 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 15px; }
.check:has(input:checked) { border-color: var(--teal); background: #f0faf8; }
.check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--teal); cursor: pointer; }
.check a { color: var(--teal); font-weight: 700; }
.consent-box .primary { width: 100%; margin-top: 6px; padding: 12px 18px; }
.consent-links { margin: 12px 0 0; text-align: center; font-size: 13px; }
.consent-links a { color: var(--muted); }

.legal { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px; margin: 24px 0 40px; }
.legal h1 { color: var(--navy); font-size: 24px; margin: 0 0 4px; }
.legal .subtitle { color: var(--muted); font-size: 17px; margin: 0 0 12px; }
.legal h2 { color: var(--navy); font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li { margin: 0 0 10px; }
.legal ol, .legal ul { padding-left: 24px; margin: 0 0 10px; }
.legal .edition { color: var(--muted); font-size: 14px; }
.legal .toc { list-style: none; padding-left: 0; }
.legal .toc a { color: var(--navy); }
.legal blockquote { margin: 0 0 10px; padding-left: 20px; border-left: 2px solid var(--soft); }
.legal a { color: var(--teal); word-break: break-word; }
.legal-nav { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.legal-nav a { color: var(--navy); }

@media print {
  .top, .bottom, .legal-nav { display: none; }
  body, .legal { background: #fff; border: none; margin: 0; padding: 0; }
}

@media (max-width: 760px) {
  .fields { grid-template-columns: 1fr; }
  fieldset:last-child { grid-template-columns: 1fr; }
  .intro h1 { font-size: 20px; }
  .top .wrap { height: 60px; }
  .logo { height: 34px; }
  .partners { gap: 12px; }
  .partner-medlinx { height: 20px; }
  .partner-helix { height: 19px; }
  .legal { padding: 20px 16px; }
}
