/*
  Atlas Brand Identity & Design System v1.0 — token layer.
  Dark is this console's default surface (an operations instrument meant to
  be watched for long stretches — the brand's own "Mission Control" personality
  reference). Anyone whose OS/browser prefers light gets the real light theme
  below, not a degraded version of the dark one.
*/
:root {
  --bg: #0e161f;
  --bg-grid:
    repeating-linear-gradient(0deg, rgba(124, 169, 209, 0.05) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(124, 169, 209, 0.05) 0 1px, transparent 1px 88px);
  --panel: #141f2b;
  --panel-strong: #1b2836;
  --panel-elevated: #101923;
  --card-bg: #101923;
  --chip-bg: #182430;
  --text: #e4eaf0;
  --muted: #7c8ca0;
  --border: #263444;
  --border-strong: #33455a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.28);

  --primary: #7ca9d1;
  --primary-dark: #b9d3e8;
  --primary-fill: #1f4e79;
  --teal: #2dd4c4;

  --danger: #f2879a;
  --danger-fill: #dc2626;
  --success: #6fd79b;
  --success-fill: #22c55e;
  --warning: #f5c177;
  --warning-fill: #f59e0b;
  --info: #7fa8f0;
  --info-fill: #2563eb;

  --label: #93a9c4;

  --success-text: #a8ecc7;
  --success-bg: #16332a;
  --success-bg-subtle: #122922;
  --success-border: rgba(111, 215, 155, 0.4);

  --warning-text: #fbd9a6;
  --warning-bg: #3a2e1b;
  --warning-bg-subtle: #2c2416;
  --warning-border: rgba(245, 193, 119, 0.4);

  --danger-text: #fac3ce;
  --danger-bg: #3a1b22;
  --danger-bg-subtle: #2c161b;
  --danger-border: rgba(242, 135, 154, 0.4);

  --info-text: #c6d8fa;
  --info-bg: #1b2740;
  --info-bg-subtle: #182234;
  --info-border: rgba(127, 168, 240, 0.4);

  --neutral-chip-bg: #182430;
  --neutral-chip-text: #c7d6e6;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-grid:
      repeating-linear-gradient(0deg, rgba(31, 78, 121, 0.05) 0 1px, transparent 1px 88px),
      repeating-linear-gradient(90deg, rgba(31, 78, 121, 0.05) 0 1px, transparent 1px 88px);
    --panel: #ffffff;
    --panel-strong: #eef2f6;
    --panel-elevated: #f1f5f9;
    --card-bg: #ffffff;
    --chip-bg: #eef2f6;
    --text: #334155;
    --muted: #64748b;
    --border: #dce3ea;
    --border-strong: #c3ceda;
    --shadow: 0 1px 2px rgba(31, 78, 121, 0.06), 0 1px 1px rgba(31, 78, 121, 0.04);

    --primary: #1f4e79;
    --primary-dark: #2f6394;
    --primary-fill: #1f4e79;
    --teal: #14b8a6;

    --danger: #dc2626;
    --danger-fill: #dc2626;
    --success: #16a34a;
    --success-fill: #22c55e;
    --warning: #b45309;
    --warning-fill: #f59e0b;
    --info: #2563eb;
    --info-fill: #2563eb;

    --label: #47607f;

    --success-text: #15803d;
    --success-bg: #dcfce7;
    --success-bg-subtle: #eafbf0;
    --success-border: rgba(21, 128, 61, 0.3);

    --warning-text: #b45309;
    --warning-bg: #fef3c7;
    --warning-bg-subtle: #fff8e6;
    --warning-border: rgba(180, 83, 9, 0.3);

    --danger-text: #b91c1c;
    --danger-bg: #fee2e2;
    --danger-bg-subtle: #fef0f0;
    --danger-border: rgba(185, 28, 28, 0.3);

    --info-text: #1d4ed8;
    --info-bg: #dbeafe;
    --info-bg-subtle: #eaf2fe;
    --info-border: rgba(29, 78, 216, 0.3);

    --neutral-chip-bg: #eef2f6;
    --neutral-chip-text: #334155;
  }
}

/*
  Manual override via the theme-toggle button (atlas-os.js sets
  data-theme on <html> and persists the choice to localStorage). Higher
  specificity than the bare :root rules above, so it wins in both
  directions regardless of the OS/browser's prefers-color-scheme.
*/
:root[data-theme="dark"] {
  --bg: #0e161f;
  --bg-grid:
    repeating-linear-gradient(0deg, rgba(124, 169, 209, 0.05) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(124, 169, 209, 0.05) 0 1px, transparent 1px 88px);
  --panel: #141f2b;
  --panel-strong: #1b2836;
  --panel-elevated: #101923;
  --card-bg: #101923;
  --chip-bg: #182430;
  --text: #e4eaf0;
  --muted: #7c8ca0;
  --border: #263444;
  --border-strong: #33455a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.28);

  --primary: #7ca9d1;
  --primary-dark: #b9d3e8;
  --primary-fill: #1f4e79;
  --teal: #2dd4c4;

  --danger: #f2879a;
  --danger-fill: #dc2626;
  --success: #6fd79b;
  --success-fill: #22c55e;
  --warning: #f5c177;
  --warning-fill: #f59e0b;
  --info: #7fa8f0;
  --info-fill: #2563eb;

  --label: #93a9c4;

  --success-text: #a8ecc7;
  --success-bg: #16332a;
  --success-bg-subtle: #122922;
  --success-border: rgba(111, 215, 155, 0.4);

  --warning-text: #fbd9a6;
  --warning-bg: #3a2e1b;
  --warning-bg-subtle: #2c2416;
  --warning-border: rgba(245, 193, 119, 0.4);

  --danger-text: #fac3ce;
  --danger-bg: #3a1b22;
  --danger-bg-subtle: #2c161b;
  --danger-border: rgba(242, 135, 154, 0.4);

  --info-text: #c6d8fa;
  --info-bg: #1b2740;
  --info-bg-subtle: #182234;
  --info-border: rgba(127, 168, 240, 0.4);

  --neutral-chip-bg: #182430;
  --neutral-chip-text: #c7d6e6;
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-grid:
    repeating-linear-gradient(0deg, rgba(31, 78, 121, 0.05) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(31, 78, 121, 0.05) 0 1px, transparent 1px 88px);
  --panel: #ffffff;
  --panel-strong: #eef2f6;
  --panel-elevated: #f1f5f9;
  --card-bg: #ffffff;
  --chip-bg: #eef2f6;
  --text: #334155;
  --muted: #64748b;
  --border: #dce3ea;
  --border-strong: #c3ceda;
  --shadow: 0 1px 2px rgba(31, 78, 121, 0.06), 0 1px 1px rgba(31, 78, 121, 0.04);

  --primary: #1f4e79;
  --primary-dark: #2f6394;
  --primary-fill: #1f4e79;
  --teal: #14b8a6;

  --danger: #dc2626;
  --danger-fill: #dc2626;
  --success: #16a34a;
  --success-fill: #22c55e;
  --warning: #b45309;
  --warning-fill: #f59e0b;
  --info: #2563eb;
  --info-fill: #2563eb;

  --label: #47607f;

  --success-text: #15803d;
  --success-bg: #dcfce7;
  --success-bg-subtle: #eafbf0;
  --success-border: rgba(21, 128, 61, 0.3);

  --warning-text: #b45309;
  --warning-bg: #fef3c7;
  --warning-bg-subtle: #fff8e6;
  --warning-border: rgba(180, 83, 9, 0.3);

  --danger-text: #b91c1c;
  --danger-bg: #fee2e2;
  --danger-bg-subtle: #fef0f0;
  --danger-border: rgba(185, 28, 28, 0.3);

  --info-text: #1d4ed8;
  --info-bg: #dbeafe;
  --info-bg-subtle: #eaf2fe;
  --info-border: rgba(29, 78, 216, 0.3);

  --neutral-chip-bg: #eef2f6;
  --neutral-chip-text: #334155;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg-grid), var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

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

h1,
h2,
.assist-title,
.health-status,
.card-title {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

code,
.mono,
.explanation-json {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.atlas-shell {
  display: grid;
  gap: 20px;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  min-height: 100vh;
  padding: 18px;
}

.atlas-sidebar,
.legacy-context-panel,
.command-bar,
.panel,
.stat-card,
.command-palette .palette-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.atlas-sidebar {
  display: grid;
  gap: 22px;
  grid-template-rows: auto 1fr;
  padding: 20px;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-mark {
  color: var(--primary-fill);
  flex-shrink: 0;
  height: 30px;
  width: 30px;
}

.auth-gate-card .brand-lockup {
  margin-bottom: 4px;
}

.auth-gate-card .brand-mark {
  height: 34px;
  width: 34px;
}

.brand h1 {
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.subhead {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  margin-bottom: 0;
}

.brand-descriptor {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  margin: 3px 0 0;
  text-transform: uppercase;
}

.brand-tagline {
  color: var(--primary-dark);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  line-height: 1.5;
}

.auth-gate-card .brand-tagline {
  font-size: 0.86rem;
  margin: 10px 0 14px;
}

.atlas-nav {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}

.nav-category {
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 10px 12px;
  text-align: left;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.nav-category:hover {
  background: var(--chip-bg);
  color: var(--text);
}

.nav-category.active {
  background: var(--chip-bg);
  border-left-color: var(--primary-fill);
  color: var(--text);
}

.tiny-button {
  font-size: 0.72rem;
  padding: 6px 8px;
}

.child-tabs {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.child-tab-group {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

.child-tab-group.active {
  display: flex;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.nav-item:hover {
  background: var(--chip-bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--chip-bg);
  border-bottom-color: var(--primary-fill);
  color: var(--text);
}

.atlas-main {
  display: grid;
  gap: 16px;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.command-bar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 14px;
}

.command-trigger {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 14px;
  width: min(450px, 100%);
}

.command-bar-right {
  align-items: center;
  display: flex;
  gap: 10px;
}

.theme-toggle {
  align-items: center;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 6px;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  text-transform: uppercase;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-toggle svg {
  height: 14px;
  width: 14px;
}

.status-pill {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 7px 12px;
  text-transform: uppercase;
}

.status-pill.ok {
  border-color: color-mix(in srgb, var(--teal) 40%, var(--border));
  color: var(--teal);
}

.status-pill.bad {
  border-color: color-mix(in srgb, var(--danger-fill) 40%, var(--border));
  color: var(--danger);
}

.status-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 24px 12px;
  padding: 10px 16px;
}

.status-banner.hidden {
  display: none;
}

.workspace {
  overflow: auto;
  padding-right: 2px;
}

.view {
  display: none;
  animation: fade-in 200ms ease;
}

.view.active {
  display: grid;
  gap: 16px;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  padding: 18px;
}

.panel-secondary {
  background: var(--panel-elevated);
  border-color: var(--border);
  box-shadow: none;
  padding: 14px;
}

.panel-secondary .section-title {
  font-size: 0.66rem;
  opacity: 0.85;
}

.panel-header {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

h2 {
  margin-bottom: 8px;
}

.stat-grid,
.dual-grid,
.triple-grid,
.chart-grid,
.card-grid {
  display: grid;
  gap: 12px;
}

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

.reference-photo-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--panel-elevated);
}

.dual-grid,
.triple-grid,
.chart-grid {
  align-items: start;
}

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

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

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

.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.stat-card {
  border-radius: 6px;
  padding: 16px;
}

.stat-card p {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.stat-card strong {
  color: var(--text);
  font-size: 1.62rem;
}

.chart-card {
  display: grid;
  gap: 10px;
}

.chart-card strong {
  color: var(--primary-dark);
  font-size: 1.4rem;
}

.insight-list,
.timeline {
  display: grid;
  gap: 10px;
}

.list-pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding-top: 4px;
}

.list-pagination .button-row {
  align-items: center;
  gap: 8px;
}

.insight-item,
.timeline-item,
.bird-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
}

.insight-item {
  display: grid;
  gap: 8px;
}

.advisor-card,
.advisor-feed-item,
.task-card,
.project-card,
.knowledge-card {
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.advisor-card:hover,
.advisor-feed-item:hover,
.task-card:hover,
.project-card:hover,
.knowledge-card:hover {
  border-color: var(--border-strong);
}

.advisor-card.priority-high {
  border-color: var(--danger-border);
}

.advisor-card.priority-medium {
  border-color: var(--warning-border);
}

.advisor-card.priority-low {
  border-color: var(--success-border);
}

.reason-list {
  color: var(--muted);
  margin: 8px 0 0;
  padding-left: 18px;
}

.insight-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.insight-high {
  border-color: var(--danger-border);
}

.insight-medium {
  border-color: var(--warning-border);
}

.insight-low {
  border-color: var(--success-border);
}

.timeline-item {
  border-left: 3px solid var(--border-strong);
}

.timeline-item.unread {
  border-left-color: var(--primary-fill);
}

.explanation-json {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  margin: 6px 0 0;
}

.notification-item {
  display: grid;
  gap: 8px;
}

.metric-bar {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.metric-bar span {
  background: var(--primary-fill);
  display: block;
  height: 100%;
}

.mini-area {
  width: 100%;
  height: 74px;
}

.mini-area-fill {
  fill: color-mix(in srgb, var(--primary-fill) 16%, transparent);
}

.mini-area-line {
  fill: none;
  stroke: var(--primary-fill);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.legacy-context-panel {
  padding: 18px;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow: auto;
}

.context-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.context-tab {
  background: var(--chip-bg);
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 7px 8px;
}

.context-tab.active {
  border-color: var(--primary-fill);
  color: var(--text);
}

.evidence-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 10px;
}

.chip.active {
  border-color: var(--primary-fill);
  color: var(--text);
}

.chip-link {
  cursor: pointer;
  font-family: inherit;
}

.quick-nav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Keeps a jump target from landing directly under the sticky .quick-nav bar. */
.anchor-marker {
  display: block;
}

.anchor-marker,
.panel {
  scroll-margin-top: 56px;
}

.chip-link:hover {
  border-color: var(--primary-fill);
  color: var(--text);
}

.layout {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 340px) minmax(300px, 1fr) minmax(320px, 560px);
}

.graph-shell {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

#relationshipGraph,
#graphExplorerCanvas,
#researcherWorkspaceDecisionGraphCanvas,
#geneticsRelationshipMap,
#populationAncestryTree {
  display: block;
  height: auto;
  user-select: none;
  width: 100%;
}

#graphExplorerCanvas,
#researcherWorkspaceDecisionGraphCanvas,
#geneticsRelationshipMap,
#populationAncestryTree {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 12px;
}

.graph-edge {
  opacity: 0.35;
  stroke: var(--border-strong);
  stroke-width: 1.3;
}

.graph-edge.edge-active {
  opacity: 0.9;
  stroke: var(--primary);
  stroke-width: 2;
}

.graph-node {
  cursor: pointer;
}

.graph-node text {
  fill: var(--muted);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 10px;
  pointer-events: none;
}

.graph-node-dot {
  fill: var(--panel-elevated);
  stroke: var(--primary);
  stroke-width: 1.6;
}

.graph-node-dot.type-bird {
  fill: var(--success-bg);
  stroke: var(--success);
}

.graph-node-dot.type-evidence {
  fill: var(--info-bg);
  stroke: var(--info);
}

.graph-node-dot.type-trait {
  fill: var(--warning-bg);
  stroke: var(--warning);
}

.graph-node-dot.type-gene {
  fill: var(--panel-strong);
  stroke: var(--teal);
}

.graph-node-dot.type-validation-job {
  fill: var(--danger-bg);
  stroke: var(--danger);
}

.graph-node-dot.type-project {
  fill: var(--info-bg-subtle);
  stroke: var(--primary);
}

.graph-node-dot.type-knowledge {
  fill: var(--warning-bg-subtle);
  stroke: var(--warning-text);
}

.graph-node-dot.type-staff {
  fill: var(--success-bg);
  stroke: var(--success);
}

.graph-node-dot.type-role {
  fill: var(--panel-strong);
  stroke: var(--teal);
}

.graph-node-dot.type-work-product {
  fill: var(--info-bg);
  stroke: var(--info);
}

.graph-node-dot.type-review-step {
  fill: var(--warning-bg);
  stroke: var(--warning);
}

.graph-node-dot.type-escalation {
  fill: var(--danger-bg);
  stroke: var(--danger);
}

.graph-node-dot.type-locus {
  fill: var(--info-bg-subtle);
  stroke: var(--primary);
}

.graph-node-dot.type-allele {
  fill: var(--panel-strong);
  stroke: var(--teal);
}

.graph-node-dot.type-genotype {
  fill: var(--success-bg);
  stroke: var(--success);
}

.graph-node-dot.type-phenotype {
  fill: var(--warning-bg);
  stroke: var(--warning);
}

.graph-node-dot.type-inheritance-rule {
  fill: var(--danger-bg);
  stroke: var(--danger);
}

.graph-node.node-unmodeled .graph-node-dot {
  opacity: 0.5;
  stroke-dasharray: 3 2;
}

.graph-node:hover .graph-node-dot,
.graph-node.node-hover-related .graph-node-dot {
  stroke-width: 2.4;
}

.graph-node.node-selected .graph-node-dot {
  stroke-width: 3;
}

.graph-node.node-related .graph-node-dot {
  opacity: 1;
}

.workflow-builder {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: grid;
  gap: 10px;
  margin-top: 10px;
  min-height: 240px;
  padding: 12px;
}

.workflow-node {
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 10px;
}

.workflow-arrow {
  color: var(--muted);
  font-weight: 700;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.76rem;
  font-weight: 700;
  gap: 6px;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

input,
textarea,
select {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  min-width: 0;
  padding: 10px;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary-fill);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

button {
  border: 1px solid transparent;
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 10px 12px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.primary {
  background: var(--primary-fill);
  color: #ffffff;
}

.primary:hover {
  background: color-mix(in srgb, var(--primary-fill) 88%, black);
}

.secondary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.secondary:hover {
  background: var(--chip-bg);
}

.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.danger:hover {
  background: var(--danger-bg-subtle);
}

.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.ghost:hover {
  background: var(--chip-bg);
  color: var(--text);
}

.button-row,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-query-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.live-query-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 220px;
}

.live-query-row input {
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  color: var(--text);
  font-size: 14px;
}

.live-status-error {
  color: var(--danger);
}

.live-status-ok {
  color: var(--success);
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--primary-dark);
}

.compact button {
  padding: 8px 10px;
}

.note,
.muted,
.meta {
  color: var(--muted);
  line-height: 1.5;
}

.note {
  font-size: 0.87rem;
}

.empty,
.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  color: var(--muted);
  padding: 14px;
}

.workflow-tools {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 14px 0;
  padding: 12px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  background: var(--chip-bg);
  border: 1px solid transparent;
  color: var(--muted);
}

.filter-chip.active {
  background: var(--primary-fill);
  border-color: var(--primary-fill);
  color: #ffffff;
}

.submission-list {
  display: grid;
  gap: 10px;
  max-height: 68vh;
  overflow: auto;
}

.submission-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.submission-card:hover,
.submission-card.active {
  border-color: var(--primary);
}

.card-title {
  color: var(--text);
  margin-bottom: 6px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  background: var(--neutral-chip-bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--neutral-chip-text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
}

.recent-activity {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.detail-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-row {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
}

.detail-key {
  color: var(--label);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-value {
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.rule-health-panel,
.evidence-summary-panel,
.last-review,
.segregation-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 14px;
  padding: 14px;
}

.segregation-count-list {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.segregation-count-row {
  align-items: center;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  font-size: 0.86rem;
  gap: 8px;
  justify-content: space-between;
  padding: 8px 10px;
}

.segregation-count-row strong {
  color: var(--text);
}

.segregation-count-row .meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.segregation-add-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.segregation-add-row input {
  width: auto;
}

.segregation-add-row input[data-segregation-field="phenotypeLabel"] {
  flex: 1 1 180px;
}

.segregation-add-row input[data-segregation-field="count"] {
  flex: 0 1 90px;
}

.segregation-totals {
  font-size: 0.8rem;
  margin-top: 8px;
}

.segregation-totals.match {
  color: var(--success);
}

.segregation-totals.mismatch {
  color: var(--warning);
}

.section-title {
  color: var(--label);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

/* Collapsible sections — every .panel > .section-title is a toggle
   (wired in atlas-os.js's wireCollapsiblePanels); collapsing hides
   everything in the panel except its own title bar. */
.panel > .section-title {
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: -4px -4px 7px;
  padding: 4px;
}

.panel > .section-title:hover {
  color: var(--text);
}

.panel > .section-title:focus-visible {
  outline: 2px solid var(--primary-fill);
  outline-offset: 1px;
}

.panel > .section-title::after {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  content: "";
  display: inline-block;
  flex-shrink: 0;
  height: 6px;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  width: 6px;
}

.panel.collapsed > .section-title::after {
  transform: rotate(-45deg);
}

.panel.collapsed > *:not(.section-title) {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .panel > .section-title::after {
    transition: none;
  }
}

.section-subtitle {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.health-status {
  color: var(--primary-dark);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

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

.mini-grid div {
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  display: grid;
  gap: 2px;
  padding: 8px;
}

.mini-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.promotion-note {
  border-left: 3px solid var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
  padding-left: 8px;
}

.rule-supported {
  border-color: var(--success-border);
}

.rule-watch,
.rule-caution {
  border-color: var(--warning-border);
}

.rule-critical {
  border-color: var(--danger-border);
}

.last-review {
  border-color: var(--success-border);
}

.bird-card {
  display: grid;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.bird-card .meta {
  font-size: 0.76rem;
}

.bird-head {
  align-items: center;
  display: flex;
  gap: 10px;
}

.bird-avatar {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--primary);
  display: grid;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.hidden {
  display: none !important;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

.evidence-select-checkbox {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
}

.queue-card {
  position: relative;
}

.command-palette {
  background: transparent;
  border: 0;
  inset: 0;
  margin: auto;
  max-width: 760px;
  padding: 0;
  width: calc(100vw - 32px);
}

.command-palette::backdrop {
  background: rgba(3, 8, 17, 0.6);
}

.palette-shell {
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.palette-results {
  max-height: 50vh;
  overflow: auto;
}

.palette-result {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  padding: 10px;
  text-align: left;
}

.palette-result:hover {
  border-color: var(--border-strong);
}

.palette-result-selected {
  border-color: var(--primary);
}

.result-head {
  align-items: center;
  display: flex;
  gap: 8px;
}

.entity-icon {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--primary-dark);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 700;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.matrix {
  display: grid;
  gap: 8px;
}

.matrix-row {
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px;
}

.matrix-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.matrix-row strong {
  color: var(--primary-dark);
  font-size: 1.08rem;
}

.reasoning-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.reasoning-stages {
  display: grid;
  gap: 8px;
}

.reasoning-stage {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: grid;
  gap: 6px;
  padding: 8px;
}

.reasoning-stage > div:first-child {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.reasoning-stage.active {
  border-color: var(--teal);
}

.knowledge-card {
  cursor: pointer;
  text-align: left;
}

.project-card {
  cursor: pointer;
  text-align: left;
}

.task-card,
.advisor-card,
.project-card,
.knowledge-card,
.notification-item {
  text-align: left;
}

.pedigree-tree {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 36px 1fr 36px 1fr;
}

.pedigree-node {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: grid;
  gap: 4px;
  padding: 10px;
  text-align: center;
}

.pedigree-node strong {
  color: var(--primary-dark);
  font-size: 0.9rem;
}

.pedigree-node span {
  color: var(--muted);
  font-size: 0.72rem;
}

.pedigree-node.offspring {
  border-color: var(--success-border);
}

.pedigree-link {
  background: var(--border-strong);
  height: 2px;
}

.toast {
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  bottom: 18px;
  color: var(--text);
  max-width: min(400px, calc(100vw - 36px));
  padding: 12px;
  position: fixed;
  right: 18px;
  z-index: 30;
  box-shadow: var(--shadow);
}

.toast.bad {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.toast.ok {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.wrap {
  flex-wrap: wrap;
}

.review-center-layout {
  align-items: start;
}

.artifact-card,
.queue-card {
  cursor: pointer;
  text-align: left;
}

.active-artifact,
.pair-card-selected,
.bird-card-selected {
  border-color: var(--primary);
}

.bird-card-actions {
  margin-top: 8px;
}

.pair-card,
.project-card {
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: grid;
  gap: 8px;
}

.artifact-card-header,
.artifact-review-header,
.artifact-viewer-hero {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.artifact-viewer-hero {
  align-items: flex-start;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.artifact-image {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--primary-dark);
  display: inline-flex;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  height: 64px;
  justify-content: center;
  min-width: 64px;
}

.artifact-image-large {
  font-size: 1.8rem;
  height: 104px;
  min-width: 104px;
}

.artifact-detail-grid {
  margin-top: 12px;
}

.badge-success {
  background: var(--success-bg-subtle);
  border-color: var(--success-border);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg-subtle);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-bg-subtle);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.badge-info {
  background: var(--info-bg-subtle);
  border-color: var(--info-border);
  color: var(--info-text);
}

.artifact-review-header {
  margin-bottom: 12px;
}

.artifact-review-header .tiny-button {
  width: auto;
}

@media (max-width: 1400px) {
  .atlas-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .legacy-context-panel {
    display: none;
  }
}

@media (max-width: 1100px) {
  .layout,
  .triple-grid,
  .dual-grid,
  .chart-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .submission-list {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .atlas-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .atlas-sidebar {
    height: auto;
    position: static;
  }

  .atlas-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-category {
    border-left: none;
    border-bottom: 2px solid transparent;
  }

  .nav-category.active {
    border-bottom-color: var(--primary-fill);
    border-left-color: transparent;
  }
}

@media (max-width: 620px) {
  .child-tab-group {
    gap: 3px;
  }

  .button-row,
  .review-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

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

  .pedigree-tree {
    grid-template-columns: 1fr;
  }

  .pedigree-link {
    height: 20px;
    justify-self: center;
    width: 2px;
  }

  .artifact-card-header,
  .artifact-review-header,
  .artifact-viewer-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Phase XXI.1: full-app login gate — shown instead of .atlas-shell until a
   real operator session exists (or is confirmed still valid on return). */
.auth-gate {
  align-items: center;
  background: var(--bg-grid), var(--bg);
  display: flex;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: fixed;
  z-index: 40;
}

.auth-gate-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 420px;
}

.auth-gate-card .eyebrow {
  color: var(--primary);
}

.auth-gate-card h1 {
  margin: 4px 0 6px;
}

.auth-gate-tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  margin: 20px 0 16px;
}

.auth-gate-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  padding: 8px 4px 10px;
}

.auth-gate-tab.active {
  border-bottom-color: var(--primary);
  color: var(--text);
}

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

.auth-gate-form button[type="submit"] {
  margin-top: 4px;
}

/* Phase XXV: the universal Context Panel + Context Card. One slide-out,
   reused for every object type (researcher/investigation/publication/
   executive) — see Context Card Specification for the contract every
   card follows regardless of which entity it's showing. */
.context-panel-backdrop {
  background: rgba(3, 8, 17, 0.55);
  inset: 0;
  position: fixed;
  z-index: 44;
}

.context-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  inset: 0 0 0 auto;
  max-width: 92vw;
  overflow-y: auto;
  position: fixed;
  transform: translateX(100%);
  transition: transform 220ms ease;
  width: 440px;
  z-index: 45;
}

.context-panel.open {
  transform: translateX(0);
}

.context-panel-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
  position: sticky;
  top: 0;
  background: var(--panel);
}

.context-panel-header h3 {
  margin: 0;
}

.context-panel-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.context-card-identity {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.context-card-identity h4 {
  margin: 0;
}

.context-card-section {
  display: grid;
  gap: 6px;
}

.context-card-section-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-card-summary {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.5;
  padding: 12px 14px;
}

.context-card-meta-row {
  color: var(--muted);
  display: flex;
  font-size: 0.85rem;
  gap: 6px;
  justify-content: space-between;
}

.context-card-related-list {
  display: grid;
  gap: 8px;
}

.context-card-actions {
  display: flex;
  gap: 8px;
}

.context-ask-form {
  display: flex;
  gap: 8px;
}

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

.context-form-field {
  display: grid;
  gap: 4px;
}

.context-form-field span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-form-field textarea {
  font-family: inherit;
  resize: vertical;
  width: 100%;
}

.context-ask-form input {
  flex: 1;
}

.context-ask-log {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.context-ask-turn {
  border-radius: 4px;
  padding: 10px 12px;
}

.context-ask-turn.question {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
}

.context-ask-turn.answer {
  border: 1px solid var(--primary);
  background: var(--info-bg-subtle);
}

/* A clickable object that opens the Context Panel — used on Institute
   page investigation/publication list entries and elsewhere. Purely a
   cursor + subtle hover affordance; no layout change from a plain
   .timeline-item. */
[data-context-type] {
  cursor: pointer;
}

[data-context-type]:hover {
  border-color: var(--primary);
}

@media (max-width: 640px) {
  .context-panel {
    width: 100%;
  }
}

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