/* InnoPair Health — workspace (app.html). Same visual language as the landing page:
   soft sky gradient over a plus-grid, frosted-glass cards, pill controls, script accents. */

.app-body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M24 20v8M20 24h8' stroke='%2393c5fd' stroke-opacity='.3' stroke-width='1'/%3E%3C/svg%3E"),
    radial-gradient(60% 40% at 70% 0%, rgb(56 189 248 / 0.16), transparent 70%),
    radial-gradient(40% 30% at 20% 10%, rgb(37 99 235 / 0.07), transparent 70%),
    linear-gradient(180deg, #f5faff 0%, #f8fafc 50%);
  background-attachment: fixed;
}

.glass,
.card,
.panel,
.kpi,
.record-pill,
.candidate-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.card, .panel { border-radius: var(--radius-xl); }

/* ---------- Shell ---------- */
.app-shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-4);
  border-right: 1px solid var(--glass-border);
  background: rgb(255 255 255 / 0.66);
  box-shadow: 1px 0 0 rgb(15 23 42 / 0.04);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.sidebar .brand { padding: 0 var(--space-2); }
.workspace-label {
  margin: var(--space-2) 0 calc(var(--space-3) * -1);
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.sidebar nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav-item:hover { background: var(--sky-50); color: var(--primary-hover); }
.nav-item.active { background: var(--gradient-brand); color: var(--white); font-weight: 600; box-shadow: 0 6px 16px rgb(37 99 235 / 0.22); }
.nav-item b {
  margin-left: auto;
  min-width: 1.5rem;
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.25rem;
  text-align: center;
}
.nav-item.active b { background: rgb(255 255 255 / 0.25); color: var(--white); }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.source-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: rgb(240 249 255 / 0.8);
}
.source-card .live-dot { margin-top: 6px; }
.source-card strong,
.user-pill strong { display: block; color: var(--text); font-size: var(--text-sm); font-weight: 600; line-height: var(--leading-normal); }
.source-card small,
.user-pill small { display: block; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-normal); }

.role-switch { display: flex; flex-direction: column; gap: var(--space-1); padding: 0 var(--space-1); }
.role-switch label { display: flex; align-items: center; justify-content: space-between; margin: 0; color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; }
.role-switch label span { padding: 0 var(--space-2); border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 0.6875rem; line-height: 1.5; }
.role-switch select { min-height: 2.25rem; border-radius: 999px; padding: 0 var(--space-4); font-size: var(--text-sm); font-weight: 600; background: rgb(255 255 255 / 0.85); }

.user-pill { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2) 0; border-top: 1px solid var(--border); }
.user-pill > div:nth-child(2) { flex: 1; min-width: 0; }
.user-pill strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pill .text-button { font-size: var(--text-xs); color: var(--text-muted); }
.user-pill .text-button:hover { color: var(--text); }

.avatar,
.candidate-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #bfdbfe, #93c5fd);
  color: var(--slate-900);
  font-size: var(--text-xs);
  font-weight: 700;
}
.avatar { background: var(--gradient-brand); color: var(--white); }
.candidate-avatar.sm { width: 28px; height: 28px; font-size: 0.6875rem; }

/* ---------- Main column ---------- */
.main-content { width: 100%; max-width: 1280px; margin: 0 auto; padding: var(--space-8) var(--space-10) var(--space-12); }

.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.topbar > div:first-child { flex: 1 1 32rem; }
.topbar .eyebrow {
  display: inline-flex;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--gradient-brand);
  color: var(--white);
  box-shadow: 0 6px 16px rgb(37 99 235 / 0.22);
}
.topbar h1 { margin: var(--space-4) 0 var(--space-3); font-size: clamp(2rem, 3.6vw, 2.75rem); line-height: 1.08; letter-spacing: -0.03em; }
.topbar h1 em { font-size: 1.06em; }
.topbar .lede { max-width: 44rem; color: var(--text-body); }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.top-status { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-right: var(--space-2); }
.demo-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.25rem var(--space-3);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text-body);
  font-size: var(--text-xs);
  font-weight: 600;
}
.demo-label .live-dot { width: 6px; height: 6px; }

/* Trust bar */
.trust-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--space-10); overflow: hidden; }
.trust-item { padding: var(--space-4) var(--space-5); }
.trust-item + .trust-item { border-left: 1px solid var(--border); }
.trust-item strong { display: block; color: var(--text); font-size: var(--text-sm); font-weight: 600; }
.trust-item small { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-normal); }

/* ---------- Sections ---------- */
.module { margin-bottom: var(--space-12); scroll-margin-top: var(--space-6); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-6); margin-bottom: var(--space-5); }
.section-head .eyebrow { color: var(--primary); }
.section-head h2 { margin-top: var(--space-1); font-size: var(--text-2xl); letter-spacing: -0.025em; }
.section-description { margin-top: var(--space-1); color: var(--text-muted); font-size: var(--text-sm); }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.pipeline-count { color: var(--text-muted); font-size: var(--text-sm); font-weight: 500; }

/* KPI tiles — the landing page's stat strip */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--space-5); border-radius: 20px; }
.kpi-label { color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.kpi b { margin-top: var(--space-1); color: var(--text); font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi b.long { font-size: var(--text-lg); letter-spacing: -0.01em; }
.kpi small { color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-normal); }
.kpi:first-child { background: linear-gradient(140deg, var(--sky-400), var(--primary) 75%); border-color: transparent; box-shadow: 0 14px 30px rgb(37 99 235 / 0.25); }
.kpi:first-child :is(.kpi-label, b, small) { color: var(--white); }
.kpi:first-child small { opacity: 0.85; }

.overview-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.overview-split.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.panel { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; padding: var(--space-6); scroll-margin-top: var(--space-6); }
.panel h3 { font-size: var(--text-lg); }
.panel-sub { color: var(--text-muted); font-size: var(--text-sm); }
.empty-note { padding: var(--space-5); border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--text-muted); font-size: var(--text-sm); text-align: center; }

/* Tables */
.table-scroll { overflow-x: auto; margin: 0 calc(var(--space-2) * -1); }
.triage, .portfolio { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.triage th, .triage td, .portfolio th, .portfolio td { padding: var(--space-2); text-align: left; white-space: nowrap; }
.triage thead th, .portfolio thead th { color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.triage tbody tr + tr th, .triage tbody tr + tr td, .portfolio tbody tr + tr th, .portfolio tbody tr + tr td { border-top: 1px solid var(--slate-100); }
.triage tbody th { display: flex; align-items: center; gap: var(--space-2); color: var(--text); font-weight: 600; }
.triage-cell {
  min-width: 6.5rem;
  min-height: 2rem;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.triage-cell:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgb(15 23 42 / 0.1); }
.triage-cell.shortlist { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.triage-cell.missing { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.triage-cell.no { background: var(--slate-100); color: var(--text-muted); }
.triage-cell.on { box-shadow: 0 0 0 2px var(--primary); }
.portfolio td { color: var(--text-body); font-variant-numeric: tabular-nums; }
.portfolio tr.on th, .portfolio tr.on td { background: var(--primary-soft); }
.row-link { padding: 0; border: 0; background: none; color: var(--text); font-weight: 600; text-align: left; cursor: pointer; }
.row-link:hover { color: var(--primary); text-decoration: underline; }
.rate { display: inline-block; width: 64px; height: 6px; margin-right: var(--space-2); overflow: hidden; border-radius: 99px; background: var(--slate-100); vertical-align: middle; }
.rate i { display: block; height: 100%; border-radius: inherit; background: var(--gradient-brand); }

/* Lists */
.queue-list, .referral-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.queue-list li, .referral-list li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; font-size: var(--text-sm); }
.queue-list li + li, .referral-list li + li { border-top: 1px solid var(--slate-100); }
.queue-list li > span { flex: 1; min-width: 0; color: var(--text-body); }
.queue-list b { margin-right: var(--space-1); color: var(--text); }
.queue-list small { display: block; color: var(--text-muted); font-size: var(--text-xs); }
.referral-main { flex: 1; min-width: 0; }
.referral-main b { display: block; color: var(--text); }
.referral-main small { display: block; overflow: hidden; color: var(--text-muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.referral-actions { display: flex; gap: var(--space-2); }
.outline-button.sm, .primary-button.sm { min-height: 2rem; padding: 0 var(--space-3); font-size: var(--text-xs); }

/* Patient sharing */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.share-chip { padding: 0.2rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--white); color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; }
.share-chip.on { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary-hover); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin: var(--space-2) 0 0; padding: var(--space-4); border: 1px solid var(--border); border-radius: 16px; background: var(--white); cursor: pointer; }
.switch-row strong { display: block; color: var(--text); font-size: var(--text-sm); }
.switch-row small { display: block; color: var(--text-muted); font-size: var(--text-xs); font-weight: 400; line-height: var(--leading-normal); }
.switch-row input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: var(--slate-300);
  cursor: pointer;
  transition: background-color 200ms ease;
}
.switch-row input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgb(15 23 42 / 0.25); transition: transform 200ms ease; }
.switch-row input[type="checkbox"]:checked { background: var(--primary); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.next-steps { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-3) 0 0; padding: 0; list-style: none; counter-reset: step; font-size: var(--text-sm); color: var(--text-body); }
.next-steps li { position: relative; padding-left: 2.5rem; counter-increment: step; }
.next-steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--gradient-brand); color: var(--white); font-size: var(--text-xs); font-weight: 700; box-shadow: 0 0 0 4px var(--sky-50); }
.next-steps b { color: var(--text); }

/* Candidate picker */
.candidate-pipeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.candidate-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: 999px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.candidate-card:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 16px 36px rgb(37 99 235 / 0.12); }
.candidate-card.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary), 0 12px 30px rgb(37 99 235 / 0.15); }
.candidate-card.selected .candidate-avatar { background: var(--gradient-brand); color: var(--white); }
.candidate-card > span:last-child { min-width: 0; }
.candidate-card strong { display: block; overflow: hidden; font-size: var(--text-sm); font-weight: 600; line-height: var(--leading-normal); text-overflow: ellipsis; white-space: nowrap; }
.candidate-card small { display: block; color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-normal); }

/* Record snapshot */
.record-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.record-loading { grid-column: 1 / -1; padding: var(--space-6); border: 1px dashed var(--border-strong); border-radius: 20px; color: var(--text-muted); font-size: var(--text-sm); text-align: center; }
.record-pill { min-width: 0; padding: var(--space-4) var(--space-5); border-radius: 20px; }
.record-pill .label { display: block; color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.record-pill strong { display: block; margin-top: var(--space-1); overflow: hidden; color: var(--text); font-size: var(--text-base); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.record-pill small { display: block; color: var(--text-muted); font-size: var(--text-xs); }

/* ---------- Studies + evidence ---------- */
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: var(--space-5); align-items: start; }
.study-list-wrap { overflow: hidden; }
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: rgb(240 249 255 / 0.6); }
.list-filter,
.filter-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2rem;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.list-filter:hover,
.filter-button:hover { background: rgb(255 255 255 / 0.8); color: var(--text); }
.list-filter.active { background: var(--ink-pill); color: var(--white); font-weight: 600; }
.list-filter span:not(.filter-label) { min-width: 1.25rem; padding: 0 var(--space-1); border-radius: 999px; background: var(--slate-200); color: var(--text-body); font-size: var(--text-xs); font-weight: 600; line-height: 1.25rem; text-align: center; }
.list-filter.active span:not(.filter-label) { background: rgb(255 255 255 / 0.2); color: var(--white); }
.filter-button { margin-left: auto; color: var(--text-muted); }
.filter-button::before { content: "↓"; font-size: var(--text-xs); }

.study-list { display: flex; flex-direction: column; }
.study-card { position: relative; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border); cursor: pointer; transition: background-color 150ms ease; }
.study-card:last-child { border-bottom: 0; }
.study-card:hover { background: rgb(255 255 255 / 0.6); }
.study-card.selected { background: linear-gradient(90deg, rgb(239 246 255 / 0.95), rgb(240 249 255 / 0.6)); }
.study-card.selected::before { content: ""; position: absolute; inset: var(--space-4) auto var(--space-4) 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--gradient-brand); }
.study-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.study-title { font-size: var(--text-lg); }
.study-detail { color: var(--text-body); font-size: var(--text-sm); }
.study-meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; }
.study-meta span + span::before { content: "·"; margin-right: var(--space-2); color: var(--slate-400); }
.criteria-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-6); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.criteria-label { margin-bottom: var(--space-2); color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.criteria-list { margin: 0; padding-left: 1.1rem; color: var(--text-body); font-size: var(--text-sm); line-height: var(--leading-normal); }
.criteria-list li + li { margin-top: var(--space-1); }
.criteria-list li::marker { color: var(--sky-400); }
.study-cta { align-self: flex-start; }
.empty-list { padding: var(--space-10) var(--space-6); color: var(--text-muted); font-size: var(--text-sm); text-align: center; }

.match-insight { position: sticky; top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); max-height: calc(100vh - var(--space-12)); overflow-y: auto; padding: var(--space-6); }
.match-insight h3 { font-size: var(--text-lg); }
.match-insight > .eyebrow { color: var(--primary); }
.match-insight > p:not(.eyebrow) { color: var(--text-body); font-size: var(--text-sm); }
.match-insight .criteria-split { grid-template-columns: 1fr; }
.evidence { border: 1px solid var(--border); border-radius: 16px; background: rgb(255 255 255 / 0.7); }
.evidence-row { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.evidence-row + .evidence-row { border-top: 1px solid var(--border); }
.evidence-row span:first-child { color: var(--text-muted); }
.evidence-row span:last-child { color: var(--text); font-weight: 600; text-align: right; }
.insight-footer { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--space-3); align-items: baseline; font-size: var(--text-sm); }
.insight-footer span { color: var(--text-muted); }
.insight-footer strong { color: var(--text); font-weight: 600; }
.insight-footer small { grid-column: 1 / -1; margin-top: var(--space-1); color: var(--text-muted); font-size: var(--text-xs); }
.insight-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }

.funnel { display: flex; flex-direction: column; gap: var(--space-2); }
.funnel-row { display: grid; grid-template-columns: 6.5rem 1fr 2rem; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.funnel-row span:first-child { color: var(--text-muted); }
.funnel-row b { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.funnel-bar { height: 10px; overflow: hidden; border-radius: 99px; background: var(--slate-100); }
.funnel-bar i { display: block; height: 100%; border-radius: inherit; transition: width 600ms cubic-bezier(.2,.7,.2,1); }
.funnel-bar.base i { background: var(--gradient-brand); }
.funnel-bar.shortlist i { background: var(--success); }
.funnel-bar.missing i { background: #f59e0b; }
.funnel-bar.no i { background: var(--slate-300); }
.blocker-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.blocker-list li { display: flex; justify-content: space-between; padding: var(--space-2) var(--space-3); border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: var(--text-sm); font-weight: 500; }
.small { font-size: var(--text-sm); }

.ai-review { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--primary-border); border-radius: 16px; background: linear-gradient(160deg, var(--primary-soft), rgb(236 254 255 / 0.8)); font-size: var(--text-sm); }
.ai-review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.ai-review-head strong { color: var(--text); font-size: var(--text-sm); font-weight: 600; }
.ai-review-head span { color: var(--primary-hover); font-size: var(--text-xs); font-weight: 600; }
.ai-review p { color: var(--text-body); }
.ai-review-loading { color: var(--text-muted); font-size: var(--text-sm); }
.ai-review dl { display: grid; grid-template-columns: 3.5rem 1fr; gap: var(--space-2) var(--space-3); margin: 0; }
.ai-review dt { color: var(--text-muted); font-weight: 600; }
.ai-review dd { margin: 0; color: var(--text); }
.ai-review .ai-guardrail { color: var(--text-muted); font-size: var(--text-xs); }
.ai-review-button { width: 100%; }

/* ---------- Dialogs ---------- */
dialog { border-radius: var(--radius-xl); border-color: var(--glass-border); }
#studyForm, .record-dialog, .agent-dialog, .connect-dialog { padding: var(--space-6); }
#studyForm > label, .agent-dialog > label { margin-top: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-4); }
#studyForm .full-width, .agent-dialog .full-width, .connect-dialog .full-width { margin-top: var(--space-5); }
.connect-dialog .field-error { min-height: 1.25rem; margin-top: var(--space-2); color: #b91c1c; font-size: var(--text-sm); }
.record-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }
.record-detail-group { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: 16px; background: var(--surface-muted); }
.record-detail-group .eyebrow { display: block; margin-bottom: var(--space-1); }
.record-detail-group div { padding: 2px 0; color: var(--text); font-size: var(--text-sm); }
.record-detail-group .muted { color: var(--text-muted); }
.checkbox-label { display: flex !important; align-items: center; gap: var(--space-2); margin-top: var(--space-4); font-weight: 500; }
.agent-results { margin-top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.agent-results:empty { display: none; }
.agent-summary { padding: var(--space-4); border: 1px solid var(--primary-border); border-radius: 16px; background: var(--primary-soft); }
.agent-summary strong { color: var(--text); font-size: var(--text-sm); }
.agent-summary p { margin-top: var(--space-1); color: var(--text-body); font-size: var(--text-sm); }
.agent-steps { margin: 0; padding-left: var(--space-5); font-size: var(--text-sm); }
.agent-steps li { padding: var(--space-1) 0; }
.agent-steps strong { color: var(--text); font-weight: 600; }
.agent-step-status { margin-left: var(--space-1); color: var(--success); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.agent-steps small { display: block; color: var(--text-muted); font-size: var(--text-xs); }
.agent-results-list { border: 1px solid var(--border); border-radius: 16px; }
.agent-results-list > div { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); color: var(--text); font-size: var(--text-sm); }
.agent-results-list > div + div { border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .workspace-grid, .overview-split, .overview-split.wide-left { grid-template-columns: minmax(0, 1fr); }
  .match-insight { position: static; max-height: none; overflow: visible; scroll-margin-top: 5rem; }
  .match-insight .criteria-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-item + .trust-item { border-left: 0; }
  .trust-item:nth-child(even) { border-left: 1px solid var(--border); }
  .trust-item:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-right: 0; border-bottom: 1px solid var(--glass-border); }
  .sidebar .brand { padding: 0; }
  .workspace-label, .source-card { display: none; }
  .sidebar nav { order: 3; flex-direction: row; width: 100%; overflow-x: auto; }
  .nav-item { width: auto; flex: none; }
  .sidebar-bottom { flex-direction: row; align-items: center; margin-left: auto; }
  .role-switch label { display: none; }
  .role-switch select { min-height: 2rem; font-size: var(--text-xs); }
  .user-pill { padding: 0; border-top: 0; }
  .user-pill > div:nth-child(2) { display: none; }
  .main-content { padding: var(--space-6) var(--space-4) var(--space-10); scroll-margin-top: 7rem; }
  .module, .match-insight, .panel { scroll-margin-top: 7.5rem; }
}

@media (max-width: 560px) {
  .trust-bar { grid-template-columns: 1fr; }
  .trust-item:nth-child(even) { border-left: 0; }
  .trust-item + .trust-item { border-top: 1px solid var(--border); }
  .kpi-grid { gap: var(--space-2); }
  .kpi { padding: var(--space-4); }
  .criteria-split, .match-insight .criteria-split, .form-row, .insight-actions { grid-template-columns: 1fr; }
  .record-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-pill strong { font-size: var(--text-sm); white-space: normal; }
  .study-card { padding: var(--space-4); }
  .top-actions { width: 100%; }
  .top-actions .outline-button { flex: 1; }
  .filter-button { margin-left: 0; }
  .referral-list li { flex-wrap: wrap; }
  .referral-actions { width: 100%; }
  .referral-actions button { flex: 1; }
  .toast { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); }
}

/* ---------- Spotlight (matches the landing-page mockup) ---------- */
.spotlight { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--space-4); margin-bottom: var(--space-4); }
.spotlight:empty { display: none; }
.spot-card { display: flex; flex-direction: column; min-width: 0; padding: var(--space-5) var(--space-6); border-radius: var(--radius-xl); }
.spot-kicker { color: var(--text-muted); font-size: 0.6875rem; font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.spot-ring { align-items: center; text-align: center; background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.spot-ring .ring { position: relative; width: 120px; height: 120px; margin: var(--space-3) auto; }
.spot-ring .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.spot-ring .ring circle { fill: none; stroke-width: 10; }
.spot-ring .ring-track { stroke: var(--sky-100); }
.spot-ring .ring-fill { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 314; stroke-dashoffset: 314; transition: stroke-dashoffset 1.4s cubic-bezier(.2, .7, .2, 1) 0.15s; }
.spotlight.in .ring-fill { stroke-dashoffset: calc(314 - 314 * var(--p) / 100); }
.spot-ring .ring > span { position: absolute; inset: 0; display: grid; place-content: center; }
.spot-ring .ring b { color: var(--text); font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.spot-ring .ring small { margin-top: 2px; color: var(--text-muted); font-size: var(--text-xs); font-weight: 600; }
.spot-note { color: var(--text-muted); font-size: var(--text-sm); }
.spot-alert { gap: 2px; min-height: 13rem; background: linear-gradient(140deg, var(--sky-400), var(--primary) 70%); color: var(--white); box-shadow: 0 14px 30px rgb(37 99 235 / 0.25); }
.spot-alert .spot-kicker { color: rgb(255 255 255 / 0.8); }
.spot-alert b { margin-top: var(--space-4); font-size: var(--text-2xl); letter-spacing: -0.02em; line-height: var(--leading-tight); }
.spot-alert small { margin-top: var(--space-1); color: rgb(255 255 255 / 0.85); font-size: var(--text-sm); }
.spot-alert-btn { align-self: flex-start; margin-top: auto; padding: 0.5rem 1.25rem; border: 0; border-radius: 999px; background: rgb(255 255 255 / 0.22); color: var(--white); font-size: var(--text-sm); font-weight: 600; cursor: pointer; transition: background 150ms ease; }
.spot-alert-btn:hover { background: rgb(255 255 255 / 0.32); }
.spot-alert-btn:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
/* The alert card replaces the first KPI's gradient so only one card shouts. */
.spotlight:not(:empty) + .kpi-grid .kpi:first-child { background: var(--glass); border-color: var(--glass-border); box-shadow: var(--glass-shadow); }
.spotlight:not(:empty) + .kpi-grid .kpi:first-child .kpi-label,
.spotlight:not(:empty) + .kpi-grid .kpi:first-child small { color: var(--text-muted); opacity: 1; }
.spotlight:not(:empty) + .kpi-grid .kpi:first-child b { color: var(--text); }
@media (max-width: 720px) { .spotlight { grid-template-columns: 1fr; } .spot-alert { min-height: 0; } }
@media (prefers-reduced-motion: reduce) { .spot-ring .ring-fill { transition: none; } }

/* ---------- Simplified study list + evidence ---------- */
.study-card.compact { gap: var(--space-2); padding: var(--space-4) var(--space-6); }
.study-card.compact .study-title { font-size: var(--text-base); }
.study-card.compact:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.study-ai-tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 var(--space-2); border-radius: 999px; background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.study-meta .study-ai-tag::before { content: none; }

.check-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.check { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: 14px; background: rgb(255 255 255 / 0.75); font-size: var(--text-sm); }
.check-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--white); font-size: 12px; font-weight: 800; line-height: 1; }
.check.ok .check-icon { background: var(--success); }
.check.ok .check-icon::after { content: "✓"; }
.check.warn .check-icon { background: #d97706; }
.check.warn .check-icon::after { content: "!"; }
.check.no .check-icon { background: var(--danger); }
.check.no .check-icon::after { content: "✕"; font-size: 10px; }
.check-label { color: var(--text); font-weight: 600; }
.check-value { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.check.no { border-color: var(--danger-border); background: var(--danger-soft); }
.check.warn { border-color: var(--warning-border); background: var(--warning-soft); }

.criteria-details { border: 1px solid var(--border); border-radius: 14px; background: rgb(255 255 255 / 0.6); }
.criteria-details summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); color: var(--text); font-size: var(--text-sm); font-weight: 600; cursor: pointer; list-style: none; }
.criteria-details summary::-webkit-details-marker { display: none; }
.criteria-details summary::after { content: "+"; color: var(--text-muted); font-size: var(--text-lg); font-weight: 400; line-height: 1; }
.criteria-details[open] summary::after { content: "–"; }
.criteria-details summary span { margin-left: auto; color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; }
.criteria-details .criteria-split { padding: var(--space-3) var(--space-4) var(--space-4); }
.insight-source { color: var(--text-muted) !important; font-size: var(--text-xs) !important; }

.sample-link { color: var(--text-muted); font-size: var(--text-xs); }
.sample-link a { color: var(--primary); font-weight: 600; }

/* Ollie on the patient match card */
.spot-alert { position: relative; overflow: hidden; }
.spot-otter { position: absolute; right: var(--space-4); bottom: -6px; width: 112px; height: auto; filter: drop-shadow(0 10px 18px rgb(15 23 42 / 0.25)); animation: ollie-peek 0.8s cubic-bezier(.2, .8, .2, 1.2) 0.4s both; }
body[data-role="patient"] .spot-alert > :not(.spot-otter) { max-width: calc(100% - 120px); }
@keyframes ollie-peek { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) { .spot-otter { width: 84px; } body[data-role="patient"] .spot-alert > :not(.spot-otter) { max-width: calc(100% - 88px); } }
@media (prefers-reduced-motion: reduce) { .spot-otter { animation: none; } }

/* Ring: room for long study codes inside the circle */
.spot-ring .ring { width: 148px; height: 148px; }
.spot-ring .ring circle { stroke-width: 8; }
.spot-ring .ring > span { padding: 0 22px; text-align: center; }
.spot-ring .ring b { font-size: 1.875rem; }
.spot-ring .ring small { display: block; max-width: 100%; overflow: hidden; font-size: 0.6875rem; letter-spacing: 0.02em; text-overflow: ellipsis; white-space: nowrap; }
