:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #17212f;
  --muted: #667085;
  --line: #d7dde5;
  --line-strong: #b8c3cf;
  --accent: #145a86;
  --accent-dark: #0d4264;
  --accent-soft: #e8f3f8;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--accent);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.shell {
  width: min(100% - 24px, 1000px);
  margin: 0 auto;
  padding: 16px 0 28px;
}

.site-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.office-link {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: #344054;
  font-size: 14px;
}

.office-link span {
  color: var(--accent);
}

.start-panel,
.question-card,
.result-intro,
.result-card,
.notice-box,
.web-c-section,
.result-cta-area {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.start-panel,
.question-card,
.result-intro {
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 24px;
  box-shadow: var(--shadow);
}

.start-panel {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow,
.question-meta,
.cta-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.operator {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 16px;
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 0 0 16px;
  font-size: 18px;
}

.muted,
.privacy-note {
  color: var(--muted);
}

.privacy-note {
  margin: 12px 0 0;
  font-size: 14px;
}

button {
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible + .option-marker {
  outline: 3px solid #8ecae6;
  outline-offset: 3px;
}

button.secondary {
  color: var(--accent);
  background: #fff;
  border-color: var(--line-strong);
}

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

button:disabled {
  color: #98a2b3;
  background: #eef1f4;
  border-color: #eef1f4;
  cursor: not-allowed;
}

.primary-cta {
  width: 100%;
  margin-top: 20px;
}

.answer-area {
  margin-top: 20px;
}

.options {
  display: grid;
  gap: 12px;
}

.option-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 58px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.option-card:hover {
  border-color: var(--accent);
  background: #fbfdff;
}

.option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-marker {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
}

.option-card input[type="checkbox"] + .option-marker {
  border-radius: 5px;
}

.option-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.option-card input:checked + .option-marker {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px #fff;
}

.option-text {
  font-weight: 700;
}

.number-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

input[type="number"] {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  font: inherit;
}

input[type="number"]:focus-visible {
  outline: 3px solid #8ecae6;
  outline-offset: 3px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="tel"]:focus-visible,
select:focus-visible,
textarea:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 3px solid #8ecae6;
  outline-offset: 3px;
}

.question-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.error {
  min-height: 1.5em;
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.results {
  display: grid;
  gap: 14px;
  width: min(100%, 1000px);
  margin: 18px auto 0;
}

.notice-box {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #fbfcfd;
}

.candidate-count {
  margin: 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 800;
}

.notice-box h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.notice-box p {
  margin: 0;
}

.result-section-title {
  margin: 10px 0 0;
  font-size: 22px;
}

.result-card {
  padding: 18px;
}

.status-label {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 900;
}

.grant-name {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.35;
}

.result-card h3 {
  margin: 4px 0 16px;
  color: #344054;
  font-size: 18px;
  line-height: 1.4;
}

.result-detail {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.result-detail summary,
.web-c-section summary {
  cursor: pointer;
  font-weight: 900;
}

.result-detail p,
.result-detail ul {
  margin: 10px 0 0;
}

.result-detail ul {
  padding-left: 1.4rem;
}

.timing-caution {
  color: #344054;
  font-weight: 800;
}

.result-muted {
  background: #fbfcfd;
}

.web-c-section {
  padding: 16px;
  background: #fbfcfd;
}

.web-c-section .result-card {
  margin-top: 12px;
}

.result-cta-area {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.cta-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.cta-block h2 {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.45;
}

.cta-block button {
  width: 100%;
}

.intake-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 20px 2px 2px;
}

.intake-form[hidden] {
  display: none;
}

.intake-form label {
  font-weight: 800;
}

.form-heading h2 {
  margin: 0;
  font-size: 22px;
}

.form-notice,
.sensitive-warning,
.form-status {
  margin: 0;
}

.form-notice {
  color: #344054;
}

.sensitive-warning {
  border-left: 4px solid #d97706;
  padding: 10px 12px;
  background: var(--warning-soft);
  font-weight: 800;
}

.check-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 4px 0 0;
}

.form-status {
  min-height: 1.65em;
  color: var(--accent-dark);
  font-weight: 800;
}

.debug {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.debug pre {
  overflow-x: auto;
  background: #111827;
  color: #f9fafb;
  padding: 12px;
  border-radius: 6px;
}

@media (min-width: 720px) {
  .shell {
    padding-top: 24px;
  }

  .start-panel,
  .question-card,
  .result-intro {
    padding: 36px;
  }

  .primary-cta {
    width: auto;
    align-self: flex-start;
  }

  .question-actions {
    grid-template-columns: 180px 1fr;
  }

  .result-cta-area {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .site-header {
    justify-content: flex-start;
  }

  h1 {
    font-size: 28px;
  }

  .lead {
    font-size: 16px;
  }

  button {
    width: 100%;
  }
}

.referral-approval-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0 0 20px;
}

.referral-approval-details dt {
  font-weight: 800;
  color: #344054;
}

.referral-approval-details dd {
  margin: 0;
}
}
