:root {
  --ink: #182522;
  --muted: #68736f;
  --line: #ded8cc;
  --panel: #fffdf8;
  --page: #f7f1e8;
  --accent: #2f8da0;
  --accent-soft: #e6f7f7;
  --coral: #df735d;
  --sand: #f2c978;
  --mint: #a8cbc0;
  --warning: #df735d;
  --warning-soft: #fff0dc;
  --ok: #1f6f4d;
  --charcoal: #5f6a64;
  --shadow: 0 18px 50px rgba(24, 37, 34, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(242, 201, 120, 0.34), transparent 24%),
    radial-gradient(circle at 88% 2%, rgba(168, 203, 192, 0.36), transparent 25%),
    linear-gradient(135deg, rgba(239, 104, 68, 0.1), transparent 42%),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1480px, calc(100vw - 48px));
  margin: 28px auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(260px, 34vw);
  height: auto;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: clamp(1.7rem, 2.6vw, 3rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.schema-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(47, 141, 160, 0.26);
  background: linear-gradient(135deg, rgba(242, 201, 120, 0.32), rgba(168, 203, 192, 0.28));
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.schema-pill:hover,
.schema-pill:focus-visible {
  border-color: rgba(47, 141, 160, 0.5);
  box-shadow: 0 8px 18px rgba(47, 141, 160, 0.12);
}

.title-beta-badge {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid rgba(47, 141, 160, 0.28);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mint), var(--accent-soft));
  color: #123b36;
  box-shadow: 0 6px 14px rgba(47, 141, 160, 0.16);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.workspace.start-mode {
  grid-template-columns: 210px minmax(0, 1fr);
}

.workspace.start-mode .preview-panel {
  display: none;
}

.progress-panel,
.builder-panel,
.preview-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.progress-panel {
  padding: 18px;
  position: sticky;
  top: 18px;
}

.progress-panel ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.progress-panel li {
  color: var(--muted);
  font-size: 0.92rem;
  padding-left: 14px;
  border-left: 3px solid var(--line);
}

.progress-panel li.active {
  color: var(--ink);
  border-color: var(--accent);
  font-weight: 700;
}

.builder-panel,
.preview-panel {
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}

.preview-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.form-section {
  border-bottom: 1px solid var(--line);
  padding: 0 0 22px;
  margin-bottom: 22px;
}

.form-section:last-of-type {
  border-bottom: 0;
}

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

.section-heading span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.section-heading p,
.preview-heading p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

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

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

label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.required {
  color: #b33b2e;
  font-weight: 800;
  display: inline;
}

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.3;
}

.concept-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  background: linear-gradient(135deg, rgba(228, 241, 237, 0.95), rgba(242, 201, 120, 0.12));
  padding: 14px 16px;
  margin: 12px 0 18px;
}

.concept-card h3 {
  margin: 0 0 7px;
  font-size: 1rem;
}

.concept-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.concept-card p + p {
  margin-top: 7px;
}

.start-guide {
  display: grid;
  gap: 18px;
}

.guide-hero,
.guide-section {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: #fffefa;
}

.guide-hero {
  border-left: 6px solid var(--accent);
  background: linear-gradient(135deg, rgba(230, 247, 247, 0.84), rgba(255, 253, 248, 0.96));
}

.welcome-eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.guide-hero h2 {
  max-width: 780px;
  font-size: clamp(1.55rem, 2.4vw, 2.35rem);
  line-height: 1.08;
}

.guide-hero > p,
.guide-section-heading p {
  max-width: 820px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}

.guide-section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.guide-section-heading h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1.15rem;
}

.guide-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.guide-grid div,
.metadata-file-list div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: rgba(245, 250, 248, 0.72);
  padding: 11px 12px;
}

.guide-grid strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.guide-grid span,
.metadata-file-list span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.36;
}

.glc-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  align-items: center;
}

.glc-flow span {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid rgba(47, 141, 160, 0.26);
  background: rgba(245, 250, 248, 0.9);
  color: var(--ink);
  padding: 10px;
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
}

.glc-flow span:not(:last-child)::after {
  content: "↓";
  position: absolute;
  right: -22px;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 900;
  transform: rotate(-90deg);
}

.builder-flow-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: builder-flow;
}

.builder-flow-list li {
  counter-increment: builder-flow;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(245, 250, 248, 0.72);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.builder-flow-list li::before {
  content: counter(builder-flow);
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fffefa;
  font-size: 0.78rem;
  font-weight: 900;
}

.guide-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.package-details > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.resource-callout {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(47, 141, 160, 0.2);
  background: rgba(230, 247, 247, 0.54);
  padding: 12px 14px;
}

.resource-callout .resource-links {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.folder-tree {
  margin: 0;
  max-height: none;
  border-left: 5px solid var(--mint);
  background: #f5faf8;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
}

.metadata-file-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metadata-file-list code {
  justify-self: start;
}

.privacy-note {
  max-width: 780px;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 600;
  line-height: 1.45;
}

.start-actions {
  justify-content: flex-start;
  margin-top: 0;
}

.start-actions button {
  min-width: 150px;
}

.journey-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.journey-list div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fffefa;
}

.journey-list strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.journey-list span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.package-folder-upload {
  background: #f5faf8;
  border-color: var(--mint);
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.resource-links a {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.linked-dataset-field {
  margin: 0;
  border: 1px solid var(--line);
  background: rgba(245, 250, 248, 0.72);
  padding: 10px 12px 12px;
}

.linked-dataset-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.dataset-select-label {
  display: block;
  margin-top: 10px;
}

.selected-dataset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.selected-dataset-list li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(47, 141, 160, 0.26);
  background: #fffefa;
  color: var(--ink);
  padding: 6px 8px 6px 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.selected-dataset-list li.missing-selection {
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--warning-soft);
  color: var(--warning);
}

.selected-dataset-list li.empty-selection {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding-left: 0;
  font-weight: 600;
}

.remove-selected-dataset {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: transparent;
  color: var(--warning);
  padding: 0;
  border: 1px solid rgba(180, 83, 9, 0.24);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.remove-selected-dataset:hover,
.remove-selected-dataset:focus-visible {
  background: var(--warning-soft);
}

.checkbox-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-height: 34px;
  margin: 0;
  border: 1px solid rgba(47, 141, 160, 0.22);
  background: #fffefa;
  color: var(--ink);
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  opacity: 0.78;
}

.checkbox-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.checkbox-option.selected {
  border-color: rgba(47, 141, 160, 0.5);
  background: rgba(228, 241, 237, 0.95);
  opacity: 1;
}

.checkbox-option.missing-choice {
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--warning-soft);
  color: var(--warning);
  opacity: 1;
}

.empty-choice-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.choice-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.warning-note {
  color: var(--warning);
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--ink);
  font: inherit;
  padding: 10px 11px;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #edf0ed;
  color: #8a948f;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

.file-drop {
  display: grid;
  gap: 10px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
}

.file-drop p {
  color: var(--muted);
  font-size: 0.9rem;
}

.file-warning {
  padding: 12px 14px;
  border-left: 5px solid var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}

.file-warning::before {
  content: "Warning: ";
  font-weight: 700;
}

.file-warning[hidden] {
  display: none;
}

.file-group-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.file-groups-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  min-width: 0;
}

.file-group-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  min-width: 0;
  background: #edf2ef;
}

.file-group-chip.active {
  background: var(--accent);
}

.file-group-button {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.file-group-chip.active .file-group-button {
  color: white;
}

.remove-file-group {
  background: var(--charcoal);
  padding-inline: 10px;
  font-size: 0.78rem;
}

.remove-file-group:disabled {
  display: none;
}

.datetime-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #fffefa;
}

.datetime-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.datetime-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.validation-summary {
  padding: 10px 12px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  color: var(--muted);
  margin-bottom: 12px;
}

.validation-summary.warning {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

.validation-summary.ok {
  color: var(--ok);
}

.section-validation-panel,
.export-validation-panel {
  border: 1px solid var(--line);
  background: #fffefa;
  padding: 14px;
  margin: 0 0 16px;
}

.section-validation-panel {
  margin-top: 18px;
}

.section-validation-panel.ok,
.export-validation-panel.ok {
  border-left: 5px solid var(--ok);
  background: #edf8f0;
}

.section-validation-panel.warning,
.export-validation-panel.warning {
  border-left: 5px solid var(--warning);
  background: var(--warning-soft);
}

.section-validation-panel h3,
.export-validation-panel h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.section-validation-panel p,
.export-validation-panel p {
  margin: 0;
  color: var(--muted);
}

.section-validation-panel ul,
.export-validation-panel ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.section-validation-panel li,
.export-validation-panel li {
  margin: 5px 0;
  line-height: 1.35;
}

.section-validation-panel strong,
.export-validation-panel strong {
  color: var(--ink);
}

.variables-table {
  display: grid;
  gap: 8px;
}

.terms-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.term-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.term-header {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.variable-row {
  display: grid;
  grid-template-columns: 100px 220px 220px 120px 180px 220px 190px;
  gap: 12px;
  align-items: start;
  padding: 8px;
  background: #fffefa;
  border: 1px solid var(--line);
  min-width: 1320px;
}

.variable-header {
  background: #edf2ef;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  align-items: center;
  min-height: 52px;
}

.variable-header span {
  display: block;
  white-space: normal;
}

.variable-row strong {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.variables-table {
  overflow-x: auto;
  padding-bottom: 4px;
}

.variable-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

button {
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 600;
  padding: 11px 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-button,
.remove-term {
  background: var(--charcoal);
}

#copy-json {
  background: var(--charcoal);
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

pre {
  flex: 1;
  min-height: 320px;
  margin: 0;
  overflow: auto;
  background: #14211e;
  color: #d9fff4;
  padding: 16px;
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .progress-panel {
    position: static;
  }

  .progress-panel ol {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 24px, 1480px);
    margin: 16px auto;
  }

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

  .brand-block {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: min(230px, 72vw);
  }

  .grid,
  .glc-flow,
  .guide-grid,
  .journey-list,
  .metadata-file-list,
  .term-row,
  .progress-panel ol {
    grid-template-columns: 1fr;
  }

  .glc-flow span:not(:last-child)::after {
    bottom: -25px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

.builder-step {
  display: none;
}

.builder-step.active {
  display: block;
}

.progress-panel li {
  cursor: pointer;
}

code {
  background: #edf2ef;
  border: 1px solid var(--line);
  padding: 1px 5px;
  font-size: 0.9em;
}

.compact-heading {
  margin-top: 24px;
}

.subsection-heading {
  margin: 22px 0 12px;
}

.prominent-subsection {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-left: 5px solid var(--coral);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.98), rgba(242, 201, 120, 0.2));
}

.subsection-heading.prominent-subsection h3 {
  color: var(--ink);
  font-size: 1.08rem;
  letter-spacing: 0;
}

.subsection-heading.prominent-subsection p {
  color: var(--charcoal);
  font-weight: 600;
}

.subsection-heading h3,
.file-group-terms h3,
.record-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.subsection-heading p,
.file-group-terms p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.table-builder,
.card-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.table-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.compact-participants {
  grid-template-columns: minmax(130px, 1fr) 90px minmax(110px, 0.8fr) minmax(110px, 0.8fr) auto;
}

.characteristics-grid {
  grid-template-columns: minmax(140px, 0.9fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(90px, 0.7fr) minmax(160px, 1.2fr) auto;
}

.table-header {
  background: #edf2ef;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
  padding: 10px;
  text-transform: uppercase;
}

.table-row:not(.table-header) {
  border: 1px solid var(--line);
  background: #fffefa;
  padding: 10px;
}

.record-card {
  border: 1px solid var(--line);
  background: #fffefa;
  padding: 16px;
}

.record-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.remove-row {
  background: var(--charcoal);
  white-space: nowrap;
}

.inline-actions {
  margin-top: 18px;
}

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

.zip-download {
  grid-column: 1 / -1;
}

.export-grid button:nth-child(even) {
  background: var(--charcoal);
}

.file-group-terms {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

@media (max-width: 900px) {
  .journey-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-participants,
  .characteristics-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }
}

.study-groups-grid {
  grid-template-columns: minmax(120px, 0.9fr) minmax(170px, 1.2fr) 80px minmax(160px, 1.1fr) minmax(160px, 1.1fr) auto;
}

.generated-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(47, 141, 160, 0.25);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .study-groups-grid {
    grid-template-columns: 1fr;
  }
}

.compact-upload {
  margin-bottom: 18px;
}

.import-summary.ok {
  color: var(--ok);
  font-weight: 700;
}

.import-summary.warning {
  color: var(--warning);
  font-weight: 800;
}

#study-groups-list {
  overflow-x: auto;
}

.contributor-builder,
#contributors-list {
  display: grid;
  gap: 12px;
}

.contributor-card {
  border: 1px solid var(--line);
  background: #fffefa;
  padding: 14px;
}

.participant-card {
  border: 1px solid var(--line);
  background: #fffefa;
  padding: 14px;
}

.contributor-fields,
.participant-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.small-button {
  justify-self: start;
  padding: 8px 11px;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .contributor-fields,
  .participant-fields {
    grid-template-columns: 1fr;
  }
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.danger-button {
  background: var(--coral);
}

#clear-contributors-import,
#remove-participants-import,
#remove-characteristics-import,
#remove-devices-import,
#remove-datasheets-import,
#remove-dataset-import {
  background: transparent;
  border-color: rgba(95, 106, 100, 0.38);
  color: var(--charcoal);
}

.danger-button,
.remove-row,
.remove-file-group,
.remove-term {
  background: transparent;
  border-color: rgba(223, 115, 93, 0.5);
  color: #a95747;
}

.danger-button:hover,
.remove-row:hover,
.remove-file-group:hover,
.remove-term:hover {
  background: rgba(223, 115, 93, 0.12);
}

#clear-contributors-import:hover,
#remove-participants-import:hover,
#remove-characteristics-import:hover,
#remove-devices-import:hover,
#remove-datasheets-import:hover,
#remove-dataset-import:hover {
  background: rgba(95, 106, 100, 0.08);
}

.nested-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  overflow: visible;
}

.nested-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.nested-grid {
  display: grid;
  gap: 10px;
  align-items: start;
}

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

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

.nested-grid-header {
  display: none;
}

.nested-row {
  padding: 12px;
  border: 1px solid var(--line);
  background: #fffefa;
}

.nested-row label {
  display: block;
  margin: 0;
}

.nested-row input,
.nested-row select {
  margin-top: 5px;
  min-width: 0;
}

.nested-row .remove-row {
  justify-self: start;
}

.nested-grid-two.nested-row .remove-row,
.nested-grid-four.nested-row .remove-row {
  grid-column: 1 / -1;
}

.sr-only {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

@media (max-width: 760px) {
  .nested-grid-two,
  .nested-grid-four {
    grid-template-columns: 1fr;
  }
}

.import-file-label {
  display: inline-block;
  width: fit-content;
  padding: 6px 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(47, 141, 160, 0.25);
  color: var(--accent);
  font-weight: 600;
}

.import-file-label[hidden] {
  display: none;
}

.metadata-actions,
.schema-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.metadata-actions {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.metadata-actions button {
  background: var(--accent);
}

.primary-import-button {
  background: var(--ok);
  border-color: rgba(31, 111, 77, 0.18);
  box-shadow: 0 8px 18px rgba(31, 111, 77, 0.22);
}

.primary-import-button:hover {
  background: #185d40;
}

.schema-actions {
  margin-top: 8px;
}

.bottom-schema-actions {
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .metadata-actions,
  .schema-actions {
    justify-content: flex-start;
  }
}

.help-marker {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
  font-size: 0.64rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
}

.help-marker:focus-visible {
  outline: 3px solid rgba(47, 141, 160, 0.32);
  outline-offset: 2px;
}

.help-tooltip {
  position: absolute;
  z-index: 20;
  width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(24, 37, 34, 0.16);
  background: #fffefa;
  box-shadow: 0 14px 32px rgba(24, 37, 34, 0.18);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.help-tooltip[hidden] {
  display: none;
}
