:root {
  --asphalt-950: #1c2321;
  --asphalt-850: #29322f;
  --asphalt-700: #46524e;
  --asphalt-500: #6c7874;
  --asphalt-250: #cdd4d1;
  --asphalt-150: #e2e7e4;
  --asphalt-075: #f0f3f1;
  --paper: #fbfcfb;
  --green-800: #244d39;
  --green-700: #315f49;
  --green-600: #3c7357;
  --green-200: #cce0d3;
  --green-100: #e4efe8;
  --amber-700: #7d551c;
  --amber-100: #fff1cf;
  --red-700: #8a3030;
  --red-100: #fbe7e4;
  --shadow: 0 10px 30px rgba(28, 35, 33, .08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(60, 115, 87, .12), transparent 34rem),
    var(--asphalt-075);
  color: var(--asphalt-950);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

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

button,
select,
input[type="radio"],
input[type="checkbox"] {
  cursor: pointer;
}

.wrap {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.page-header {
  padding: 1.4rem 0 1rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.eyebrow {
  margin: 0 0 .25rem;
  color: var(--green-700);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -.025em;
}

.subtitle {
  max-width: 46rem;
  margin: .55rem 0 0;
  color: var(--asphalt-700);
}

.language-control {
  display: inline-flex;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--asphalt-250);
  border-radius: .65rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.language-control button {
  border: 0;
  border-right: 1px solid var(--asphalt-250);
  background: transparent;
  color: var(--asphalt-700);
  padding: .55rem .72rem;
  font-size: .82rem;
  font-weight: 800;
}

.language-control button:last-child {
  border-right: 0;
}

.language-control button.active {
  background: var(--green-700);
  color: white;
}

.notice,
.card,
.progress-panel {
  border: 1px solid var(--asphalt-250);
  border-radius: .85rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.notice {
  margin: .75rem 0;
  padding: .82rem 1rem;
  border-left: .35rem solid var(--green-600);
  color: var(--asphalt-700);
  font-size: .91rem;
}

.notice p {
  margin: 0;
}

.notice-detail {
  margin-top: .35rem !important;
  font-size: .84rem;
}

.notice-translation {
  border-left-color: var(--amber-700);
  background: #fffaf0;
}

.notice-private {
  border-left-color: var(--asphalt-500);
}

.notice-crisis {
  border-left-color: var(--red-700);
  background: var(--red-100);
  color: #672626;
}

.card {
  margin: 1.1rem 0;
  padding: clamp(1rem, 3vw, 1.45rem);
}

.section-title,
.card h3 {
  margin: 0 0 .75rem;
  line-height: 1.25;
}

.section-title {
  font-size: 1.15rem;
}

.card h3 {
  margin-top: 1.35rem;
  font-size: 1rem;
}

.muted,
.fine-print,
small {
  color: var(--asphalt-700);
}

.fine-print,
small {
  font-size: .84rem;
}

.settings-grid,
.criterion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  color: var(--asphalt-700);
  font-size: .88rem;
  font-weight: 700;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--asphalt-250);
  border-radius: .55rem;
  background: white;
  color: var(--asphalt-950);
  padding: .65rem .72rem;
}

textarea {
  resize: vertical;
}

.span-2 {
  grid-column: 1 / -1;
}

.exposure-fieldset {
  margin: 1rem 0 0;
  border: 1px solid var(--asphalt-250);
  border-radius: .65rem;
  padding: .8rem 1rem 1rem;
}

.exposure-fieldset legend {
  color: var(--asphalt-700);
  padding: 0 .3rem;
  font-size: .88rem;
  font-weight: 800;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem 1rem;
}

.check-list label {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  align-items: start;
  gap: .55rem;
  color: var(--asphalt-950);
  font-weight: 500;
}

.check-list input {
  margin-top: .23rem;
}

.lead-in {
  margin-bottom: 0;
  color: var(--green-800);
  font-weight: 800;
}

.progress-panel {
  position: sticky;
  top: .6rem;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
  margin: 1.1rem 0;
  padding: .72rem 1rem;
}

.progress-panel > div:first-child {
  display: flex;
  gap: .45rem;
  white-space: nowrap;
}

.progress-track {
  overflow: hidden;
  height: .55rem;
  border-radius: 99rem;
  background: var(--asphalt-150);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green-600);
  transition: width .2s ease;
}

.item-card {
  margin: .85rem 0;
  border: 1px solid var(--asphalt-250);
  border-radius: .85rem;
  background: var(--paper);
  padding: 1rem;
  box-shadow: 0 5px 18px rgba(28, 35, 33, .05);
}

.item-card:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(60, 115, 87, .12);
}

.item-card.missing {
  border-color: var(--red-700);
  background: #fffafa;
}

.item-card legend {
  width: 100%;
  padding: 0;
  color: var(--asphalt-950);
  font-weight: 750;
}

.item-number {
  display: inline-grid;
  width: 1.8rem;
  height: 1.8rem;
  margin-right: .45rem;
  place-items: center;
  border-radius: 50%;
  background: var(--asphalt-850);
  color: white;
  font-size: .78rem;
  vertical-align: middle;
}

.response-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .9rem;
}

.response-option {
  min-height: 5.2rem;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  border: 1px solid var(--asphalt-250);
  border-radius: .65rem;
  background: white;
  color: var(--asphalt-700);
  padding: .55rem .35rem;
  text-align: center;
  font-size: .77rem;
  font-weight: 600;
}

.response-option:hover {
  border-color: var(--green-600);
  background: var(--green-100);
}

.response-option:has(input:checked) {
  border-color: var(--green-700);
  background: var(--green-700);
  color: white;
}

.response-option input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--green-700);
}

.response-score {
  font-size: 1rem;
  font-weight: 850;
}

.form-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin: 1.1rem 0;
}

.form-actions {
  justify-content: flex-end;
}

.button {
  border: 1px solid var(--asphalt-250);
  border-radius: .6rem;
  background: var(--paper);
  color: var(--asphalt-950);
  padding: .65rem 1rem;
  font-weight: 800;
}

.button:hover {
  border-color: var(--green-600);
  background: var(--green-100);
}

.button-primary {
  border-color: var(--green-700);
  background: var(--green-700);
  color: white;
}

.button-primary:hover {
  background: var(--green-800);
  color: white;
}

.button-danger {
  border-color: #d7aaaa;
  color: var(--red-700);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.form-error,
.inline-warning {
  border: 1px solid #d8b16e;
  border-radius: .6rem;
  background: var(--amber-100);
  color: #684714;
  padding: .72rem .9rem;
}

.form-error {
  margin-top: 1rem;
}

.result {
  scroll-margin-top: 1rem;
}

.result-hero {
  border-top: .4rem solid var(--green-700);
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: end;
}

.metric-label {
  display: block;
  color: var(--asphalt-700);
  font-size: .82rem;
  font-weight: 700;
}

.total-score {
  display: block;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  line-height: 1;
  letter-spacing: -.05em;
}

.cutoff-score {
  display: block;
  font-size: 1.9rem;
  line-height: 1.2;
}

.range-position {
  color: var(--asphalt-700);
  font-weight: 750;
}

.screen-result,
.dx-result,
.monitor-result {
  border-radius: .65rem;
  padding: .8rem 1rem;
}

.screen-result.positive,
.dx-result.met {
  border: 1px solid #91bea2;
  background: var(--green-100);
  color: var(--green-800);
}

.screen-result.negative,
.dx-result.not-met {
  border: 1px solid var(--asphalt-250);
  background: var(--asphalt-075);
  color: var(--asphalt-700);
}

.screen-result.unavailable {
  border: 1px solid #d8b16e;
  background: var(--amber-100);
  color: #684714;
}

.table-scroll {
  overflow-x: auto;
}

.result-table,
.responses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.result-table th,
.result-table td,
.responses-table th,
.responses-table td {
  border: 1px solid var(--asphalt-250);
  padding: .55rem .65rem;
  text-align: left;
  vertical-align: top;
}

.result-table th,
.responses-table th {
  background: var(--asphalt-850);
  color: white;
}

.result-table td:not(:first-child),
.responses-table td:first-child,
.responses-table td:last-child {
  text-align: center;
}

.clinical-list {
  padding-left: 1.2rem;
}

.clinical-list li {
  margin: .35rem 0;
}

.monitor-row {
  display: flex;
  align-items: end;
  gap: .7rem;
}

.monitor-row label {
  width: min(18rem, 100%);
}

.monitor-result {
  margin-top: .9rem;
  border: 1px solid var(--asphalt-250);
  background: var(--asphalt-075);
}

.monitor-result p,
.monitor-result ul {
  margin-top: .3rem;
  margin-bottom: .3rem;
}

footer {
  margin-top: 2rem;
  border-top: 1px solid var(--asphalt-250);
  color: var(--asphalt-700);
  padding-top: 1rem;
  font-size: .82rem;
}

footer a {
  color: var(--green-700);
}

.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  z-index: 100;
  transform: translate(-50%, 1rem);
  border-radius: .55rem;
  background: var(--asphalt-950);
  color: white;
  padding: .65rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.hidden {
  display: none !important;
}

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

:focus-visible {
  outline: 3px solid #7cad90;
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .wrap {
    width: min(100% - 1rem, 980px);
    padding-top: .8rem;
  }

  .topbar {
    flex-direction: column;
  }

  .settings-grid,
  .criterion-grid,
  .check-list {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .response-options {
    grid-template-columns: 1fr;
  }

  .response-option {
    min-height: 0;
    display: grid;
    grid-template-columns: 1.2rem 1.5rem 1fr;
    justify-items: start;
    text-align: left;
  }

  .progress-panel {
    grid-template-columns: 1fr;
    gap: .4rem;
  }

  .monitor-row {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button,
  .result-actions .button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .wrap {
    width: 100%;
    padding: 0;
  }

  #assessment-form,
  .language-control,
  .notice-private,
  .notice-crisis,
  .result-actions,
  footer,
  .toast {
    display: none !important;
  }

  .notice,
  .card {
    break-inside: avoid;
    border-color: #777;
    box-shadow: none;
  }

  .result-table th,
  .responses-table th {
    background: #ddd;
    color: black;
  }
}
