:root {
  --bg: #f5f7f9;
  --card: #ffffff;
  --ink: #101820;
  --muted: #5f6b76;
  --line: #d9e0e6;
  --navy: #0f1f2e;
  --accent: #1f5f9b;
  --accent-dark: #184d7d;
  --accent-soft: #eef4f9;
  --ok: #246645;
  --warn: #8a5a00;
  --bad: #9f2d25;
  --shadow: 0 3px 12px rgba(15, 31, 46, .045);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hero {
  background: var(--navy);
  color: white;
  padding: 46px 20px 40px;
  border-bottom: 4px solid var(--accent);
}

.hero__inner,
.container {
  max-width: 1180px;
  margin: 0 auto;
}

.eyebrow,
.step {
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 800;
  font-size: .72rem;
}

.eyebrow {
  margin-bottom: 8px;
  color: #9ec4e5;
}

h1 {
  margin: .15rem 0 .65rem;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.02;
  letter-spacing: -.025em;
}

.lede {
  max-width: 820px;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.55;
  color: #d7e2ec;
}

.container {
  padding: 28px 18px 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
}

.section-head--split {
  justify-content: space-between;
  gap: 24px;
}

.step {
  color: var(--accent);
  margin: 0 0 5px;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -.01em;
}

h3 {
  margin: .1rem 0 .8rem;
  font-size: 1.02rem;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.micro {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
  margin: .2rem 0 0;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: .87rem;
  font-weight: 700;
  color: #34414d;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd4dc;
  border-radius: 7px;
  background: white;
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(31, 95, 155, .14);
  border-color: var(--accent);
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.toggle input { display: none; }

.toggle span {
  width: 44px;
  height: 24px;
  border-radius: 99px;
  background: #cbd3da;
  position: relative;
  transition: .2s;
}

.toggle span:after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  left: 3px;
  top: 3px;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}

.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span:after { transform: translateX(20px); }

.preset-rationale {
  background: var(--accent-soft);
  border: 1px solid #d5e3ef;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 18px;
  color: #27435f;
}

.weights-grid { display: grid; gap: 13px; }

.weight-row {
  display: grid;
  grid-template-columns: 170px 1fr 70px;
  gap: 16px;
  align-items: center;
}

.weight-row span { font-weight: 750; }
.weight-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.weight-row input[type=range] { padding: 0; accent-color: var(--accent); }
.weight-total { margin-top: 16px; text-align: right; color: var(--muted); }

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

.domain-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 18px;
  display: grid;
  gap: 12px;
  background: #fff;
}

.domain-card:last-child { grid-column: 1 / -1; }

.domain-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pill {
  background: #f1f4f7;
  color: #4c5a67;
  border: 1px solid #dde3e8;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 800;
  font-size: .72rem;
}

.check {
  flex-direction: row;
  align-items: center;
  font-weight: 650;
}

.check input { width: auto; accent-color: var(--accent); }

.domain-score {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.domain-score strong {
  font-size: 1.35rem;
  color: var(--accent-dark);
}

.results-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
}

.score-ring {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) 0deg, #e6ebef 0deg);
  position: relative;
}

.score-ring:before {
  content: "";
  position: absolute;
  inset: 16px;
  background: white;
  border-radius: 50%;
}

.score-ring div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.score-ring span {
  font-size: 3.2rem;
  font-weight: 850;
  letter-spacing: -.055em;
  color: var(--navy);
}

.score-ring small {
  font-size: .95rem;
  color: var(--muted);
}

.status {
  font-size: 1.35rem;
  font-weight: 850;
  margin-bottom: 6px;
}

.bar-list { display: grid; gap: 9px; margin-top: 18px; }

.bar-row {
  display: grid;
  grid-template-columns: 145px 1fr 54px;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
}

.track {
  height: 8px;
  background: #e7ecf0;
  border-radius: 999px;
  overflow: hidden;
}

.fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.gate-box {
  margin-top: 22px;
  padding: 15px;
  border-radius: 8px;
  background: #f7f8fa;
  border: 1px solid var(--line);
}

.gate-box.ok { background: #eff7f2; border-color: #c8dfd1; color: #245b3f; }
.gate-box.warn { background: #fff8ec; border-color: #ead9b5; color: #74500c; }
.gate-box.bad { background: #fff1f0; border-color: #e7c6c2; color: #842b24; }

.actions { display: flex; gap: 10px; margin-top: 18px; }

.button {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: white;
  padding: 10px 15px;
  border-radius: 7px;
  font-weight: 800;
  cursor: pointer;
}

.button:hover { background: var(--accent-dark); }

.button--ghost {
  background: white;
  border-color: #cbd4dc;
  color: #344252;
}

.button--ghost:hover { background: #f3f5f7; }

.evidence-card ul {
  margin: .4rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.6;
}

.disclaimer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: #505e6c;
  line-height: 1.55;
}

footer {
  text-align: center;
  padding: 0 20px 35px;
  color: #7b8794;
  font-size: .82rem;
}

@media (max-width: 850px) {
  .grid-3,
  .grid-2,
  .domain-grid,
  .results-layout { grid-template-columns: 1fr; }
  .domain-card:last-child { grid-column: auto; }
  .weight-row { grid-template-columns: 120px 1fr 58px; }
  .score-ring { margin: auto; }
  .section-head--split { flex-direction: column; }
  .hero { padding-top: 40px; }
  .card { padding: 20px; }
}

@media print {
  body { background: white; }
  .hero { padding: 24px 18px; border-bottom-width: 2px; }
  .container { padding: 12px; }
  .card { box-shadow: none; break-inside: avoid; }
  .actions { display: none; }
}

/* V3 additions */
.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.mini-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-nav a {
  color: #d7e2ec;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.18);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 750;
}

.mini-nav a:hover,
.mini-nav__active {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.32) !important;
}

.byline {
  margin: 14px 0 0;
  font-size: .88rem;
  color: #b9c9d8;
}

.text-link {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 800;
  font-size: .88rem;
  white-space: nowrap;
  margin-top: 3px;
}

.text-link:hover { text-decoration: underline; }

.domain-card--decision {
  background: #fbfcfd;
}

.decision-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.decision-fieldset legend {
  grid-column: 1 / -1;
  font-size: .87rem;
  font-weight: 800;
  color: #34414d;
  margin-bottom: 2px;
}

.choice {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  background: white;
}

.choice:hover { border-color: #aebdca; }
.choice input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.choice span { display: grid; gap: 2px; }
.choice strong { color: var(--ink); }
.choice small { color: var(--muted); font-weight: 500; line-height: 1.35; }

.observer-guide {
  background: #f6f8fa;
  border: 1px solid #e0e6eb;
  border-radius: 8px;
  padding: 12px 14px;
}

.observer-guide ul {
  margin: 6px 0 0;
  padding-left: 1.15rem;
  color: #4c5965;
  font-size: .82rem;
  line-height: 1.48;
}

.micro-heading {
  margin: 0;
  font-size: .78rem;
  font-weight: 850;
  color: #34414d;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.button-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.hero--compact {
  padding-top: 34px;
  padding-bottom: 32px;
}

.hero--compact h1 {
  font-size: clamp(1.9rem, 3vw, 3rem);
}

.guide-container {
  max-width: 1050px;
}

.guide-intro ul,
.clean-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.65;
  color: #455360;
}

.guide-section {
  margin: 28px 0 34px;
}

.guide-section__head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 13px;
}

.guide-section__head > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: white;
  border-radius: 7px;
  font-weight: 850;
  font-size: .78rem;
}

.guide-section__head h2 { margin-top: 2px; }
.guide-section__head p { margin: 4px 0 0; color: var(--muted); }

.test-card {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.test-card h3 {
  font-size: 1.12rem;
  margin: 0 0 14px;
}

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

.test-grid h4 {
  margin: 0 0 6px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent-dark);
}

.test-grid ul {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.6;
  color: #455360;
  font-size: .9rem;
}

.guide-note,
.alert-inline {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: 7px;
  background: var(--accent-soft);
  border: 1px solid #d8e5ef;
  color: #2d4b66;
  font-size: .86rem;
  line-height: 1.5;
}

.alert-inline { margin: 0 0 15px; }

.binary-rule {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.binary-rule span {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #f8fafb;
  text-align: center;
}

.references-card { margin-top: 12px; }
.reference-list { display: grid; gap: 10px; margin: 16px 0; }
.reference-list p { margin: 0; line-height: 1.5; color: #455360; font-size: .9rem; }

@media (max-width: 850px) {
  .topline { align-items: flex-start; flex-direction: column; }
  .decision-fieldset,
  .test-grid,
  .binary-rule { grid-template-columns: 1fr; }
  .section-head--split .text-link { white-space: normal; }
}

@media print {
  .mini-nav,
  .text-link,
  .guide-container .button { display: none !important; }
  .test-card { break-inside: avoid; box-shadow: none; }
}


/* V4 additions */
.evidence-note {
  border-left: 3px solid #b9cfe2;
  padding-left: 10px;
}
.evidence-note span { color: #365d7d; font-weight: 700; }
.calculated-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  background: #f6f8fa;
  border: 1px solid #e0e6eb;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: .82rem;
  color: #4b5966;
}
.calculated-line strong { color: var(--accent-dark); text-align: right; }
.is-disabled { opacity: .52; }
.evidence-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 18px;
  padding: 12px 14px;
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .85rem;
}
.evidence-strip a, .reference-list a { color: var(--accent-dark); font-weight: 750; text-decoration: none; }
.evidence-strip a:hover, .reference-list a:hover { text-decoration: underline; }
.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.resource-card {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.resource-card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.resource-card .citation { color: #455360; font-size: .86rem; line-height: 1.45; margin: 0 0 9px; }
.resource-card .why { color: var(--muted); font-size: .86rem; line-height: 1.5; margin: 0 0 12px; }
.resource-card a { color: var(--accent-dark); font-weight: 800; text-decoration: none; }
.resource-card a:hover { text-decoration: underline; }
.resource-section { margin: 28px 0 34px; }
.resource-section > h2 { margin-bottom: 5px; }
.resource-section > p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
@media (max-width:850px) { .resource-grid { grid-template-columns: 1fr; } .calculated-line { align-items:flex-start; flex-direction:column; } .calculated-line strong { text-align:left; } }
