:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d8dee8;
  --surface: #ffffff;
  --surface-alt: #f5f7fa;
  --accent: #0f766e;
  --accent-strong: #115e59;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface-alt);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
}

.site-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
}

.site-header nav {
  display: flex;
  gap: 16px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.brand {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.page {
  margin: 0 auto;
  max-width: 1380px;
  padding: 32px clamp(16px, 4vw, 48px) 56px;
}

.library-header {
  align-items: end;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
  margin-bottom: 24px;
}

.timeline-header {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.view-switcher {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  padding: 3px;
}

.view-switcher a {
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 7px 12px;
  text-decoration: none;
}

.view-switcher a.active {
  background: var(--accent);
  color: white;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.search label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.search div {
  display: flex;
  gap: 8px;
}

.search input {
  border: 1px solid var(--line);
  border-radius: 6px;
  flex: 1;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
}

.search button {
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 10px 16px;
}

.messages {
  margin-bottom: 16px;
}

.message {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  margin: 0;
  padding: 10px 14px;
}

.message-error {
  border-left-color: #b42318;
}

.trial-list {
  display: grid;
  gap: 12px;
}

.trial-row,
.empty-state,
.detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trial-row {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  padding: 18px;
}

.trial-row h2 {
  font-size: 1.05rem;
}

.trial-row h2 a {
  color: var(--ink);
  text-decoration: none;
}

.citation {
  color: var(--muted);
  margin: 8px 0 0;
}

dl {
  margin: 0;
}

.trial-row dl,
.evidence-grid {
  display: grid;
  gap: 12px;
}

.trial-row dl {
  grid-template-columns: 1fr 2fr;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.detail {
  padding: clamp(20px, 4vw, 40px);
}

.detail h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin-top: 14px;
}

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

.detail h2 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.back-link {
  font-weight: 700;
}

.evidence-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 28px;
}

.outcome-group {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.outcome-definition-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.outcome-definition-row + .outcome-definition-row {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}

.outcome-add-button,
.primary-button,
.secondary-button {
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.outcome-add-button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-size: 0.78rem;
  padding: 5px 8px;
}

.outcome-dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgb(24 33 47 / 24%);
  color: var(--ink);
  max-height: min(760px, calc(100vh - 32px));
  max-width: min(760px, calc(100vw - 32px));
  padding: 0;
  width: 100%;
}

.outcome-dialog::backdrop {
  background: rgb(24 33 47 / 55%);
}

.outcome-dialog form > header,
.outcome-dialog form > footer {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 20px;
}

.outcome-dialog form > header {
  border-bottom: 1px solid var(--line);
}

.outcome-dialog form > header h2 {
  font-size: 1.15rem;
}

.outcome-dialog form > header p:last-child {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

.outcome-dialog form > footer {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.dialog-close {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.7rem;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.outcome-form-arms {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding: 20px;
}

.outcome-form-arms fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 14px;
}

.outcome-form-arms legend {
  font-weight: 700;
  padding: 0 5px;
}

.outcome-form-arms legend span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: 5px;
}

.outcome-form-arms label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.outcome-form-arms input {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: block;
  font: inherit;
  margin-top: 5px;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.primary-button,
.secondary-button {
  padding: 9px 14px;
}

.primary-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
}

a.primary-button,
a.secondary-button {
  display: inline-flex;
  text-decoration: none;
}

.header-action {
  margin-top: 16px;
}

.rct-editor {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1080px;
}

.editor-header,
.editor-actions {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.editor-header .eyebrow {
  margin-top: 18px;
}

.editor-header h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.editor-intro,
.section-heading p {
  color: var(--muted);
  margin: 5px 0 0;
}

.editor-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(18px, 3vw, 28px);
}

.section-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.section-heading > span {
  align-items: center;
  background: #e7f4f2;
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  flex: 0 0 30px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
}

.section-heading h2 {
  font-size: 1.2rem;
}

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

.form-field.field-wide {
  grid-column: 1 / -1;
}

.form-field label {
  color: var(--ink);
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-field input:not([type="checkbox"]),
.form-field select,
.form-field textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

.form-field select[multiple] {
  min-height: 120px;
}

.form-field textarea {
  min-height: 76px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
  outline: none;
}

.form-field small {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  margin-top: 5px;
}

.field-error {
  color: #b42318;
  font-size: 0.8rem;
  margin: 5px 0 0;
}

.has-error input,
.has-error select,
.has-error textarea {
  border-color: #b42318;
}

.form-alert {
  background: #fff4f2;
  border: 1px solid #f5b7ae;
  border-radius: 6px;
  color: #8f1d14;
  padding: 10px 12px;
}

.form-alert ul {
  margin: 0;
  padding-left: 20px;
}

.arm-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.arm-card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 18px;
}

.arm-card-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.arm-card-heading h3 {
  margin: 0;
}

.remove-arm {
  background: transparent;
  border: 0;
  color: #b42318;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.delete-field {
  display: none;
}

.add-arm-button {
  margin-top: 14px;
}

.editor-actions {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  padding-top: 18px;
}

.secondary-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.outcome-group:last-child {
  border-bottom: 0;
}

.outcome-heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.outcome-heading h3 {
  font-size: 1rem;
  margin: 0;
}

.outcome-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.outcome-table {
  border-collapse: collapse;
  min-width: 520px;
  width: 100%;
}

.outcome-table-wrap {
  overflow-x: auto;
}

.outcome-table th,
.outcome-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
}

.outcome-table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.outcome-effect {
  margin: 12px 0 0;
}

.outcome-effect-muted {
  color: var(--muted);
}

.links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.links span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.flag-icon {
  border: 1px solid var(--line);
  height: 18px;
  object-fit: cover;
  width: 27px;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.timeline-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 320px;
  padding: 18px;
}

.timeline-controls {
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) 100px 100px;
}

.timeline-controls label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.timeline-controls input,
.timeline-controls select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: block;
  font: inherit;
  margin-top: 5px;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.timeline-summary {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-weight: 700;
  gap: 8px;
  grid-column: 1 / -1;
}

.timeline-summary [data-timeline-count] {
  color: var(--ink);
  font-size: 1.35rem;
}

.timeline-size-key {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}

.size-dot {
  background: var(--accent);
  border: 2px solid var(--accent-strong);
  border-radius: 999px;
  display: inline-block;
}

.size-dot.small {
  height: 14px;
  width: 14px;
}

.size-dot.large {
  height: 34px;
  width: 34px;
}

.timeline-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 340px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 18px 18px 24px;
}

.timeline-axis {
  border-bottom: 2px solid var(--line);
  height: 38px;
  min-width: 100%;
  position: relative;
}

.timeline-axis span {
  border-left: 1px solid var(--line);
  bottom: -7px;
  color: var(--muted);
  font-size: 0.72rem;
  height: 12px;
  padding-left: 4px;
  position: absolute;
}

.timeline-axis span.major {
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
  height: 20px;
}

.timeline-points {
  height: 260px;
  min-width: 100%;
  position: relative;
}

.timeline-point {
  align-items: center;
  background: rgba(7, 89, 79, 0.319);
  border: 0.5px solid var(--accent-strong);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
  color: transparent;
  cursor: pointer;
  display: flex;
  justify-content: center;
  position: absolute;
  transform: translateX(-50%);
}

.timeline-point:hover,
.timeline-point:focus,
.timeline-point.selected {
  background: #f59e0b;
  border-color: #92400e;
  outline: none;
  z-index: 2;
}

.timeline-point span {
  
  border-radius: 4px;
  
  color:black;
  font-size: 0.62rem;
  font-weight: 700;
  left: 50%;
  max-width: 160px;
  overflow: hidden;
  padding: 4px 6px;
  position: absolute;
  text-overflow: ellipsis;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  display:block;
}

.timeline-point:hover span,
.timeline-point:focus span,
.timeline-point.selected span {
  background: var(--ink);
  color: white;
}

.timeline-detail {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.timeline-detail h2 {
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.timeline-detail dl {
  display: grid;
  gap: 12px;
}

.timeline-detail a {
  background: var(--accent);
  border-radius: 6px;
  color: white;
  display: inline-flex;
  font-weight: 700;
  margin-top: 18px;
  padding: 10px 14px;
  text-decoration: none;
}

  .flag-large {
    height: 50px;width:50px;border-radius: 50%; background-color: darkblue;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;    
    object-fit: cover;
    
    > span {
      color:white;font-size: 25px; font-weight: 550;
    }
  }
  .flag-large.larger {height: 80px;width:80px;}

@media (max-width: 760px) {
  .site-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding-block: 12px;
  }

  .site-header nav {
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .site-header nav a {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 11px 2px;
  }

  .page {
    padding-block: 20px 40px;
  }

  .library-header,
  .timeline-header,
  .trial-row,
  .trial-row dl,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .timeline-header {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-shell {
    grid-template-columns: 1fr;
  }

  .timeline-controls {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-controls label:first-child {
    grid-column: 1 / -1;
  }

  .timeline-size-key {
    margin-left: 0;
  }

  .search div {
    flex-direction: column;
  }

  .outcome-form-arms fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-header {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-header > .primary-button {
    align-self: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-field.field-wide {
    grid-column: auto;
  }
}

@media (max-width: 380px) {
  .site-header nav {
    gap: 4px;
    justify-content: space-between;
  }

  .site-header nav a {
    font-size: 0.78rem;
    padding-inline: 0;
  }
}
