:root {
  color-scheme: light;
  --bg: #f4efe6;
  --panel: rgba(255, 252, 247, 0.95);
  --text: #1d2630;
  --muted: #5d6876;
  --line: rgba(46, 62, 82, 0.14);
  --line-strong: rgba(46, 62, 82, 0.2);
  --primary: #0f5d55;
  --primary-strong: #0a4943;
  --complete-bg: #e4f6ec;
  --complete-text: #216b46;
  --started-bg: #fff0d9;
  --started-text: #9a5a14;
  --not-started-bg: #edf2f8;
  --not-started-text: #4a5f79;
  --error: #8c2f2f;
  --shadow: 0 16px 36px rgba(78, 62, 38, 0.12);
  --shadow-soft: 0 8px 18px rgba(78, 62, 38, 0.08);
  --theme-chief: #203f82;
  --theme-chief-soft: rgba(32, 63, 130, 0.12);
  --theme-chief-line: rgba(32, 63, 130, 0.28);
  --theme-teal: #0f766e;
  --theme-teal-soft: rgba(15, 118, 110, 0.13);
  --theme-teal-line: rgba(15, 118, 110, 0.26);
  --theme-amber: #b35c2e;
  --theme-amber-soft: rgba(179, 92, 46, 0.14);
  --theme-amber-line: rgba(179, 92, 46, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(179, 92, 46, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 93, 85, 0.14), transparent 25%),
    linear-gradient(180deg, #fbf7ef 0%, var(--bg) 40%, #f1ebdf 100%);
}

body.tutorial-tour-open {
  overscroll-behavior: contain;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1600px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 26px 30px 30px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(14, 36, 56, 0.93), rgba(23, 53, 49, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent);
  box-shadow: var(--shadow);
  color: #f7f3ea;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 219, 186, 0.92);
}

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

h1 {
  margin-top: 10px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(2.1rem, 3.8vw, 3.2rem);
  line-height: 1;
}

h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(1.5rem, 2.3vw, 2rem);
  line-height: 1.08;
}

h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.06rem;
  line-height: 1.28;
}

.session-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.session-identity {
  color: #f7f3ea;
  font-size: 0.92rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
}

.auth-panel {
  display: grid;
  place-items: center;
  min-height: 58vh;
}

.auth-card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(252, 248, 241, 0.98));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-soft);
}

.auth-card h2 {
  margin-bottom: 16px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-field,
.form-label {
  display: grid;
  gap: 7px;
  font-size: 0.94rem;
}

.auth-field input,
.form-label textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--text);
  background: #fff;
}

.auth-field input:focus,
.form-label textarea:focus {
  outline: 2px solid rgba(15, 93, 85, 0.2);
  border-color: var(--primary);
}

.form-label textarea {
  min-height: 124px;
  resize: vertical;
}

.primary-button,
.secondary-button,
.inline-save-button {
  border: none;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
}

.primary-button,
.inline-save-button {
  background: var(--primary);
  color: #fff;
}

.primary-button:hover,
.inline-save-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: #f2ece1;
  color: #344a67;
}

.secondary-button:hover {
  background: #ece3d4;
}

.primary-button:disabled,
.secondary-button:disabled,
.inline-save-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.workspace {
  display: grid;
  gap: 16px;
}

.workspace-screen {
  display: grid;
  gap: 16px;
}

.view-panel,
.detail-summary-card,
.data-card,
.review-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.view-panel {
  padding: 18px;
}

.workspace-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.progress-label {
  font-size: 1.06rem;
  font-weight: 700;
}

.summary-note,
.muted-copy,
.status-text,
.inline-save-status,
.card-meta,
.task-guidance-copy,
.topic-status-text,
.task-tab-meta,
.task-tab-code {
  color: var(--muted);
}

.summary-note,
.status-text,
.inline-save-status,
.card-meta,
.muted-copy,
.task-tab-meta,
.task-tab-code,
.topic-status-text {
  font-size: 0.92rem;
  line-height: 1.45;
}

.status-text {
  min-height: 1.2em;
}

.status-text.error,
.inline-save-status.error {
  color: var(--error);
}

.panel-label,
.block-label,
.metric-label,
.fact-item dt,
.task-tab-code {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.panel-label,
.block-label,
.metric-label,
.fact-item dt {
  font-size: 0.76rem;
  color: var(--muted);
}

.panel-intro,
.section-heading,
.detail-summary-head,
.review-heading,
.overview-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tasks-panel .panel-intro {
  margin-bottom: 6px;
}

#topic-list-status {
  margin-top: 4px;
  margin-bottom: 8px;
}

.overview-copy {
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.7;
  max-width: 92ch;
  color: var(--muted);
}

.task-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 14px;
}

.task-guidance-copy {
  margin: -2px 0 10px;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 96ch;
}

.task-tab {
  --task-accent: var(--theme-chief);
  --task-soft: var(--theme-chief-soft);
  --task-line: var(--theme-chief-line);
  border: 1px solid var(--task-line);
  border-radius: 18px;
  padding: 14px 15px;
  text-align: left;
  background: linear-gradient(180deg, #fff 0%, var(--task-soft) 100%);
  display: grid;
  gap: 8px;
}

.task-tab.active {
  box-shadow: inset 0 0 0 2px var(--task-accent), 0 14px 32px rgba(12, 30, 68, 0.1);
}

.task-tab-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  justify-content: flex-start;
}

.task-tab-title {
  font-size: 0.98rem;
  color: var(--text);
}

.tab-completion {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tab-completion-complete {
  background: var(--complete-bg);
  color: var(--complete-text);
}

.tab-completion-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--task-accent) 68%, #fff 32%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--task-soft) 70%, #fff 30%);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.topic-list {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.topic-open-button {
  --task-accent: var(--theme-chief);
  --task-soft: var(--theme-chief-soft);
  --task-line: var(--theme-chief-line);
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  border: 1px solid var(--task-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--task-soft) 46%, #fff 54%) 100%);
  padding: 16px;
}

.topic-open-button:hover {
  box-shadow: 0 14px 32px rgba(12, 30, 68, 0.1);
  border-color: color-mix(in srgb, var(--task-accent) 30%, var(--task-line) 70%);
}

.topic-open-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.topic-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topic-open-main h3 {
  font-size: 1.05rem;
}

.topic-open-side {
  display: grid;
  place-items: center;
  min-width: 48px;
}

.topic-indicator {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  font-weight: 700;
}

.topic-indicator-complete {
  background: var(--complete-bg);
  color: var(--complete-text);
}

.topic-indicator-pending {
  width: 11px;
  height: 11px;
  background: color-mix(in srgb, var(--task-accent) 68%, #fff 32%);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--task-soft) 70%, #fff 30%);
}

.detail-bottom-nav {
  position: sticky;
  bottom: 14px;
  z-index: 10;
  margin-left: auto;
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.95);
  box-shadow: 0 12px 26px rgba(78, 62, 38, 0.12);
  backdrop-filter: blur(10px);
}

.topic-detail-host,
.detail-stack {
  display: grid;
  gap: 16px;
}

.detail-summary-card,
.data-card,
.review-card {
  padding: 18px;
}

.detail-summary-card {
  border-left: 6px solid var(--task-accent);
}

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

.info-card,
.review-card,
.empty-state-card,
.save-strip {
  min-width: 0;
}

.content-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.plain-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.68;
}

.plain-copy p {
  margin: 0;
}

.plain-copy p + p {
  margin-top: 10px;
}

.criteria-card {
  border-style: dashed;
}

.criteria-card .criteria-block:first-of-type {
  margin-top: 20px;
}

.criteria-block + .criteria-block {
  margin-top: 14px;
}

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

.compact-fact-grid {
  margin-top: 10px;
}

.relevance-fact-grid {
  margin-top: 12px;
}

.llm-judgment-card {
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.llm-judgment-heading {
  align-items: flex-start;
  justify-content: flex-start;
}

.llm-judgment-main {
  display: grid;
  gap: 8px;
}

.llm-verdict-chip-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.trial-scroll-panel {
  margin-top: 14px;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 6px;
}

.trial-detail-stack {
  display: grid;
  gap: 8px;
}

.trial-title-block {
  display: grid;
  gap: 4px;
}

.trial-title {
  font-size: 1.06rem;
}

.trial-id-line {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.trial-content-block {
  margin-top: 8px;
}

.trial-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.trial-list li {
  line-height: 1.4;
}

.clinician-evaluation-card {
  border-top: 4px solid color-mix(in srgb, var(--task-accent) 36%, #fff 64%);
}

.detail-footnote {
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.subcohort-shell {
  padding-bottom: 12px;
}

.subcohort-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(420px, 58vw);
  align-items: stretch;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scroll-snap-type: x mandatory;
}

.subcohort-slide {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  height: 100%;
  scroll-snap-align: start;
}

.subcohort-info-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-color: color-mix(in srgb, var(--task-line) 70%, #d8e2f0 30%);
}

.subcohort-evaluation-card {
  border-color: color-mix(in srgb, var(--task-accent) 34%, #d8e2f0 66%);
}

.fact-item {
  border: 1px solid #e0e8f3;
  border-radius: 16px;
  background: #fcfdff;
  padding: 12px 13px;
}

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

.fact-item dt {
  margin-bottom: 6px;
}

.fact-item dd {
  margin: 0;
  line-height: 1.5;
}

.annotation-block {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.annotation-fieldset {
  margin: 0;
  border: 1px solid #dee7f3;
  border-radius: 16px;
  padding: 12px;
}

.annotation-fieldset legend {
  padding: 0 8px;
  font-weight: 600;
}

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

.choice-pill {
  position: relative;
}

.choice-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #d6e0ed;
  background: #fff;
  color: var(--text);
  font-weight: 600;
}

.choice-pill input:checked + span {
  background: var(--task-accent);
  color: #fff;
  border-color: var(--task-accent);
}

.choice-pill input:disabled + span {
  opacity: 0.58;
}

.judge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.judge-pill-yes {
  background: var(--complete-bg);
  color: var(--complete-text);
}

.judge-pill-no {
  background: #f6eaea;
  color: #8a2f2f;
}

.judge-pill-neutral {
  background: #eef3f8;
  color: #42546d;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: auto;
}

.tutorial-spotlight {
  position: fixed;
  border-radius: 22px;
  box-shadow: 0 0 0 9999px rgba(17, 24, 39, 0.56);
  border: 2px solid rgba(255, 255, 255, 0.88);
  background: transparent;
  pointer-events: none;
  transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease;
}

.tutorial-popover {
  position: fixed;
  width: min(360px, calc(100vw - 32px));
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(248, 242, 233, 0.98));
  box-shadow: 0 28px 56px rgba(17, 24, 39, 0.32);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto;
}

.tutorial-popover-header,
.tutorial-popover-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tutorial-popover-header {
  align-items: center;
}

.tutorial-counter {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.tutorial-popover h2 {
  margin: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.1;
}

.tutorial-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.tutorial-popover-actions {
  justify-content: flex-end;
}

.tutorial-skip-button {
  flex: 0 0 auto;
}

.status-badge {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.complete {
  background: var(--complete-bg);
  color: var(--complete-text);
}

.status-badge.started {
  background: var(--started-bg);
  color: var(--started-text);
}

.status-badge.not_started {
  background: var(--not-started-bg);
  color: var(--not-started-text);
}

.save-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.save-strip-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-chief,
.theme-chief .task-tab,
.theme-chief .topic-open-button,
.theme-chief.task-tab,
.theme-chief.topic-open-button,
.detail-stack.theme-chief,
.task-guidance.theme-chief {
  --task-accent: var(--theme-chief);
  --task-soft: var(--theme-chief-soft);
  --task-line: var(--theme-chief-line);
}

.theme-teal,
.theme-teal .task-tab,
.theme-teal .topic-open-button,
.theme-teal.task-tab,
.theme-teal.topic-open-button,
.detail-stack.theme-teal,
.task-guidance.theme-teal {
  --task-accent: var(--theme-teal);
  --task-soft: var(--theme-teal-soft);
  --task-line: var(--theme-teal-line);
}

.theme-amber,
.theme-amber .task-tab,
.theme-amber .topic-open-button,
.theme-amber.task-tab,
.theme-amber.topic-open-button,
.detail-stack.theme-amber,
.task-guidance.theme-amber {
  --task-accent: var(--theme-amber);
  --task-soft: var(--theme-amber-soft);
  --task-line: var(--theme-amber-line);
}

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

  .task-tabs {
    grid-template-columns: 1fr;
  }

  .subcohort-carousel {
    grid-auto-columns: minmax(360px, 78vw);
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 18px 14px 28px;
  }

  .app-header,
  .detail-summary-head,
  .panel-intro,
  .section-heading,
  .review-heading,
  .topic-card-top,
  .tutorial-popover-header,
  .tutorial-popover-actions {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .topic-open-button {
    flex-direction: column;
  }

  .topic-open-side {
    min-width: 0;
  }

  .subcohort-carousel {
    grid-auto-columns: minmax(280px, 86vw);
  }

  .subcohort-slide {
    grid-template-rows: auto auto;
    height: auto;
  }

  .subcohort-info-card {
    height: auto;
  }

  .detail-bottom-nav {
    width: 100%;
    justify-content: space-between;
    border-radius: 18px;
    bottom: 8px;
  }

  .detail-bottom-nav .secondary-button {
    flex: 1;
  }

  .trial-scroll-panel {
    max-height: 460px;
  }
}
