.lineage-graph {
  position: relative;
  --graph-stage-width: 140px;
  overflow: auto;
  padding: var(--space-1, 4px) 2px var(--space-2, 8px);
  color: var(--ink, #192c39);
  font-size: var(--text-xs, 12px);
  line-height: 1.4;
}
.lineage-graph__tree-anchor { flex: 0 0 var(--graph-stage-width); width: var(--graph-stage-width); min-height: 65px; position: relative; }
.lineage-graph__tree-anchor--root { flex-basis: 120px; width: 120px; }
.lineage-graph__tree-control { display: inline-flex; align-items: center; gap: 4px; }
.lineage-graph__tree-control > .lineage-graph__stage-choice { position: relative; top: auto; right: auto; }
.lineage-graph__tree { position: relative; width: max-content; min-width: 100%; }
/* Root/path rules below must not put a shared ancestor back into normal flow. */
.lineage-graph .lineage-graph__shared { position: absolute; z-index: 2; }
.lineage-graph__shared[hidden] { display: none; }
.lineage-graph__edges { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.lineage-graph__edges path { fill: none; stroke: #8ca6bd; stroke-width: 2; }

.lineage-graph__branch--tree > .lineage-graph__branch-heading,
.lineage-graph__branch--tree > .lineage-graph__results { margin-left: var(--branch-indent); margin-right: var(--branch-right); }
.lineage-graph__path--tree > *::before, .lineage-graph__path--tree .lineage-graph__workflow > *::before { display: none; }
.lineage-graph__sample {
  display: block;
  min-width: 0;
  padding: var(--space-2, 8px) 0;
  border-bottom: 1px solid var(--line, #ccd9e0);
}
.lineage-graph__root, .lineage-graph__stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid #aebfce;
  border-radius: var(--radius-sm, 4px);
  background: white;
}
.lineage-graph__root {
  flex: 0 0 120px;
  width: 120px;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  border-color: #426b97;
  background: #edf5fc;
}
.lineage-graph__stage-name { font-weight: 700; overflow-wrap: normal; max-width: 100%; }
.lineage-graph__identifier {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.lineage-graph__material { font-size: 12px; }
.lineage-graph__batch { max-width: 100%; overflow-wrap: anywhere; }
.lineage-graph__branches {
  min-width: 0;
  display: grid;
  gap: var(--space-2, 8px);
  position: relative;
}
.lineage-graph__observed > summary { cursor: pointer; padding: 6px 8px; font-weight: 700; list-style-position: inside; margin-left: var(--tree-prefix-indent, 0px); }
.lineage-graph__observed > .lineage-graph__branch { margin-top: 8px; }
.lineage-graph__branch {
  min-width: 0;
  position: relative;
  border-radius: var(--radius, 6px);
  padding: var(--space-1, 4px) 6px;
  border: 1px solid transparent;
  background: transparent;
  --branch-background: #f6faff;
  --branch-border: #90aecb;
}
/* The lane keeps ancestry alignment; its box covers only the branch-owned suffix. */
.lineage-graph__branch::before {
  content: ''; position: absolute; inset: 0 var(--branch-right, 0px) 0 max(0px, calc(var(--branch-indent, 0px) - 6px));
  border: 1px solid var(--branch-border); border-radius: inherit;
  background: var(--branch-background); pointer-events: none;
}
.lineage-graph__branch > * { position: relative; }
.lineage-graph__branch--excluded { --branch-background: #f3f4f5; --branch-border: #ccd2d8; }
.lineage-graph__branch--excluded .lineage-graph__path { color: var(--muted, #4e6472); }
.lineage-graph__toggle-cell { cursor: pointer; }
.lineage-graph__branch-heading, .lineage-graph__results {
  display: flex;
  align-items: center;
  gap: 4px 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.lineage-graph__choice, .lineage-graph__stage-choice { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; position: relative; cursor: pointer; }
.lineage-graph__choice { font-weight: 700; }
.lineage-graph__choice input, .lineage-graph__stage-choice input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent, #145d79); }
.lineage-graph__choice input:focus-visible, .lineage-graph__stage-choice input:focus-visible { outline: 2px solid var(--focus, #12678b); outline-offset: 2px; }
.lineage-graph__stage:has(.lineage-graph__stage-choice) { position: relative; }
.lineage-graph__stage:has(.lineage-graph__stage-choice) > .lineage-graph__stage-name { padding-right: 18px; }
.lineage-graph__stage-choice { position: absolute; right: 1px; top: 1px; }
/* Native checkbox semantics and names stay intact; hints also appear for keyboard focus. */
.lineage-graph [data-tooltip]::after {
  content: attr(data-tooltip); display: none; position: absolute; top: calc(100% + 2px); left: 0;
  z-index: 10; width: max-content; max-width: 200px; padding: 5px 8px;
  border-radius: var(--radius-sm, 4px); background: var(--header, #173a50); color: white;
  font-size: var(--text-xs, 12px); font-weight: 400; white-space: normal; pointer-events: none;
  box-shadow: 0 2px 6px #192c3926;
}
.lineage-graph [data-tooltip]:hover::after, .lineage-graph [data-tooltip]:focus-within::after { display: block; }
.lineage-graph__stage-choice[data-tooltip]::after { left: auto; right: 0; }
.lineage-graph__stage-choice { font-size: 12px; }
.lineage-graph__rerun-source { font-size: 12px; }
.lineage-graph__path { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 8px; width: max-content; }
/* Compact cells leave room for whole stage-label words and the Include checkbox. */
.lineage-graph__stage { flex: 0 0 var(--graph-stage-width); width: var(--graph-stage-width); box-sizing: border-box; overflow-wrap: anywhere; }
/* Accession keeps its root width even when it precedes a derived material root. */
.lineage-graph__stage[data-origin-stage="ACCESSION"] { flex-basis: 120px; width: 120px; }
.lineage-graph__stage-gap { flex: 0 0 var(--graph-stage-width); width: var(--graph-stage-width); }
.lineage-graph__path > *, .lineage-graph__workflow > * { position: relative; }
.lineage-graph__path > * + *::before, .lineage-graph__workflow > * + *::before {
  content: '';
  position: absolute;
  width: 12px;
  left: -12px;
  top: 50%;
  border-top: 2px solid #8ca6bd;
}
.lineage-graph__workflow {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
}
.lineage-graph__workflow > .lineage-graph__stage-gap::before {
  content: '';
  position: absolute;
  width: calc(100% + 12px);
  left: -12px;
  top: 50%;
  border-top: 2px solid #8ca6bd;
}
.lineage-graph__stage--predicted { border-style: dashed; background: transparent; }
.lineage-graph__stage--observed { border-color: #23777b; }
.lineage-graph__stage--pending { border-color: var(--status-pending, #6b4d00); }
.lineage-graph__stage--skipped { background: #f3f4f5; border-color: #ccd2d8; }
.lineage-graph__badge { font-size: var(--text-xs, 12px); border-radius: var(--radius-pill, 999px); padding: 1px 6px; white-space: normal; }
.lineage-graph__badge--observed, .lineage-graph__badge--complete, .lineage-graph__badge--published { background: var(--status-ready-bg, #dcfce7); color: var(--status-ready, #14532d); }
.lineage-graph__split, .lineage-graph__batch { background: var(--status-neutral-bg, #e5e8eb); color: var(--status-neutral, #374456); align-self: flex-start; }
.lineage-graph__badge--included { background: #d9eaff; color: #163f76; }
.lineage-graph__badge--assigned { background: var(--status-assigned-bg, #d9eaff); color: var(--status-assigned, #163f76); }
.lineage-graph__badge--skipped { background: var(--status-neutral-bg, #e5e8eb); color: var(--status-neutral, #374456); }
.lineage-graph__badge--excluded, .lineage-graph__badge--incomplete, .lineage-graph__badge--predicted { background: var(--status-neutral-bg, #e5e8eb); color: var(--status-neutral, #374456); }
.lineage-graph__badge--pending, .lineage-graph__badge--proposed { background: var(--status-pending-bg, #fdf0c9); color: var(--status-pending, #6b4d00); }
.lineage-graph__badge--held { background: #fce8d9; color: #704018; }
.lineage-graph__results { margin: 5px 0 0; }
.lineage-graph__empty { font-size: 15px; color: #526273; }
.lineage-graph__branch-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; font-weight: 700; }
.lineage-graph__delete-button, .lineage-graph__add-button { font: inherit; font-size: var(--text-xs, 12px); min-height: 24px; padding: 3px 7px; border: 1px solid var(--control-line, #8196a3); border-radius: var(--radius-sm, 4px); background: white; color: var(--accent, #145d79); cursor: pointer; justify-self: start; }
.lineage-graph__new-replicate { display: inline-flex; align-items: stretch; justify-self: start; max-width: 100%; margin-left: var(--tree-prefix-indent, 0px); }
.lineage-graph__new-replicate .lineage-graph__add-button { border-radius: var(--radius-sm, 4px) 0 0 var(--radius-sm, 4px); white-space: nowrap; }
.lineage-graph__replicate-start { font: inherit; font-size: var(--text-xs, 12px); min-height: 24px; width: auto; min-width: 0; max-width: 22rem; padding: 2px 4px; border: 1px solid var(--control-line, #8196a3); border-left: 0; border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0; background: white; color: inherit; }
.lineage-graph__delete-button { margin-left: auto; color: #9b2828; }
.lineage-graph__run-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.lineage-graph__results .readiness-value { max-width: 230px; }
.lineage-graph__results .contribution { padding: .4rem; border-left: 2px solid #94a3b8; }

.access-estimator__toolbar { display: flex; margin-bottom: .5rem; }
.access-estimator__toolbar .control { min-width: 16rem; }
.access-estimator__status, .access-estimator__error { margin: .5rem 0; }
.access-estimator__status:empty, .access-estimator__error:empty { display: none; }
.access-estimator__scroll { overflow-x: auto; }
.access-estimator__grid { border-collapse: collapse; width: 100%; font-size: var(--text-sm, 13px); }
.access-estimator__grid th, .access-estimator__grid td { text-align: left; vertical-align: top; padding: 6px var(--space-2, 8px); border: 1px solid var(--line, #ccd9e0); }
.access-estimator__lineage { min-width: 12rem; font-weight: 400; }
.access-estimator__nodes { list-style: none; padding: 0; margin: 0; }
.access-estimator__node { border-left: 3px solid #64748b; padding: .3rem .4rem; margin-bottom: .3rem; min-width: 8rem; }
.access-estimator__node[data-access="allow"] { border-color: var(--status-ready, #14532d); background: var(--status-ready-bg, #dcfce7); }
.access-estimator__node[data-access="deny"] { border-color: var(--status-error, #9b2828); background: var(--status-error-bg, #fff0ed); }
.access-estimator__decision { display: block; font-weight: 700; }
.access-estimator__node:focus-visible { outline: 2px solid var(--focus, #12678b); outline-offset: 2px; }

.lineage-graph__branch--failed { --branch-background: var(--status-neutral-bg, #f3f4f5); --branch-border: #ccd2d8; }
.lineage-graph__branch--failed .lineage-graph__path { color: var(--muted, #4e6472); opacity: .7; }
.lineage-graph__badge--failed { background: var(--status-neutral-bg, #e5e8eb); color: var(--status-neutral, #374456); }
.lineage-graph__badge--rejected { background: var(--status-error-bg, #fff0ed); color: var(--status-error, #9b2828); }
.lineage-graph__outcome-button { font: inherit; min-height: 28px; padding: 3px 7px; border: 1px solid var(--control-line, #8196a3); border-radius: var(--radius-sm, 4px); background: white; color: var(--accent, #145d79); cursor: pointer; }
.lineage-graph__outcome-button:disabled { cursor: wait; opacity: .6; }
.lineage-graph__outcome-button[hidden] { display: none; }
.lineage-graph__failure-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; width: 100%; }
.lineage-graph__failure-form label { display: grid; gap: 3px; width: min(100%, 360px); }
.lineage-graph__failure-form textarea { font: inherit; resize: vertical; }

.lineage-graph__badge--error { background: var(--status-error-bg, #fff0ed); color: var(--status-error, #9b2828); }
