:root {
  --navy: #0b1d3a;
  --secondary: #102a43;
  --teal: #0f766e;
  --teal-hover: #0b5b55;
  --cream: #f6f1e8;
  --surface: #ffffff;
  --surface-elevated: #faf7f0;
  --border: #cbd5e1;
  --text: #102a43;
  --muted: #52606d;
  --warning: #8a5a14;
  --warning-bg: #fff8e7;
  --error: #b42318;
  --error-bg: #fff1f0;
  --info: #245f91;
  --focus: #0f766e;
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--cream);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--cream); color: var(--text); font-size: 16px; line-height: 1.6; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--teal-hover); }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="radio"] { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: .68; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10; top: 8px; left: 8px; transform: translateY(-150%); background: var(--navy); color: white; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.site-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(16px, 4vw, 40px); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; min-height: 44px; align-items: center; gap: 10px; color: var(--navy); font-weight: 800; font-size: 1.1rem; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--navy); color: white; font-size: .72rem; letter-spacing: .04em; }
.candidate-badge, .status-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; border: 1px solid #b9872e; border-radius: 999px; background: var(--warning-bg); color: #68410b; font-size: .78rem; font-weight: 750; }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; color: var(--muted); font-size: .9rem; }
.breadcrumb a { display: inline-flex; min-height: 44px; align-items: center; }
.page-intro { max-width: 780px; }
.eyebrow, .step-label { margin: 0 0 6px; color: var(--teal); font-size: .78rem; line-height: 1.3; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 18ch; margin: 0; color: var(--navy); font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.08; letter-spacing: -.025em; }
h2 { color: var(--navy); line-height: 1.2; }
h3 { color: var(--secondary); line-height: 1.25; }
.lede { max-width: 70ch; margin: 18px 0 0; color: var(--muted); font-size: 1.08rem; }

.critical-alert { display: grid; grid-template-columns: auto 1fr; gap: 14px; max-width: 920px; margin: 28px 0; padding: 18px 20px; border: 2px solid var(--warning); border-radius: 14px; background: var(--warning-bg); color: #5e3c0c; }
.critical-alert svg { margin-top: 2px; flex: none; }
.critical-alert h2 { margin: 0 0 4px; color: #5e3c0c; font-size: 1.15rem; }
.critical-alert p { margin: 0; }

.access-card, .calculator-card, .evidence-card { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 12px 28px rgba(16, 42, 67, .07); }
.access-card { max-width: 720px; padding: clamp(20px, 4vw, 30px); }
.access-card h2 { margin: 0 0 8px; }
.access-card p { max-width: 68ch; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 24px; }
.calculator-card { padding: clamp(20px, 4vw, 32px); }
.evidence-card { position: sticky; top: 24px; padding: 24px; }
.section-heading { margin-bottom: 28px; }
.section-heading h2, .evidence-card h2 { margin: 0 0 8px; font-size: clamp(1.45rem, 3vw, 2rem); }
.section-heading p:last-child { margin: 0; color: var(--muted); }

.field-group, .field { margin: 0 0 20px; }
.field-group { padding: 0; border: 0; }
legend, label { display: block; margin-bottom: 8px; color: var(--secondary); font-weight: 700; }
.form-grid { display: grid; gap: 16px; }
.two-column { grid-template-columns: minmax(0, 1.4fr) minmax(160px, .6fr); }
.patient-strip { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); align-items: start; gap: 18px; margin-bottom: 24px; padding: 18px; border: 1px solid #9fc8c3; border-radius: 14px; background: #f2faf8; }
.patient-strip .field-group, .patient-strip .field { margin-bottom: 0; }
.patient-weight-grid { min-width: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice { display: flex; min-height: 48px; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); background: #f0fdfa; }
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; flex: none; accent-color: var(--teal); }
input[type="number"], select { width: 100%; min-height: 48px; border: 1px solid #94a3b8; border-radius: 10px; background: var(--surface); color: var(--text); padding: 10px 12px; font-size: 16px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.field-help, .field-error { margin: 6px 0 0; font-size: .9rem; }
.field-help { color: var(--muted); }
.field-error { min-height: 1.25em; color: var(--error); font-weight: 650; }
.check-row { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-elevated); font-weight: 600; }
.check-row input { margin-top: 3px; }
.section-divider { height: 1px; margin: 26px 0; background: var(--border); }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 750; text-decoration: none; transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease; }
.primary { background: var(--teal); color: white; }
.primary:hover { background: var(--teal-hover); color: white; }
.secondary { border-color: #94a3b8; background: var(--surface); color: var(--secondary); }
.secondary:hover { border-color: var(--secondary); background: #f8fafc; }
.calculate-button { width: 100%; margin-top: 8px; }
.error-summary { margin: 18px 0; padding: 14px 16px; border: 2px solid var(--error); border-radius: 10px; background: var(--error-bg); }
.error-summary h3, .error-summary p { margin: 0; color: #781b16; }
.error-summary p { margin-top: 4px; }

.result-panel { margin-top: 32px; padding-top: 28px; border-top: 3px solid var(--navy); }
.result-heading-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.result-heading-row h2 { margin: 0; }
.result-drug { margin: 14px 0; color: var(--secondary); font-size: 1.12rem; font-weight: 750; }
.result-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.result-values > div { padding: 18px; border-radius: 12px; background: #edf8f6; border: 1px solid #8ed1c9; }
.result-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .88rem; font-weight: 700; }
.result-values strong { display: block; color: var(--navy); font-size: clamp(1.55rem, 4vw, 2.25rem); line-height: 1.15; }
.result-details, .review-metadata { margin: 22px 0; }
.result-details > div, .review-metadata > div { display: grid; grid-template-columns: minmax(140px, .4fr) minmax(0, .6fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; color: var(--text); font-weight: 600; }
.follow-on, .administration-note, .result-warning, .event-lock { margin-top: 20px; padding: 16px 18px; border-radius: 12px; }
.follow-on { border: 1px solid #93b9d8; background: #f1f7fc; }
.administration-note { border: 1px solid var(--border); background: var(--surface-elevated); }
.result-warning { border: 2px solid var(--warning); background: var(--warning-bg); }
.event-lock { border: 2px solid var(--warning); background: var(--warning-bg); }
.follow-on h3, .administration-note h3, .result-warning h3, .event-lock h3 { margin: 0 0 6px; font-size: 1rem; }
.follow-on p, .administration-note p { margin: 0; }
.event-lock p { margin: 0 0 12px; }
.result-population-exclusion { margin: 8px 0 0; color: #5e3c0c; }
.result-warning ul { margin: 6px 0 0; padding-left: 20px; }
.result-panel > .button { margin-top: 20px; }

.evidence-card h3 { margin: 24px 0 8px; font-size: 1rem; }
.review-metadata > div { display: block; }
.review-metadata dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.review-metadata dd { margin-top: 2px; }
.source-list { margin: 0; padding-left: 20px; }
.source-list li { margin-bottom: 10px; }
.source-list a { display: inline-flex; min-height: 44px; align-items: center; overflow-wrap: anywhere; }
.source-disclosure { margin-top: 20px; }
.source-disclosure summary { min-height: 44px; padding: 10px 2px; color: var(--teal); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.source-disclosure[open] summary { margin-bottom: 8px; }
.concern-route { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); }
.concern-route a { display: inline-flex; min-height: 44px; align-items: center; }
.site-footer { padding: 24px 16px; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); text-align: center; }
.site-footer p { max-width: 75ch; margin: 0 auto; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .evidence-card { position: static; }
  .patient-strip { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .site-header { align-items: flex-start; }
  .candidate-badge { max-width: 145px; text-align: center; }
  .page-shell { width: min(100% - 32px, 1180px); padding-top: 22px; }
  .two-column, .result-values { grid-template-columns: 1fr; }
  .result-details > div { grid-template-columns: 1fr; gap: 2px; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
}

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

@media print {
  body > * { display: none !important; }
  body::before { display: block; padding: 32px; content: "Printing this emergency clinical calculation is disabled. Reopen the protected tool and verify the current source before use."; color: #000; background: #fff; }
}
