:root {
  color-scheme: light;
  --navy-950: #0d1c2a;
  --navy-900: #14283b;
  --navy-800: #1d3a53;
  --navy-700: #285a80;
  --navy-100: #dce7ef;
  --navy-050: #eff4f7;
  --red-700: #9f353a;
  --red-100: #f3dfe0;
  --green-700: #226346;
  --green-100: #dcebe3;
  --amber-700: #7a5917;
  --amber-100: #f4ead1;
  --ink: #1c2731;
  --muted: #62707c;
  --line: #d7dde2;
  --line-strong: #aeb9c2;
  --paper: #ffffff;
  --canvas: #f4f6f7;
  --focus: #185f96;
  --radius: 8px;
  --shadow: 0 18px 55px rgb(13 28 42 / 12%);
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
}

button,
input,
select,
textarea { font: inherit; }

button,
a,
input,
select,
textarea {
  outline-color: var(--focus);
  outline-offset: 3px;
}

button { cursor: pointer; }

a { color: var(--navy-700); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--navy-900);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 18px clamp(22px, 5vw, 80px);
  border-bottom: 1px solid #31495d;
  background: var(--navy-900);
  color: #fff;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: stretch;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand__rule {
  position: relative;
  width: 5px;
  flex: 0 0 5px;
  background: #9dc1dc;
}

.brand__rule::after {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: #ca555a;
  content: "";
}

.brand__copy { display: grid; align-content: center; line-height: 1.08; }
.brand__copy strong { font-size: 1.28rem; letter-spacing: .09em; }
.brand__copy small { margin-top: 7px; color: #bbc9d3; font-size: .73rem; font-weight: 600; }

.site-header__context {
  max-width: 400px;
  color: #b9c6d0;
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .025em;
  text-align: right;
}

.landing {
  display: grid;
  min-height: calc(100vh - 82px);
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
}

.landing__main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(54px, 9vw, 130px) clamp(28px, 8vw, 130px);
  background: var(--paper);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--navy-700);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.eyebrow::before { width: 26px; height: 2px; background: currentColor; content: ""; }
.eyebrow--inverse { color: #a9c8e1; }

.landing h1,
.question-title,
.admin-title {
  margin: 22px 0 20px;
  color: var(--navy-950);
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  font-weight: 640;
  letter-spacing: -.055em;
  line-height: .98;
}

.landing__lead { max-width: 60ch; margin: 0; color: var(--muted); font-size: 1.06rem; }

.landing__aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(40px, 6vw, 76px);
  border-left: 1px solid var(--line);
  background: var(--navy-050);
}

.aside-index { color: var(--red-700); font-size: 3rem; font-weight: 300; letter-spacing: -.06em; }
.aside-copy h2 { margin: 0 0 12px; color: var(--navy-900); font-size: 1.22rem; }
.aside-copy p { margin: 0; color: var(--muted); font-size: .92rem; }
.aside-note { padding-top: 24px; border-top: 1px solid var(--line-strong); color: var(--muted); font-size: .76rem; }

.questionnaire-shell {
  display: grid;
  min-height: calc(100vh - 82px);
  grid-template-columns: minmax(250px, .38fr) minmax(0, 1fr);
}

.questionnaire-nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(30px, 5vw, 64px);
  border-right: 1px solid var(--line);
  background: var(--navy-050);
}

.questionnaire-nav__role { margin: 12px 0 5px; color: var(--navy-900); font-size: 1.08rem; font-weight: 750; }
.questionnaire-nav__person { margin: 0; color: var(--muted); font-size: .83rem; }
.progress-track { display: block; width: 100%; height: 4px; margin: 36px 0 12px; overflow: hidden; border: 0; background: #cfdae1; appearance: none; }
.progress-track::-webkit-progress-bar { background: #cfdae1; }
.progress-track::-webkit-progress-value { background: var(--navy-700); transition: width 180ms ease; }
.progress-track::-moz-progress-bar { background: var(--navy-700); }
.progress-copy { color: var(--muted); font-size: .75rem; }
.nav-privacy { margin: 36px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .73rem; }

.question-stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: var(--paper);
}

.question-stage__content {
  display: flex;
  width: min(1020px, 100%);
  min-height: 0;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 7vw, 100px);
}

.question-number { color: var(--red-700); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.question-title { max-width: 19ch; margin: 18px 0 18px; font-size: clamp(2rem, 4.4vw, 4.15rem); }
.question-help { max-width: 67ch; margin: 0 0 32px; color: var(--muted); font-size: .94rem; }

.intro-title { max-width: 17ch; }
.intro-list { display: grid; max-width: 760px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 34px 0 0; border-block: 1px solid var(--line); }
.intro-list div { min-width: 0; padding: 22px 22px 22px 0; }
.intro-list div + div { padding-left: 22px; border-left: 1px solid var(--line); }
.intro-list strong { display: block; color: var(--navy-900); font-size: .95rem; }
.intro-list span { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; }

.field-grid { display: grid; max-width: 780px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: grid; gap: 8px; }
.field--wide { grid-column: 1 / -1; }
.field label,
.field legend { color: var(--navy-900); font-size: .79rem; font-weight: 750; }
.required { color: var(--red-700); }

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.textarea-input { min-height: 150px; resize: vertical; line-height: 1.55; }
.text-input:focus,
.select-input:focus,
.textarea-input:focus { border-color: var(--focus); box-shadow: 0 0 0 4px rgb(24 95 150 / 12%); }
.field-error { margin: 0; color: var(--red-700); font-size: .78rem; font-weight: 650; }

.choice-list { display: grid; max-width: 840px; gap: 10px; margin: 0; padding: 0; border: 0; }
.choice {
  position: relative;
  display: grid;
  min-height: 58px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.choice:hover { border-color: var(--navy-700); background: var(--navy-050); }
.choice:has(input:checked) { border-color: var(--navy-700); background: var(--navy-050); box-shadow: inset 4px 0 0 var(--navy-700); }
.choice input { width: 20px; height: 20px; accent-color: var(--navy-700); }
.choice span { font-size: .9rem; }

.question-actions {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(28px, 7vw, 100px);
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--navy-900);
  border-radius: 5px;
  background: var(--navy-900);
  color: #fff;
  font-size: .82rem;
  font-weight: 750;
  text-decoration: none;
}
.button:hover { border-color: var(--navy-700); background: var(--navy-700); }
.button:disabled { cursor: wait; opacity: .55; }
.button--secondary { border-color: var(--line-strong); background: var(--paper); color: var(--navy-900); }
.button--secondary:hover { border-color: var(--navy-700); background: var(--navy-050); }
.button--danger { border-color: var(--red-700); background: transparent; color: var(--red-700); }
.button--quiet { min-height: 40px; padding: 8px 12px; border-color: var(--line); background: transparent; color: var(--muted); }
.save-status { color: var(--muted); font-size: .73rem; }
.save-status--ok { color: var(--green-700); }
.save-status--error { color: var(--red-700); }

.review-list { max-width: 900px; border-top: 1px solid var(--line); }
.review-item { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: 28px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.review-item dt { color: var(--muted); font-size: .78rem; font-weight: 700; }
.review-item dd { margin: 0; color: var(--ink); font-size: .88rem; white-space: pre-wrap; }
.consent { display: flex; max-width: 900px; align-items: flex-start; gap: 12px; margin-top: 28px; color: var(--ink); font-size: .84rem; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--navy-700); }

.status-page { display: grid; min-height: calc(100vh - 82px); place-items: center; padding: 50px 24px; background: var(--paper); }
.status-page__inner { width: min(760px, 100%); }
.status-mark { width: 58px; height: 5px; margin-bottom: 34px; background: var(--red-700); }
.status-page h1 { margin: 0 0 16px; color: var(--navy-950); font-size: clamp(2.2rem, 5vw, 4rem); letter-spacing: -.045em; line-height: 1; }
.status-page p { max-width: 62ch; color: var(--muted); }
.folio { display: inline-grid; gap: 3px; margin: 22px 0; padding: 16px 20px; border-left: 4px solid var(--navy-700); background: var(--navy-050); }
.folio small { color: var(--muted); font-size: .68rem; font-weight: 750; text-transform: uppercase; }
.folio strong { color: var(--navy-900); font-size: 1.25rem; letter-spacing: .05em; }

.admin-page { min-height: calc(100vh - 82px); background: var(--paper); }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: clamp(42px, 6vw, 76px) clamp(24px, 6vw, 88px) 34px; border-bottom: 1px solid var(--line); background: var(--navy-050); }
.admin-title { margin: 12px 0 0; font-size: clamp(2.4rem, 5vw, 4.8rem); }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.admin-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.metric { padding: 24px clamp(20px, 4vw, 44px); }
.metric + .metric { border-left: 1px solid var(--line); }
.metric strong { display: block; color: var(--navy-900); font-size: 2.25rem; font-weight: 620; line-height: 1; }
.metric span { display: block; margin-top: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.admin-content { padding: 34px clamp(24px, 6vw, 88px) 70px; }
.admin-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.admin-section-heading h2 { margin: 0; color: var(--navy-900); font-size: 1.2rem; }
.admin-section-heading p { margin: 0; color: var(--muted); font-size: .78rem; }

.admin-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 130px auto; align-items: end; gap: 14px; margin-bottom: 36px; padding: 24px 0 30px; border-bottom: 1px solid var(--line); }
.admin-form .field label { font-size: .72rem; }
.admin-form .text-input,
.admin-form .select-input { min-height: 46px; font-size: .84rem; }

.generated-link { margin: -16px 0 34px; padding: 22px 24px; border-left: 4px solid var(--green-700); background: var(--green-100); }
.generated-link h3 { margin: 0 0 5px; color: var(--green-700); font-size: .95rem; }
.generated-link p { margin: 0 0 12px; color: #395447; font-size: .78rem; }
.generated-link__row { display: flex; align-items: center; gap: 10px; }
.generated-link code { min-width: 0; flex: 1; overflow: hidden; color: #183b2b; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }

.table-wrap { width: 100%; overflow-x: auto; border-block: 1px solid var(--line); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.admin-table th { padding: 13px 12px; background: var(--navy-050); color: var(--muted); font-size: .67rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.admin-table td { padding: 16px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.admin-table strong { color: var(--navy-900); }
.admin-table small { display: block; margin-top: 3px; color: var(--muted); }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--navy-050); color: var(--navy-700); font-size: .67rem; font-weight: 750; }
.badge--submitted { background: var(--green-100); color: var(--green-700); }
.badge--revoked,
.badge--expired { background: var(--red-100); color: var(--red-700); }
.badge--draft { background: var(--amber-100); color: var(--amber-700); }
.empty-state { padding: 50px 0; color: var(--muted); text-align: center; }

.response-detail { margin: 0; padding: 0 clamp(24px, 6vw, 88px) 34px; }
.response-detail__inner { padding: 24px; border-left: 4px solid var(--navy-700); background: var(--navy-050); }
.response-detail h3 { margin: 0 0 18px; color: var(--navy-900); }

.login-admin { display: grid; min-height: calc(100vh - 82px); grid-template-columns: 1fr 1fr; }
.login-admin__context { display: flex; flex-direction: column; justify-content: center; padding: clamp(45px, 8vw, 110px); background: var(--navy-900); color: #fff; }
.login-admin__context h1 { max-width: 10ch; margin: 18px 0; font-size: clamp(2.7rem, 6vw, 5rem); letter-spacing: -.055em; line-height: .98; }
.login-admin__context p { max-width: 46ch; color: #bac8d2; }
.login-admin__form { display: flex; flex-direction: column; justify-content: center; padding: clamp(45px, 8vw, 110px); background: var(--paper); }
.login-admin__form form { display: grid; max-width: 500px; gap: 18px; }

.notice { margin: 0 0 18px; padding: 12px 14px; border-left: 4px solid var(--red-700); background: var(--red-100); color: #6e262a; font-size: .8rem; }
.loading-line { width: 160px; height: 4px; overflow: hidden; background: var(--line); }
.loading-line::after { display: block; width: 45%; height: 100%; background: var(--navy-700); animation: loading 1s ease-in-out infinite alternate; content: ""; }
@keyframes loading { to { transform: translateX(125%); } }

@media (max-width: 980px) {
  .landing { grid-template-columns: 1fr; }
  .landing__aside { min-height: 330px; border-top: 1px solid var(--line); border-left: 0; }
  .questionnaire-shell { grid-template-columns: 1fr; }
  .questionnaire-nav { display: block; padding: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-privacy { display: none; }
  .progress-track { margin: 17px 0 8px; }
  .admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form .button { align-self: end; }
  .login-admin { grid-template-columns: 1fr; }
  .login-admin__context { min-height: 380px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-header { min-height: 72px; padding: 15px 20px; }
  .site-header__context { display: none; }
  .brand__copy strong { font-size: 1.08rem; }
  .brand__copy small { font-size: .66rem; white-space: nowrap; }
  .landing,
  .questionnaire-shell,
  .status-page,
  .admin-page,
  .login-admin { min-height: calc(100vh - 72px); }
  .landing__main { padding: 60px 24px; }
  .landing h1 { font-size: clamp(2.7rem, 15vw, 4.5rem); }
  .landing__aside { padding: 42px 24px; }
  .question-stage__content { padding: 46px 24px; }
  .question-title { max-width: none; font-size: clamp(2.05rem, 10vw, 3.4rem); }
  .intro-list { grid-template-columns: 1fr; }
  .intro-list div { padding: 17px 0; }
  .intro-list div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .field-grid { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .question-actions { min-height: auto; padding: 15px 24px; }
  .question-actions .save-status { display: none; }
  .review-item { grid-template-columns: 1fr; gap: 6px; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-actions { justify-content: flex-start; }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .admin-form { grid-template-columns: 1fr; }
  .generated-link__row { align-items: stretch; flex-direction: column; }
  .generated-link code { white-space: normal; word-break: break-all; }
}

@media print {
  .site-header,
  .questionnaire-nav,
  .question-actions,
  .button { display: none !important; }
  .status-page { min-height: 0; padding: 30px; }
  body { background: #fff; }
}

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