:root {
  color-scheme: light;
  --ink: #18211f;
  --ink-soft: #52605c;
  --muted: #75827e;
  --paper: #ffffff;
  --surface-soft: #f7f9f8;
  --canvas: #f4f6f5;
  --line: #d9dfdc;
  --line-strong: #bcc8c3;
  --teal: #116b63;
  --teal-dark: #0b514b;
  --teal-soft: #e7f3f0;
  --green: #247448;
  --green-soft: #e9f5ed;
  --amber: #97600d;
  --amber-soft: #fff4d9;
  --red: #ad302b;
  --red-soft: #fcebea;
  --blue: #315b87;
  --blue-soft: #eaf1f8;
  --shadow: 0 12px 36px rgb(24 33 31 / 8%);
  --radius: 6px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

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

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(17 107 99 / 20%);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.3;
}

h3 {
  font-size: 15px;
}

.hidden {
  display: none !important;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
}

.brand {
  min-width: 0;
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--teal-dark);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.topbar-meta,
.button-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-meta {
  min-width: 0;
  flex: 0 0 auto;
  gap: 14px;
}

.button-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-dot {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot > span[aria-hidden="true"] {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.language-switcher {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-soft);
}

.language-switcher button {
  min-width: 34px;
  min-height: 28px;
  padding: 3px 8px;
  border: 0;
  border-radius: 3px;
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.language-switcher button.active {
  color: var(--teal-dark);
  background: white;
  box-shadow: 0 1px 2px rgb(19 45 49 / 12%);
}

.language-switcher button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.text-link {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

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

.enrollment-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.enrollment-heading {
  max-width: 700px;
  margin-bottom: 32px;
}

.eyebrow,
.section-kicker {
  margin-bottom: 7px;
  color: var(--teal-dark);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow {
  letter-spacing: 0.08em;
}

.section-kicker {
  letter-spacing: 0.06em;
}

.lede {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.enrollment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 32px;
  align-items: start;
}

.enrollment-grid > * {
  min-width: 0;
}

.enrollment-grid .form-panel {
  padding: 32px;
}

.invitation-notice {
  display: grid;
  gap: 3px;
  margin: -6px 0 24px;
  padding: 13px 15px;
  border-left: 3px solid var(--teal);
  color: var(--ink-soft);
  background: var(--teal-soft);
  font-size: 13px;
}

.invitation-notice strong {
  color: var(--teal-dark);
}

.form-panel,
.author-form,
.preview-pane,
.case-detail {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.section-title-row,
.section-heading,
.page-heading,
.preview-header,
.context-heading,
.step-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.section-title-row {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.section-title-row h2,
.section-heading h2,
.preview-header h2 {
  margin-bottom: 0;
}

.required-note {
  color: var(--muted);
  font-size: 12px;
}

.field-grid {
  display: grid;
  gap: 20px;
}

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

.full-width {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.field small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: white;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 78px;
  padding: 10px 12px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #929d99;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #92a29c;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  outline: 3px solid rgb(17 107 99 / 10%);
}

select[multiple] {
  min-height: 112px;
  padding: 6px;
}

.consent-block {
  display: grid;
  gap: 13px;
  margin-top: 26px;
  padding: 18px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 520;
  cursor: pointer;
}

.check-row input {
  flex: 0 0 auto;
  width: 17px;
  min-height: 17px;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

.form-actions {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  margin-top: 26px;
}

.form-error {
  min-height: 20px;
  flex: 1;
  margin: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button.primary {
  color: white;
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.button.primary:hover:not(:disabled) {
  background: #073f3b;
}

.button.secondary {
  color: var(--ink);
  border-color: var(--line-strong);
  background: white;
}

.button.secondary:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.button.quiet {
  color: var(--ink-soft);
  border-color: transparent;
  background: transparent;
}

.button.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.full-button {
  width: 100%;
}

.study-notice {
  padding: 27px 28px 28px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 10px 30px rgb(24 33 31 / 6%);
  overflow-wrap: break-word;
}

.study-notice h2 {
  margin-bottom: 18px;
}

.study-intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.task-statement {
  margin: 18px 0 0;
  padding: 15px 17px;
  border-left: 3px solid var(--teal);
  color: var(--ink-soft);
  background: var(--teal-soft);
  font-size: 13px;
  line-height: 1.6;
}

.task-heading {
  margin: 25px 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.task-list {
  margin: 0;
  padding-left: 23px;
  color: var(--ink-soft);
  font-size: 13px;
}

.task-list li {
  padding-left: 4px;
  margin-bottom: 10px;
}

.task-list li:last-child {
  margin-bottom: 0;
}

.study-flow {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.notice-list {
  margin: 0;
}

.notice-list > div {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.notice-list dt {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.notice-list dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.safety-notice {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid #e8d29f;
  border-radius: 5px;
  color: #68470e;
  background: var(--amber-soft);
  font-size: 12px;
}

.study-shell {
  min-height: calc(100vh - 64px);
}

.study-progress-band {
  position: sticky;
  top: 64px;
  z-index: 40;
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(180px, 430px) 64px;
  align-items: center;
  gap: 26px;
  padding: 10px 32px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.progress-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.progress-copy .eyebrow {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9e7;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--teal);
  transition: width 180ms ease;
}

.progress-count {
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.workflow-roadmap {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(420px, 760px) minmax(64px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 9px 32px;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.trial-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.workflow-roadmap ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-roadmap li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.workflow-roadmap li:not(:last-child)::after {
  height: 1px;
  flex: 1;
  margin: 0 10px;
  content: "";
  background: var(--line-strong);
}

.workflow-roadmap li > span {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: white;
  font-size: 10px;
}

.workflow-roadmap li.active {
  color: var(--teal-dark);
}

.workflow-roadmap li.active > span,
.workflow-roadmap li.complete > span {
  border-color: var(--teal);
  color: white;
  background: var(--teal);
}

.workflow-roadmap li.complete::after {
  background: var(--teal);
}

.review-layout {
  max-width: 1480px;
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.55fr);
  gap: 0;
  margin: 0 auto;
}

.case-context {
  position: sticky;
  top: 126px;
  max-height: calc(100vh - 126px);
  align-self: start;
  overflow: auto;
  padding: 34px 30px 60px;
  border-right: 1px solid var(--line);
}

.case-context h1 {
  margin-bottom: 28px;
  font-size: 22px;
}

.source-badge,
.variant-label,
.status-chip,
.step-type {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 750;
}

.source-badge {
  padding: 3px 7px;
  color: var(--blue);
  background: var(--blue-soft);
}

.context-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.context-section h2 {
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
}

.clinical-text {
  margin: 0;
  color: #2f3c38;
  font-family: Charter, Georgia, serif;
  font-size: 14px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.question-block {
  padding: 18px;
  border: 1px solid #cbdce8;
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.question-block h2 {
  color: var(--blue);
}

.reference-diagnosis-block {
  padding: 18px;
  border: 1px solid #c9e1d0;
  border-radius: var(--radius);
  background: var(--green-soft);
}

.reference-diagnosis-block h2 {
  color: var(--green);
}

.reference-diagnosis-block {
  margin-top: 0;
}

.global-reference-help {
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.available-information-rule {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.provenance-note {
  margin-top: 20px;
  color: var(--muted);
  font-size: 11px;
}

.available-information ol {
  display: grid;
  gap: 16px;
  margin: 0;
  padding-left: 22px;
}

.available-information li {
  padding-left: 3px;
  color: var(--ink-soft);
  font-size: 12px;
}

.available-information strong {
  color: var(--ink);
}

.available-information p,
.available-empty {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-family: Charter, Georgia, serif;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.available-information-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.step-workspace {
  min-width: 0;
  padding: 42px clamp(30px, 5vw, 74px) 80px;
  background: white;
}

.step-heading {
  margin-bottom: 24px;
}

.step-heading h2 {
  margin: 8px 0 0;
  font-size: 23px;
}

.step-labels {
  max-width: 260px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.step-type {
  padding: 3px 7px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  text-transform: uppercase;
}

.variant-label {
  max-width: 210px;
  padding: 5px 8px;
  overflow: hidden;
  color: var(--ink-soft);
  background: var(--canvas);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trajectory-step {
  margin-bottom: 32px;
  padding: 24px;
  border-left: 4px solid var(--teal);
  background: #f8faf9;
}

.stage-instruction {
  margin: -6px 0 28px;
  padding: 15px 17px;
  border-left: 3px solid var(--blue);
  color: var(--ink-soft);
  background: var(--blue-soft);
  font-size: 13px;
}

.step-stage-instruction {
  margin-top: 0;
}

.overview-trajectory {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0 0 38px;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.chain-editor-section {
  min-width: 0;
}

.chain-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.chain-editor-heading h3 {
  margin: 3px 0 0;
  font-size: 18px;
}

.chain-editor-help {
  max-width: 820px;
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 13px;
}

.chain-legend,
.overview-step-metadata {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.chain-legend {
  justify-content: flex-end;
}

.chain-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.25;
}

.chain-chip.provided {
  border-color: var(--line);
  color: var(--ink-soft);
  background: var(--canvas);
}

.chain-chip.revised {
  border-color: #e1c57e;
  color: var(--amber);
  background: var(--amber-soft);
}

.chain-chip.inserted {
  border-color: #afc9df;
  color: var(--blue);
  background: var(--blue-soft);
}

.overview-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.overview-position {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 11px;
  font-weight: 800;
}

.overview-step-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.overview-step-heading h3 {
  margin: 3px 0 7px;
  font-size: 15px;
}

.overview-step-heading span {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
}

.overview-step-content {
  margin: 0 0 9px;
  color: var(--ink);
  font-family: Charter, Georgia, serif;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.overview-step-rationale {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.overview-department {
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
}

.overview-step.is-revised {
  margin-right: -12px;
  margin-left: -12px;
  padding-right: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--amber);
  background: #fffcf5;
}

.chain-operation-button {
  margin-top: 14px;
}

.chain-operation-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #e1c57e;
  border-radius: var(--radius);
  background: #fffcf5;
}

.chain-operation-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.chain-operation-heading .button {
  margin-left: auto;
}

.chain-insertion-slot {
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.chain-insertions {
  display: grid;
  gap: 10px;
}

.chain-insertions:not(:empty) {
  margin-bottom: 9px;
}

.insert-step-button {
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px dashed #9db9b4;
  border-radius: 4px;
  color: var(--teal-dark);
  background: #f8fbfa;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.insert-step-button:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.insert-step-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.inserted-step-editor {
  margin-top: 0;
  border-color: #afc9df;
  background: #f7fafd;
}

.overview-form {
  padding-top: 30px;
  border-top: 3px solid var(--teal-dark);
}

.step-content {
  margin-bottom: 13px;
  color: var(--ink);
  font-family: Charter, Georgia, serif;
  font-size: 17px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.step-rationale {
  margin: 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.review-form {
  display: grid;
  gap: 25px;
}

.field-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group legend {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.segmented {
  display: grid;
  gap: 0;
}

.segmented.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented.five {
  width: min(100%, 310px);
  grid-template-columns: repeat(5, minmax(42px, 1fr));
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
}

.segmented span {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: white;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.segmented label + label span {
  border-left: 0;
}

.segmented label:first-child span {
  border-radius: 5px 0 0 5px;
}

.segmented label:last-child span {
  border-radius: 0 5px 5px 0;
}

.segmented input:checked + span {
  z-index: 1;
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.segmented input[value="unsafe"]:checked + span {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1px var(--red);
}

.segmented input[value="source_missing"]:checked + span {
  border-color: #b87d17;
  color: #68470e;
  background: var(--amber-soft);
  box-shadow: inset 0 0 0 1px #b87d17;
}

.segmented input:focus-visible + span {
  outline: 3px solid rgb(17 107 99 / 20%);
  outline-offset: 2px;
}

.review-fields {
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.evidence-provenance-group {
  margin-bottom: 22px;
}

.evidence-rule {
  max-width: 820px;
  margin: -2px 0 14px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

#evidence-source-note-field {
  margin-bottom: 26px;
}

.field-help {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.multi-picker {
  position: relative;
  width: 100%;
}

.multi-picker summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 38px 0 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: white;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.multi-picker summary::-webkit-details-marker {
  display: none;
}

.multi-picker summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-picker summary::after {
  position: absolute;
  right: 14px;
  width: 8px;
  height: 8px;
  transform: translateY(-2px) rotate(45deg);
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  content: "";
}

.multi-picker[open] summary {
  border-color: var(--teal);
  outline: 3px solid rgb(17 107 99 / 10%);
}

.multi-picker[open] summary::after {
  transform: translateY(2px) rotate(225deg);
}

.multi-picker fieldset {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 250px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 5px 0 0;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: white;
  box-shadow: var(--shadow);
}

.multi-picker-option {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
}

.multi-picker-option:hover {
  background: var(--canvas);
}

.multi-picker-option input {
  width: 15px;
  min-height: 15px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--teal);
}

.multi-picker-option input:disabled + span {
  color: #a8b0ad;
}

.compact-group {
  max-width: 420px;
}

.safety-check {
  width: fit-content;
  color: var(--red);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 0 -12px -26px;
  padding: 14px 12px 26px;
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 95%);
  backdrop-filter: blur(8px);
}

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

.review-summary {
  margin-bottom: 30px;
  border-top: 1px solid var(--line);
}

.summary-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.summary-position {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.summary-step h3 {
  margin: 0 0 4px;
}

.summary-step .chain-chip {
  margin-bottom: 5px;
}

.summary-step p {
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evaluation-chip {
  align-self: start;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 750;
}

.evaluation-chip.sufficient {
  color: var(--green);
  background: var(--green-soft);
}

.evaluation-chip.needs_revision {
  color: var(--amber);
  background: var(--amber-soft);
}

.evaluation-chip.unsafe {
  color: var(--red);
  background: var(--red-soft);
}

.completion-panel,
.empty-state {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 60px clamp(30px, 7vw, 100px);
  background: white;
}

.completion-panel p:not(.section-kicker),
.empty-state p:not(.section-kicker) {
  max-width: 460px;
  color: var(--ink-soft);
}

.completion-panel .button {
  margin-top: 10px;
}

.completion-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 22px;
}

.empty-state {
  max-width: 900px;
  min-height: calc(100vh - 126px);
  margin: 0 auto;
  background: transparent;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(380px, calc(100vw - 48px));
  padding: 12px 16px;
  transform: translateY(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  opacity: 0;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.admin-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}

.admin-topbar .topbar-meta {
  justify-self: end;
}

.admin-nav {
  display: flex;
  align-self: stretch;
}

.nav-tab {
  position: relative;
  min-width: 94px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.nav-tab::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  content: "";
  background: transparent;
}

.nav-tab.active {
  color: var(--teal-dark);
}

.nav-tab.active::after {
  background: var(--teal);
}

.admin-main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 42px 32px 80px;
}

.protocol-notice {
  max-width: 760px;
  margin: 8vh auto 0;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.protocol-notice > p:not(.eyebrow) {
  max-width: 640px;
  color: var(--ink-soft);
}

.protocol-steps {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding: 20px;
  border-radius: 5px;
  background: var(--teal-soft);
}

.protocol-steps p {
  margin: 0;
  color: var(--ink-soft);
}

.protocol-steps code {
  padding: 2px 5px;
  border: 1px solid #c7ddd8;
  border-radius: 3px;
  color: var(--teal-dark);
  background: white;
  font-size: 13px;
}

.file-mode .admin-nav,
.file-mode .topbar-meta {
  display: none;
}

.file-mode .admin-topbar {
  grid-template-columns: 1fr;
}

.page-heading {
  align-items: center;
  margin-bottom: 32px;
}

.page-heading h1 {
  margin-bottom: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.recruitment-section {
  margin-bottom: 42px;
}

.study-settings {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 32px;
  margin-bottom: 42px;
  padding: 22px 24px;
  border-top: 2px solid var(--teal);
  border-bottom: 1px solid var(--line);
  background: white;
}

.study-settings h2 {
  margin-bottom: 4px;
}

.study-settings p:not(.section-kicker) {
  max-width: 680px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.study-settings form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.study-settings .field {
  min-width: 150px;
}

.recruitment-section .section-heading {
  margin-top: 0;
}

.section-note {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.stat-item {
  min-height: 112px;
  padding: 21px;
  background: white;
}

.stat-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-item strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.section-heading {
  align-items: center;
  margin: 30px 0 15px;
}

.section-heading.compact {
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #f8faf9;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: var(--ink);
  font-weight: 650;
}

tbody tr:hover td {
  background: #fbfcfc;
}

.table-action {
  border: 0;
  color: var(--teal-dark);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.status-chip {
  min-height: 24px;
  padding: 3px 8px;
  white-space: nowrap;
}

.status-chip.active,
.status-chip.submitted {
  color: var(--green);
  background: var(--green-soft);
}

.status-chip.draft,
.status-chip.neutral,
.status-chip.in_progress {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-chip.closed {
  color: var(--muted);
  background: #ecefed;
}

.status-chip.used {
  color: var(--muted);
  background: #ecefed;
}

.case-detail {
  margin-top: 20px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.detail-header p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--ink-soft);
}

.variant-control-list {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.variant-control {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(220px, 2fr) auto;
  gap: 24px;
  align-items: center;
  padding: 16px;
  background: white;
}

.variant-control h3,
.variant-control p {
  margin: 0;
}

.variant-control p {
  color: var(--ink-soft);
  font-size: 12px;
}

.variant-status-control {
  min-width: 122px;
}

.author-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(460px, 1.05fr);
  gap: 24px;
  align-items: start;
}

.author-form,
.preview-pane {
  padding: 26px;
}

.author-confirmations {
  margin-top: 22px;
}

.split-actions {
  justify-content: space-between;
}

.split-actions > div {
  display: flex;
  gap: 10px;
}

.preview-pane {
  position: sticky;
  top: 88px;
  min-height: min(680px, calc(100vh - 112px));
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.preview-header {
  align-items: center;
  margin-bottom: 18px;
}

.tab-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 0 -26px;
  padding: 0 26px 14px;
  border-bottom: 1px solid var(--line);
}

.variant-tab {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-soft);
  background: white;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.variant-tab.active {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.variant-preview {
  padding-top: 20px;
}

.empty-preview {
  min-height: 480px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.preview-description {
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 12px;
}

.preview-steps {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-step {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfcfc;
}

.preview-step:not(:last-child)::after {
  position: absolute;
  top: 100%;
  left: 27px;
  width: 2px;
  height: 13px;
  content: "";
  background: #bad9d3;
}

.preview-position {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 11px;
  font-weight: 800;
  z-index: 1;
}

.preview-step h3 {
  margin: 0 0 4px;
}

.preview-step p {
  margin: 0;
  color: var(--ink-soft);
  font-family: Charter, Georgia, serif;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.preview-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 9px;
  font-size: 10px;
  font-weight: 750;
  text-transform: capitalize;
}

.preview-step-type {
  color: var(--muted);
}

.preview-department {
  color: var(--blue);
}

.key-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgb(0 0 0 / 22%);
}

.key-dialog::backdrop {
  background: rgb(18 27 25 / 62%);
  backdrop-filter: blur(3px);
}

.key-dialog form {
  padding: 30px;
}

.key-dialog h1 {
  margin-bottom: 24px;
  font-size: 23px;
}

.key-dialog .form-error {
  margin: 10px 0;
}

.recruit-dialog {
  width: min(560px, calc(100vw - 32px));
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading h1 {
  margin-bottom: 16px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  background: white;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.dialog-copy {
  margin-bottom: 22px;
  color: var(--ink-soft);
}

.invite-success {
  margin-bottom: 20px;
  padding: 15px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
}

.invite-success p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

#invite-link {
  min-height: 82px;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.dialog-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 980px) {
  .enrollment-grid,
  .author-layout,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .study-notice {
    order: -1;
  }

  .workflow-roadmap {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .case-context {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-pane {
    position: static;
    min-height: 0;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .admin-topbar {
    grid-template-columns: auto 1fr;
  }

  .admin-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-height: 48px;
    justify-content: center;
    border-top: 1px solid var(--line);
  }

  .admin-topbar .topbar-meta {
    grid-column: 2;
    grid-row: 1;
  }

  .admin-topbar {
    padding-top: 10px;
  }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 58px;
    padding: 0 16px;
  }

  .topbar-meta .status-dot,
  .topbar-meta .text-link {
    display: none;
  }

  .enrollment-shell,
  .admin-main {
    padding: 36px 16px 60px;
  }

  .enrollment-heading {
    margin-bottom: 28px;
  }

  h1 {
    font-size: 25px;
  }

  .form-panel,
  .author-form,
  .preview-pane,
  .case-detail {
    padding: 20px;
  }

  .enrollment-grid .form-panel {
    padding: 20px;
  }

  .study-notice {
    padding: 22px 20px;
  }

  .tab-strip {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .variant-tab {
    width: 100%;
    white-space: normal;
    text-align: left;
  }

  .two-columns,
  .rating-row {
    grid-template-columns: 1fr;
  }

  .study-progress-band {
    top: 58px;
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 12px;
    padding: 9px 16px;
  }

  .workflow-roadmap {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 9px 16px 11px;
  }

  .workflow-roadmap ol {
    width: 100%;
  }

  .workflow-roadmap li {
    min-width: 0;
    gap: 4px;
    font-size: 9px;
    white-space: normal;
  }

  .workflow-roadmap li:not(:last-child)::after {
    margin: 0 5px;
  }

  .workflow-roadmap li > span {
    width: 20px;
    height: 20px;
  }

  .progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .case-context {
    padding: 26px 18px 34px;
  }

  .step-workspace {
    padding: 30px 18px 70px;
  }

  .step-heading {
    flex-direction: column;
    gap: 10px;
  }

  .step-labels {
    max-width: 100%;
    justify-content: flex-start;
  }

  .overview-step-heading {
    flex-direction: column;
    gap: 6px;
  }

  .chain-editor-heading {
    flex-direction: column;
  }

  .chain-legend {
    justify-content: flex-start;
  }

  .chain-operation-heading .button {
    width: 100%;
    margin-left: 0;
  }

  .overview-step.is-revised {
    margin-right: 0;
    margin-left: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .multi-picker fieldset {
    grid-template-columns: 1fr;
  }

  .trajectory-step {
    padding: 18px;
  }

  .step-content {
    font-size: 16px;
  }

  .segmented.three {
    grid-template-columns: 1fr;
  }

  .segmented.three label + label span {
    border-top: 0;
    border-left: 1px solid var(--line-strong);
  }

  .segmented.three label:first-child span {
    border-radius: 5px 5px 0 0;
  }

  .segmented.three label:last-child span {
    border-radius: 0 0 5px 5px;
  }

  .form-actions,
  .split-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button,
  .split-actions > div,
  .split-actions > div .button {
    width: 100%;
  }

  .split-actions > div {
    display: grid;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-settings {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .study-settings form {
    align-items: stretch;
    flex-direction: column;
  }

  .stat-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .stat-item {
    min-height: 96px;
    padding: 16px;
  }

  .page-heading,
  .section-heading:not(.compact) {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading .button-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-note {
    max-width: none;
    text-align: left;
  }

  .dialog-actions {
    display: grid;
  }

  .variant-control {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .completion-panel,
  .empty-state {
    min-height: 460px;
    padding: 40px 22px;
  }
}

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