/* Popcorn — project list, project editor (data, parameters, signatures, region of interest, run) and the
   input widgets they use. Base tokens and components come from app.css. */

:root {
  /* overlay colors drawn on the H&E image (data colors, identical in both themes) */
  --roi-stroke: #0284c7;
  --roi-fill: rgba(2, 132, 199, 0.16);
  --roi-stroke-selected: #f59e0b;
  --roi-fill-selected: rgba(245, 158, 11, 0.2);
  --roi-draw: #16a34a;
  --roi-bins: rgba(20, 110, 160, 0.45);
}

.linklike {
  border: 0; background: none; padding: 0; margin: 0;
  color: var(--accent-text); font: inherit; text-decoration: underline; cursor: pointer;
}
.linklike:hover { color: var(--accent-hover); }
.center { text-align: center; }
kbd {
  font: 11.5px var(--mono); padding: 1px 5px; white-space: nowrap;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2);
}
.state { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; }
.state.ok, .tone-ok { color: var(--success); }
.state.bad, .tone-bad { color: var(--danger); }
.state.warn { color: var(--warning); }
.badge-unsaved { background: var(--warning-soft); color: var(--warning); }
.switch.busy { opacity: 0.6; }

/* ---------------------------------------------------------------- project list */
.projects-tools { margin-bottom: 14px; }
.projects-filter { max-width: 300px; }
.project-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
/* the whole card opens the project (card.clickable); its actions menu sits top right, revealed on hover or focus */
.project-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.pc-head { display: flex; align-items: flex-start; gap: 8px; }
.pc-name { flex: 1 1 auto; min-width: 0; font-size: 17px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.pc-name:hover { text-decoration: none; }
.project-card.clickable:hover .pc-name { color: var(--accent-text); }
.pc-head .badge { margin-top: 1px; }
.pc-menu { flex: 0 0 auto; margin: -4px -8px -4px 0; }
.pc-root { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-muted); font-size: 13.5px; }
.pc-root .truncate { flex: 1 1 auto; min-width: 0; }
.pc-meta { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 18px; margin: 2px 0 0; }
.pc-meta dt { color: var(--text-faint); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.pc-meta dd { margin: 2px 0 0; font-size: 14px; }
.pc-run { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-run:hover { text-decoration: none; }
.pc-run:hover .muted { color: var(--text); }
.intro-steps { margin-top: 4px; }
.intro-step { padding: 18px; }
.intro-step h3 { margin: 10px 0 6px; }
.intro-step p { margin: 0; }
.intro-icon {
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-text);
}
.demo-wait { display: flex; gap: 16px; align-items: flex-start; }
.demo-wait > .spinner { width: 26px; height: 26px; margin-top: 2px; color: var(--accent); }

/* ---------------------------------------------------------------- project header */
.project-head .titles { min-width: 0; }
.title-input {
  display: block; width: 100%; margin: 0 0 0 -7px; padding: 2px 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font: 650 22px/1.3 var(--font); letter-spacing: -0.01em;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); background: var(--surface); }
.title-input.invalid { border-color: var(--danger); }
.project-meta { font-size: 13.5px; }
/* the header's one control: the configuration check chip, which opens the check panel (.vpanel) below the header */
.vchip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 11px; border-radius: 15px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
  font: 600 12.5px var(--font); white-space: nowrap;
}
button.vchip { cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s; }
button.vchip:hover { border-color: currentColor; }
.vchip.bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.vchip.warn { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.vchip.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.vchip .spinner { width: 12px; height: 12px; border-width: 2px; }
.vchip-caret { opacity: 0.7; transition: transform 0.15s; }
.vchip[aria-expanded="true"] .vchip-caret { transform: rotate(180deg); }
.vpanel { margin-bottom: 16px; }
.vpanel .banner { margin-bottom: 0; }
.vpanel-foot { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.project-body { min-height: 240px; }
.unsaved-bar {
  position: sticky; bottom: 14px; z-index: 30; margin-top: 22px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px;
  background: var(--surface-2); color: var(--text); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
  border-left: 4px solid var(--warning); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.unsaved-bar > .icon { color: var(--warning); }

/* ---------------------------------------------------------------- chip inputs (chips.js) */
.chip-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 5px 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text;
}
.chip-input:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.chip-list { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; max-width: 100%; min-width: 0; }
.chip-input.is-empty .chip-list { display: none; }
/* a gene field with the genes of the data (chips.js geneCatalog): suggestions while typing, genes the data lacks */
.chip-field { min-width: 0; }
.chip-anchor { position: relative; }
.chip-suggest { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  max-height: 260px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.chip-suggest li { padding: 5px 8px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--mono, ui-monospace, monospace); font-size: 13.5px; color: var(--text); }
.chip-suggest li:hover, .chip-suggest li.active { background: var(--accent-soft); color: var(--accent-text); }
.chip-suggest li mark { background: none; color: var(--accent-text); font-weight: 700; }
.chip-suggest li.chip-suggest-empty { cursor: default; color: var(--text-muted); font-family: inherit; }
.chip-suggest li.chip-suggest-empty:hover { background: none; color: var(--text-muted); }
.chip-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: 13.5px; color: var(--danger); }
.chip-note svg { flex: none; margin-top: 2px; }
.gene-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip-entry {
  flex: 1 1 150px; min-width: 120px; height: 26px; padding: 0 4px;
  border: 0; outline: 0; background: transparent; color: var(--text); font: 12.5px var(--mono);
}
.chip .chip-text { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .swatch { width: 10px; height: 10px; flex-basis: 10px; }
.chip.flash { animation: chip-flash 0.7s ease-out; }
@keyframes chip-flash {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 50%, transparent); }
}
.chip-select { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.chip-select .chip-list { display: flex; }
.chip-select .chip { font-family: var(--font); }
.chip-add { width: auto; max-width: 100%; min-width: 200px; height: 30px; font-size: 13.5px; }
.chip-empty { color: var(--text-faint); font-size: 13.5px; padding: 2px 0; }

/* ---------------------------------------------------------------- folder picker */
.fp { display: flex; flex-direction: column; gap: 10px; }
.fp-note { margin: 0; }
.fp-bar { display: flex; gap: 8px; align-items: center; }
.fp-roots { width: auto; max-width: 130px; height: 30px; }
.fp-path { flex: 1 1 auto; }
.fp-path .input { height: 30px; }
.fp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13.5px; min-height: 24px; }
.fp-crumb { border: 0; background: none; padding: 2px 6px; border-radius: 4px; color: var(--accent-text); font: inherit; cursor: pointer; }
.fp-crumb:hover { background: var(--surface-2); }
.fp-crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.fp-sep { color: var(--text-faint); }
.fp-listwrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fp-filter { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; height: 32px; }
.fp-filter:focus { box-shadow: none; border-color: var(--accent); }
.fp-list { list-style: none; margin: 0; padding: 4px; min-height: 220px; max-height: 46vh; overflow: auto; transition: opacity 0.15s; }
.fp-list.busy { opacity: 0.5; }
.fp-entry {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.fp-entry:hover, .fp-entry:focus-visible { background: var(--accent-soft); }
.fp-entry > .icon:first-child { color: var(--accent-text); }
.fp-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-sr { background: var(--success-soft); color: var(--success); }
.fp-go { color: var(--text-faint); }
.fp-empty { padding: 24px 12px; color: var(--text-muted); text-align: center; }
.fp-status { font-size: 13.5px; color: var(--text-muted); }
.fp-message:empty { display: none; }
.fp-message .banner { margin-bottom: 0; }

/* ---------------------------------------------------------------- data tab */
.sample-table th, .sample-table td { padding: 6px 6px; vertical-align: middle; }
.sample-table th:first-child, .sample-table td:first-child { padding-left: 14px; }
.sample-table .input, .sample-table .select { height: 30px; font-size: 14px; padding: 0 8px; }
.sample-table .col-id { min-width: 132px; }
.sample-table .col-label { min-width: 110px; }
.sample-table .col-cond { min-width: 98px; }
.sample-table .col-path { min-width: 190px; width: 30%; }
.sample-table .col-path .btn { height: 30px; }
.sample-table .col-mpp { width: 112px; min-width: 104px; }
.sample-table .col-actions { width: 1%; padding-right: 10px; text-align: right; }
.sample-table input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); }
.sample-table tr.row-bad td { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.sample-table .sample-status { white-space: nowrap; }
.empty-row { padding: 20px 12px !important; color: var(--text-muted); text-align: center !important; }
.sample-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); }
.input.num { font-variant-numeric: tabular-nums; }
.report { display: flex; flex-direction: column; gap: 10px; }
.report .banner { margin-bottom: 0; }
.report-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.report-status .muted { font-weight: 400; }
.report-h { margin-top: 6px; }
.report p { margin: 0; }
.report-table td.mono { white-space: nowrap; }
.report-table .report-ref { margin-left: 6px; }
.report-table .report-label { font-family: var(--font); }
.report-cond { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.report-genes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.report-genes-title { font-weight: 600; }
/* the bin count of a section that was found: a quiet link into the Explore tab (its arrow shows on hover or focus) */
.sample-explore {
  margin: -2px -5px; padding: 2px 5px; border: 0; border-radius: 4px; background: none; cursor: pointer;
  font-family: var(--font); text-align: left;
}
.sample-explore:hover { background: var(--success-soft); text-decoration: underline; text-underline-offset: 2px; }
.sample-explore-go { opacity: 0; margin-left: -2px; transition: opacity 0.12s; }
.sample-explore:hover .sample-explore-go, .sample-explore:focus-visible .sample-explore-go { opacity: 0.8; }
@media (hover: none) { .sample-explore-go { opacity: 0.8; } }
.report-explore {
  display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 12px; font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius); background: var(--accent-soft);
}
.report-explore > .icon { color: var(--accent-text); }
.report-explore > span { flex: 1 1 260px; min-width: 0; }
.detect tr.known td { color: var(--text-muted); }
.detect-folder { font-weight: 600; cursor: pointer; margin-right: 6px; }
.detect input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------------------------------------------------------------- explore tab (components/data-explorer.js; the viewer's
   own rules are in run.css) */
.dx { display: flex; flex-direction: column; gap: 20px; }
.dx-table th, .dx-table td { vertical-align: middle; }
.dx-table th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.dx-table th.num { min-width: 64px; }
.dx-table td { white-space: nowrap; }
/* rows whose click shows something on the map (a section, a gene; rowAction() in data-explorer.js): the name is the
   row's button for the keyboard, plain text that takes the accent while the row is hovered */
.table tbody tr.dx-click { cursor: pointer; }
.table tbody tr.dx-click:hover td { background: var(--surface-2); }
.dx-row-btn {
  margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
tr.dx-click:hover .dx-row-btn, .dx-row-btn:focus-visible { color: var(--accent-text); }
.dx-table tbody tr.active td { background: color-mix(in srgb, var(--accent-soft) 75%, transparent); }
.dx-table tbody tr.active.dx-click:hover td { background: var(--accent-soft); }
.dx-table tbody tr.active td:first-child { box-shadow: inset 3px 0 0 var(--accent-text); }
.dx-table tr.row-bad td { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.dx-section { display: flex; align-items: center; gap: 8px; }
.dx-section-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.dx-section-label { font-weight: 600; }
.dx-row-msg { display: flex; align-items: center; gap: 8px; color: var(--text-muted); white-space: normal; }
.dx-row-msg > span:not(.spinner) { flex: 0 1 auto; min-width: 0; max-width: 760px; overflow-wrap: anywhere; }
.dx-row-msg.bad { color: var(--danger); }
.dx-row-msg .spinner { width: 14px; height: 14px; border-width: 2px; }
.dx-act { width: 1%; text-align: right; }
.dx-qc { margin: 0; font-size: 13.5px; color: var(--text-muted); }
/* the quality-control thresholds (they were in the Parameters tab) */
.dx-qc-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.dx-qc-title { flex: 0 0 100%; font-size: 13px; font-weight: 650; color: var(--text); }
.dx-qc-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.dx-qc-field .input { width: 130px; font-weight: 400; }
.dx-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--text-muted); }
.dx-notes li { display: flex; align-items: flex-start; gap: 6px; }
.dx-notes li > .icon { margin-top: 3px; color: var(--info); }
.dx .sv:not([data-layout="1"]) .sv-panel.dx-target {
  border-color: color-mix(in srgb, var(--accent-text) 70%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-text) 45%, transparent);
}
/* the jump to the gene table above the map: with four panels, and wherever the panels stack (below 760 px, run.css) */
.dx-jump { display: none; justify-content: flex-end; margin: -12px 0; }
.dx-jump[data-panels="4"] { display: flex; }
.dx-genes { scroll-margin-top: 16px; }
.dx-gene-bar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.dx-gene-bar .input { flex: 1 1 220px; max-width: 360px; }
.dx-gene-bar .muted { display: inline-flex; align-items: center; gap: 8px; }
.dx-gene-bar .spinner { width: 14px; height: 14px; border-width: 2px; }
.dx-gene-body { transition: opacity 0.12s; }
.dx-gene-body.busy { opacity: 0.6; }
.dx-gene-wrap { max-height: 480px; }
.dx-gene-table th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.dx-gene-table td { vertical-align: middle; white-space: nowrap; }
.dx-gene-table td.dx-gene { font-size: 13.5px; color: var(--text); }
/* the gene the highlighted panel is colored by */
.dx-gene-table tbody tr.dx-on-map td { background: color-mix(in srgb, var(--accent-soft) 75%, transparent); }
.dx-gene-table tbody tr.dx-on-map.dx-click:hover td { background: var(--accent-soft); }
.dx-gene-table tr.dx-on-map td.dx-gene { box-shadow: inset 3px 0 0 var(--accent-text); }
.dx-gene-table tr.dx-on-map .dx-gene-btn { color: var(--accent-text); font-weight: 600; }
/* the overlay toggle stays pressed-looking under the pointer */
.dx-act .btn.toggle[aria-pressed="true"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface-3)); color: var(--accent-text);
}
.dx-pct { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.dx-pct-track { position: relative; flex: 0 0 64px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.dx-pct-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-text); border-radius: 3px; }
.dx-pct-text { font-size: 13.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- parameters tab */
.pf-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 22px; align-items: start; }
/* the links to the cards, in groups labelled like the sidebar's; the column scrolls on its own in a short window */
.pf-nav {
  position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px;
  max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin;
}
.pf-nav-group { display: flex; flex-direction: column; min-width: 0; }
.pf-nav-label {
  padding: 0 0 6px 14px; color: var(--text-faint);
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
}
.pf-nav-list { display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--border); }
.pf-nav-item {
  margin-left: -1px; border: 0; border-left: 2px solid transparent; background: none; padding: 5px 10px 5px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; text-align: left; line-height: 1.35;
  color: var(--text-muted); font: 12.5px var(--font); cursor: pointer;
}
.pf-nav-item:hover { background: var(--surface-2); color: var(--text); border-left-color: var(--border-hover); }
.pf-nav-item[aria-current="location"] { color: var(--accent-text); border-left-color: var(--accent-text); }
/* an inset ring: the scrolling column would clip the usual outer one */
.pf-nav-item:focus-visible { box-shadow: inset 0 0 0 2px rgba(61, 124, 245, 0.55); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pf-cards { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pf-card { scroll-margin-top: 16px; }
.pf-grid { gap: 16px 22px; }
.pf-field.pf-wide { grid-column: 1 / -1; }
.pf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.pf-head > label { font-weight: 600; font-size: 14px; }
.pf-reset {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border: 0; border-radius: 4px;
  background: none; color: var(--accent-text); font: 12px var(--font); cursor: pointer; white-space: nowrap;
}
.pf-reset:hover { background: var(--accent-soft); }
.pf-steps { display: grid; gap: 10px 22px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.pf-panels { display: flex; flex-direction: column; gap: 12px; }
.pf-panel { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.pf-panel-head { display: flex; gap: 8px; align-items: center; }
.pf-panel-head .input { max-width: 420px; height: 30px; }
.pf-panel-head .row-actions { margin-left: auto; }
.pf-pairs .select { min-width: 150px; height: 30px; }
.pf-pairs td { vertical-align: middle; }

/* ---------------------------------------------------------------- signatures tab */
.sig-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.sig-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.sig-side .card-body { overflow: auto; min-height: 0; padding: 12px; }
.sig-filter { height: 30px; }
.sig-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sig-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.sig-item:hover { background: var(--surface-2); }
.sig-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.sig-item-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sig-item-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-item-key { font: 11.5px var(--mono); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-flag {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-muted); font: 700 11px var(--font);
}
.sig-item.active .sig-flag { background: var(--surface); }
.sig-count { min-width: 22px; text-align: right; font: 12px var(--mono); color: var(--text-muted); }
.sig-warn { color: var(--warning); }
.sig-empty { padding: 12px 8px; color: var(--text-muted); }
.sig-main { padding: 18px 20px; min-width: 0; }
.sig-editor { display: flex; flex-direction: column; gap: 16px; }
.sig-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.sig-head-swatch { width: 26px; height: 26px; flex-basis: 26px; border-radius: 7px; }
.sig-head-titles { flex: 1 1 auto; min-width: 0; }
.sig-flags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.sig-flags .help { margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.sig-genes-count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 9px; background: var(--surface-3);
  color: var(--text-muted); font-size: 12px; font-weight: 700; text-align: center; line-height: 18px;
}
.sig-notes { display: flex; flex-direction: column; gap: 6px; margin-top: -8px; }
.sig-notes:empty { display: none; }
.sig-notes .state { font-weight: 500; align-items: flex-start; }
.sig-notes .state .icon { margin-top: 2px; }
.sig-ex-rows, .panel-rows { display: flex; flex-direction: column; gap: 6px; }
.sig-ex-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.panel-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.sig-ex-row .input, .panel-row .input { height: 30px; }
.input.gene-missing { border-color: var(--danger); border-style: dashed; }
.order-col h3 { margin-bottom: 2px; }
.order-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.order-item { display: flex; align-items: center; gap: 8px; padding: 2px 6px; border-radius: var(--radius-sm); }
.order-item:hover { background: var(--surface-2); }
.order-n { width: 22px; text-align: right; color: var(--text-faint); font: 12px var(--mono); }
.order-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-label.bad { color: var(--danger); }
.order-col .select { height: 30px; max-width: 320px; }
.cls-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cls-row { display: flex; align-items: center; gap: 8px; }
.cls-row .cls-name { flex: 1 1 auto; min-width: 120px; height: 30px; }
.cls-row .switch { font-size: 13.5px; }
.sig-empty-actions { justify-content: center; }

/* ---------------------------------------------------------------- region of interest tab */
.roi-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.roi-main { overflow: hidden; display: flex; flex-direction: column; }
.roi-toolbar { gap: 12px; }
.roi-tool-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.roi-sample { width: auto; min-width: 170px; max-width: 280px; height: 30px; }
.roi-opacity { width: 110px; accent-color: var(--accent); }
.roi-zoom { gap: 2px; }
.roi-viewport {
  position: relative; overflow: hidden; height: clamp(420px, calc(100vh - 300px), 920px);
  background: var(--plot-bg); cursor: grab; touch-action: none; user-select: none; outline: none;
}
.roi-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 0; }
.roi-viewport[data-mode="draw"] { cursor: crosshair; }
.roi-viewport.over-handle { cursor: move; }
.roi-viewport.panning { cursor: grabbing; }
.roi-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.roi-img, .roi-bins, .roi-svg { position: absolute; left: 0; top: 0; pointer-events: none; user-select: none; }
.roi-img { max-width: none; display: block; }
.roi-svg { overflow: visible; }
.roi-poly { fill: var(--roi-fill); stroke: var(--roi-stroke); stroke-width: 2; vector-effect: non-scaling-stroke; fill-rule: evenodd; }
.roi-poly.selected { fill: var(--roi-fill-selected); stroke: var(--roi-stroke-selected); stroke-width: 2.5; }
.roi-handle { fill: #ffffff; stroke: var(--roi-stroke-selected); stroke-width: 2; vector-effect: non-scaling-stroke; }
.roi-draft { fill: none; stroke: var(--roi-draw); stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.roi-vertex { fill: var(--roi-draw); }
.roi-first { fill: #ffffff; stroke: var(--roi-draw); stroke-width: 2; vector-effect: non-scaling-stroke; }
.roi-first.snap { fill: var(--roi-draw); }
.roi-msg { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; background: var(--surface); cursor: default; }
.roi-msg .banner { max-width: 640px; }
.roi-note {
  position: absolute; left: 10px; right: 10px; top: 10px; z-index: 1; display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning);
  font-size: 13.5px; pointer-events: none; box-shadow: var(--shadow-sm);
}
.roi-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-muted); }
.roi-coords { white-space: nowrap; }
.roi-side .card-header { padding: 11px 14px; }
.roi-side .card-header h2 { font-size: 16px; }
.roi-side .card-body { padding: 12px 14px; }
.roi-side .banner { margin-bottom: 0; font-size: 13.5px; }
.roi-side p { margin: 0; }
.roi-polys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.roi-polys li { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--radius-sm); }
.roi-polys li.active { background: var(--accent-soft); }
.roi-polys li .muted { flex: 1 1 auto; min-width: 0; }
.roi-summary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.roi-summary li { display: flex; align-items: center; gap: 8px; }
.roi-keys { font-size: 13px; gap: 5px 10px; }
.roi-keys dd { color: var(--text-muted); }

/* ---------------------------------------------------------------- run tab */
.run-grid { align-items: start; }
.plan-samples, .plan-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.plan-samples li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-step { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.plan-step:not(.slow) { flex-wrap: nowrap; align-items: flex-start; }
.plan-step:not(.slow) > .icon { margin-top: 3px; }
.plan-step > span { min-width: 0; }
.plan-step > .icon { color: var(--success); }
.plan-step.off { color: var(--text-faint); }
.plan-step.off > .icon { color: var(--text-faint); }
.plan-step.slow { padding: 2px 0; }
.plan-det { padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-help { flex: 0 0 100%; padding-left: 44px; }
.plan-note { margin: 0; }
.start-btn { height: 40px; padding: 0 22px; font-size: 15.5px; }
.run-progress { display: flex; align-items: center; gap: 8px; }
.run-progress .progress { flex: 1 1 auto; min-width: 80px; }
/* "See all runs": a plain link in the card header, not a button */
.project-runs-link { display: inline-flex; align-items: center; gap: 3px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.project-runs-link .icon { opacity: 0.8; }
/* the rows of the project's runs open the run (the label is the link for the keyboard) */
.project-runs tbody tr.clickable:hover td { background: var(--surface-2); }

/* ---------------------------------------------------------------- narrow windows */
@media (max-width: 1180px) {
  .roi-layout { grid-template-columns: minmax(0, 1fr); }
  .roi-side { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .sig-layout { grid-template-columns: 250px minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .pf-layout { grid-template-columns: minmax(0, 1fr); }
  .pf-nav { display: none; }
  .sig-layout { grid-template-columns: minmax(0, 1fr); }
  .sig-side { position: static; max-height: none; }
  .sig-list { max-height: 260px; overflow: auto; }
  .sig-flags { grid-template-columns: minmax(0, 1fr); }
  .sig-ex-row, .panel-row { grid-template-columns: 120px minmax(0, 1fr) auto; }
  .project-head .actions { width: 100%; }
}
@media (max-width: 760px) {
  /* the gene table fits: no count of bins (the share stays, its title gives the count), no bar */
  .dx-jump { display: flex; }
  .dx-gene-table .dx-col-bins, .dx-pct-track { display: none; }
  .dx-pct { min-width: 0; }
}
