/* ---------- map ---------- */
.studymap-host{ display: grid; gap: 0.6rem; }
.sm-panel{
  color: var(--ink);
  display: grid; gap: 0.45rem; padding: 0.65rem 0.7rem;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-sunk);
}
.sm-row{ display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sm-row label{ font-size: var(--fs-meta); color: var(--muted); }
.sm-primary{ justify-content: space-between; }
.sm-primary label{ font-size: var(--fs-micro);  color: var(--muted); }
.sm-primary select{ font-size: var(--fs-body); font-weight: 560; }
.sm-panel select{
  flex: 1 1 9rem; min-width: 8rem; padding: 0.32rem 0.45rem;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); font: inherit; font-size: var(--fs-meta); color: var(--ink-soft);
}
.sm-check label{ display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--fs-meta); }
.sm-actions{ justify-content: space-between; }
.sm-panel button{
  padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); font: inherit; font-size: var(--fs-meta); color: var(--ink-soft); cursor: pointer;
}
.sm-panel button:hover{ border-color: var(--accent-line); }
.sm-count{ font-size: var(--fs-meta); color: var(--muted); }
.sm-frame{ border: 1px solid var(--line); border-radius: 10px; background: var(--panel-sunk); overflow: visible; }
.sm-frame svg{ border-radius: 9px; }
.sm-frame svg{ display: block; width: 100%; height: auto; cursor: grab; }
.sm-frame svg:active{ cursor: grabbing; }
.sm-legend{ display: grid; gap: 0.3rem; }
.sm-legend-title{ font-size: var(--fs-micro); color: var(--body); }
.sm-legend-bar{ height: 8px; border-radius: 4px; border: 1px solid var(--line); }
.sm-legend-ticks{ display: flex; justify-content: space-between; font-size: var(--fs-micro); color: var(--faint); }
.sm-legend-cats{ display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; }
.sm-cat{ display: inline-flex; align-items: center; gap: 0.3rem; font-size: var(--fs-micro); color: var(--body); }
.sm-cat i, .sm-legend-missing i{ width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.sm-legend-missing{ font-size: var(--fs-micro); color: var(--faint); display: inline-flex; align-items: center; gap: 0.3rem; }
.sm-detail{ border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 0.6rem 0.7rem; }
.sm-detail-head{ display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-meta); margin-bottom: 0.4rem; color: var(--ink); }
.sm-close{ border: 0; background: none; font-size: 1.05rem; line-height: 1; color: var(--faint); cursor: pointer; }
.sm-detail dl{ margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 0.8rem; }
.sm-detail dl > div{ display: grid; grid-template-columns: 6.2rem 1fr; gap: 0.3rem; }
.sm-detail dt{ font-size: var(--fs-micro); color: var(--faint); }
.sm-detail dd{ margin: 0; font-size: var(--fs-micro); color: var(--ink-soft); }
/* map layout: plot and legend on the left, controls on the right */
.studymap-host{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "plot" "legend" "detail";
  gap: 0.55rem;
  align-items: start;
}
.sm-plot{ grid-area: plot; }
.sm-legendbox{ grid-area: legend; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-sunk); padding: 0.55rem 0.65rem; }
.sm-controls{ grid-area: controls; align-content: start; }
.sm-detail{ grid-area: detail; }
.sm-controls .sm-row{ display: grid; gap: 0.22rem; }
.sm-controls .sm-primary{ gap: 0.22rem; }
.sm-controls select{ width: 100%; font-size: var(--fs-micro); }
.sm-controls .sm-check label{ display: inline-flex; gap: 0.35rem; }
.sm-controls .sm-actions{ display: flex; gap: 0.4rem; align-items: center; justify-content: space-between; }
.sm-legendbox .sm-legend-title{ font-size: var(--fs-micro); }
.sm-legendbox .sm-legend-ticks{ font-size: var(--fs-micro); }
@media (max-width: 720px){
  .studymap-host { grid-template-columns: 1fr; grid-template-areas: "plot" "legend" "controls" "detail"; }
}
/* filter controls */
.sm-field{ display: grid; gap: 0.3rem; }
.sm-field > label, .sm-field-head span{
  font-size: var(--fs-micro);  color: var(--muted);
}
.sm-field-head{ display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.sm-add, .sm-allnone button{
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--ink-soft); font: inherit; font-size: var(--fs-micro); padding: 0.15rem 0.4rem; cursor: pointer;
}
.sm-add:hover{ border-color: var(--accent-line); color: var(--accent); }
.sm-addmenu{
  list-style: none; margin: 0.2rem 0 0; padding: 0.25rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  box-shadow: 0 4px 10px var(--shadow-soft);
  max-height: 12rem; overflow: auto;
}
.sm-addmenu li button{
  display: block; width: 100%; text-align: left; border: 0; background: none;
  font: inherit; font-size: var(--fs-meta); color: var(--ink-soft); padding: 0.25rem 0.35rem;
  border-radius: 5px; cursor: pointer;
}
.sm-addmenu li button:hover{ background: var(--chip); color: var(--accent); }
.sm-addmenu .sm-empty{ font-size: var(--fs-micro); color: var(--faint); padding: 0.25rem 0.35rem; }
.sm-filter{ border-top: 1px solid var(--line-soft); padding-top: 0.4rem; margin-top: 0.4rem; }
.sm-filter:first-child{ border-top: 0; margin-top: 0.2rem; padding-top: 0; }
.sm-filter-head{
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-micro); color: var(--ink-soft); margin-bottom: 0.3rem;
}
.sm-rm{
  border: 0; background: none; color: var(--faint); font-size: 0.95rem; line-height: 1;
  cursor: pointer; padding: 0 0.15rem;
}
.sm-rm:hover{ color: var(--accent); }
.sm-cats{ display: grid; gap: 0.15rem; }
.sm-catbox{ display: flex; align-items: center; gap: 0.3rem; font-size: var(--fs-micro); color: var(--body); }
.sm-catbox input{ accent-color: var(--accent); }
.sm-allnone{ display: flex; gap: 0.3rem; margin-top: 0.3rem; }
.sm-range{ display: grid; gap: 0.1rem; }
.sm-range input[type="range"]{ width: 100%; accent-color: var(--accent); margin: 0; }
.sm-range-val{ font-size: var(--fs-micro); color: var(--muted); font-variant-numeric: tabular-nums; }
/* dual-handle range: one bar, a grip at each end */
.sm-slider{ display: grid; gap: 0.3rem; }
.sm-slider-vals{
  display: flex; justify-content: space-between;
  font-size: var(--fs-micro); color: var(--muted); font-variant-numeric: tabular-nums;
}
.sm-slider-track{
  position: relative; height: 18px; margin: 0 4px;
  border-radius: 9px; background: var(--chip); border: 1px solid var(--line);
  touch-action: none;
}
.sm-slider-fill{
  position: absolute; top: 0; bottom: 0;
  background: var(--accent-bg); border-radius: 9px;
  border: 1px solid var(--accent-line);
}
.sm-handle{
  position: absolute; top: 50%; width: 13px; height: 13px; padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid var(--accent-line);
  background: var(--accent); box-shadow: 0 1px 2px var(--shadow-strong);
  cursor: ew-resize; touch-action: none;
}
.sm-handle:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
/* settings popover over the plot */
.sm-frame{ position: relative; overflow: visible; }
.sm-gear{
  min-width: 32px; min-height: 32px;
  position: absolute; top: 8px; right: 8px; z-index: 6;
  width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); color: var(--muted); cursor: pointer;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-strong) 72%, transparent);
}
.sm-gear:hover{ color: var(--accent); border-color: var(--accent-line); }
.sm-gear svg{ width: 15px; height: 15px; }
.sm-controls{
  position: absolute; top: 40px; right: 8px; z-index: 7;
  width: 13.5rem; max-height: 26rem; overflow: auto;
  display: none; gap: 0.5rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow-strong) 88%, transparent);
}
.sm-controls.open{ display: grid; }
/* pipeline (horizontal) and QC (full width) */
.pipeline-card, .qc-card{ margin-top: 1rem; }
.qc-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.55rem; }
.qc-metric{
  display: grid; gap: 0.1rem; padding: 0.55rem 0.6rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-sunk);
  animation: wf-in 340ms cubic-bezier(.2,.7,.3,1) backwards;
}
.qc-metric:nth-child(1){ animation-delay: 40ms; }
.qc-metric:nth-child(2){ animation-delay: 90ms; }
.qc-metric:nth-child(3){ animation-delay: 140ms; }
.qc-metric:nth-child(4){ animation-delay: 190ms; }
.qc-metric:nth-child(5){ animation-delay: 240ms; }
.qc-metric:nth-child(6){ animation-delay: 290ms; }
.qc-val{ font-size: 1.2rem; font-weight: 620; color: var(--ink); font-variant-numeric: tabular-nums; }
.qc-lab{ font-size: var(--fs-meta); color: var(--ink-soft); }
.qc-note{ font-size: var(--fs-micro); color: var(--muted); line-height: 1.35; }
.qc-foot{ margin: 0.55rem 0 0; font-size: var(--fs-micro); color: var(--faint); line-height: 1.45; }
/* QC visuals */
.qc-visuals{
  display: grid; grid-template-columns: 1fr 1fr minmax(12rem, 0.85fr);
  gap: 0.55rem; margin-top: 0.55rem;
}
.qc-fig{
  margin: 0; padding: 0.5rem 0.6rem 0.45rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-sunk);
  display: grid; gap: 0.25rem;
}
.qc-fig figcaption{ display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.qc-fig figcaption span{ font-size: var(--fs-meta); color: var(--ink-soft); font-weight: 560; }
.qc-fig figcaption em{ font-style: normal; font-size: var(--fs-micro); color: var(--muted); }
.qc-fig svg{ width: 100%; height: auto; display: block; }
.qc-fig--bar{ align-content: start; }
.qc-cover{
  position: relative; height: 10px; margin: 0.55rem 0 0.3rem;
  border: 1px solid var(--line); border-radius: 5px; background: var(--panel); overflow: hidden;
}
.qc-cover-fill{ position: absolute; inset: 0 auto 0 0; background: var(--accent); opacity: 0.75; }
.qc-cover-legend{ display: flex; justify-content: space-between; font-size: var(--fs-micro); color: var(--muted); }
@media (max-width: 860px){
  .qc-visuals { grid-template-columns: 1fr; }
}
.dw-tabs{
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  border-bottom: 1px solid var(--line); margin-bottom: 0.75rem;
}
.dw-tab{ white-space: nowrap;
  padding: 0.32rem 0.6rem; border: 1px solid transparent; border-bottom: 0;
  border-radius: 7px 7px 0 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-meta); color: var(--muted);
}
.dw-tab:hover{ color: var(--accent); }
.dw-tab[aria-selected="true"]{
  background: var(--panel-sunk); border-color: var(--line);
  color: var(--accent); font-weight: 600; margin-bottom: -1px;
}
.dw-panel[hidden]{ display: none; }
.dw-panel-body{ display: grid; gap: 0.6rem; }
.dw-charts{ display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.5rem; }
.dw-fig{
  margin: 0; padding: 0.45rem 0.5rem 0.35rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-sunk);
}
.dw-fig svg{ width: 100%; height: auto; display: block; }
.dw-fig--wide{ padding: 0.6rem 0.7rem; }
.dw-table{ width: 100%; border-collapse: collapse; font-size: var(--fs-micro); }
.dw-table th, .dw-table td{ text-align: right; padding: 0.28rem 0.4rem; border-top: 1px solid var(--line-soft); }
.dw-table th:first-child, .dw-table td:first-child{ text-align: left; }
.dw-table th{ color: var(--muted); font-weight: 560; border-top: 0; }
.dw-table td{ color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dw-note{ margin: 0; font-size: var(--fs-micro); color: var(--muted); line-height: 1.5; }
.dw-legend{ display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; font-size: var(--fs-micro); color: var(--body); }
.dw-swatch{ display: inline-flex; align-items: center; gap: 0.3rem; }
.dw-swatch i{ width: 8px; height: 8px; border-radius: 2px; }
.dw-claims{ margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; font-size: var(--fs-meta); color: var(--body); }
.dw-claims a{ color: var(--accent); text-decoration: none; }
.dw-claims a:hover{ text-decoration: underline; }
.dw-chip{
  font-size: var(--fs-micro); padding: 0.1rem 0.4rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--chip); white-space: nowrap;
}
.dw-yes{ border-color: var(--yes-line); background: var(--yes-bg); color: var(--yes-ink); }
.dw-partial{ border-color: var(--partial-line); background: var(--partial-bg); color: var(--partial-ink); }
.dw-no{ border-color: var(--line); background: var(--chip); color: var(--muted); }
/* interactive downstream controls */
.dw-controls{
  display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; align-items: center;
  padding: 0.5rem 0.6rem; margin-bottom: 0.55rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-sunk);
}
.dw-controls label{ display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--fs-micro); color: var(--muted); }
.dw-controls select{
  font: inherit; font-size: var(--fs-micro); padding: 0.14rem 0.3rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink-soft);
}
.dw-controls .dw-check{ gap: 0.3rem; }
.dw-controls input[type="checkbox"]{ accent-color: var(--accent); }
.dw-chart{ position: relative; }
.dw-chart-head{ font-size: var(--fs-meta); color: var(--ink-soft); margin-bottom: 0.2rem; }
.dw-chart svg{ width: 100%; height: auto; display: block; }
.dw-tip{
  position: absolute; z-index: 8; pointer-events: none;
  padding: 0.28rem 0.4rem; border-radius: 6px;
  background: var(--tip-bg); color: var(--tip-ink);
  font-size: var(--fs-micro); line-height: 1.35; white-space: nowrap;
  box-shadow: 0 3px 10px var(--shadow-tip);
}
.dw-read{ margin-top: 0.55rem; display: grid; gap: 0.28rem; }
.dw-read-row{ margin: 0; font-size: var(--fs-meta); color: var(--body); line-height: 1.5; display: grid; grid-template-columns: 6.4rem 1fr; gap: 0.5rem; }
.dw-read-k{ font-size: var(--fs-micro); color: var(--faint);  padding-top: 0.15rem; }
.dw-row-on td{ background: var(--accent-bg); color: var(--accent); }
.dw-table-wrap{ overflow-x: auto; }
.dw-drivers{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
/* ---------- downstream: stat chips, legends, tables, accordion ---------- */
.dw-stat-grid{
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7.4rem, 1fr));
  gap: 0.35rem; margin: 0.5rem 0 0.2rem;
}
.dw-stat{
  display: grid; gap: 0.05rem; padding: 0.34rem 0.45rem;
  border: 1px solid var(--line-soft); border-radius: 7px; background: var(--panel-sunk);
}
.dw-stat span{ font-size: var(--fs-micro); color: var(--muted); letter-spacing: 0.02em; }
.dw-stat b{ font-size: var(--fs-body); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.dw-stats > p{ margin: 0.3rem 0 0; }
.dw-legend-host{ display: grid; gap: 0.25rem; margin: 0.35rem 0 0.1rem; }
.dw-legend i{ display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 0.32rem; vertical-align: -1px; }
.dw-shp{ display: inline-block; width: 8px; height: 8px; margin-right: 0.32rem; background: var(--muted); }
.dw-shp-circle{ border-radius: 50%; }
.dw-shp-square{ border-radius: 1px; }
.dw-shp-triangle{ width: 0; height: 0; background: none; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 8px solid var(--muted); }
.dw-shp-diamond{ transform: rotate(45deg); }
.dw-shp-cross{ background: none; border-top: 1.6px solid var(--muted); transform: rotate(45deg); height: 0; }
.dw-scroll-y{ max-height: 640px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 8px; padding: 0.2rem; }
.dw-scroll-y svg{ width: 100%; height: auto; }
.dw-controls select option{ color: var(--option-ink); background: var(--option-bg); }
.dw-controls .dw-dim{ opacity: 0.45; }
.dw-colpick{ align-items: flex-start; }
.dw-colpick .dw-check{ font-size: 0.68rem; }
.dw-table-block{ margin: 0.7rem 0 0.2rem; }
.dw-table-head{
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem;
  font-size: var(--fs-meta); color: var(--ink-soft); margin-bottom: 0.25rem;
}
.dw-table-scroll{ max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.dw-tax-table{ font-size: 0.7rem; width: auto; min-width: 100%; }
.dw-tax-table td{ white-space: nowrap; }
.dw-tax-table thead th{
  position: sticky; top: 0; z-index: 2; background: var(--panel);
  border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.dw-tax-table thead th:hover{ color: var(--accent); }
.dw-tax-table tbody tr{ cursor: pointer; }
.dw-tax-table tbody tr:hover td{ background: var(--accent-bg); }
.dw-tax-table tbody tr.is-sel td{ background: var(--accent-bg); color: var(--ink); }
.dw-tax-table td.taxon{ text-align: left; font-style: italic; }
.dw-tax-table th:first-child{ text-align: left; }
.dw-detail{ position: relative; margin-top: 0.7rem; padding: 0.6rem 0.7rem; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--panel-sunk); }
.dw-detail-head{ display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.dw-detail-head b{ font-size: var(--fs-meta); color: var(--ink); }
.dw-detail-head span{ font-size: var(--fs-micro); color: var(--faint); }
.dw-close{ margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; line-height: 1; }
.dw-detail-groups{ display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.5rem 1.1rem; margin-top: 0.5rem; }
.dw-dgroup h4{ margin: 0 0 0.2rem; font-size: var(--fs-micro);  color: var(--faint); font-weight: 600; }
.dw-detail-dl{ display: grid; gap: 0.12rem; margin: 0; }
.dw-detail-dl > div{ display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; font-size: var(--fs-micro); }
.dw-detail-dl dt{ color: var(--muted); }
.dw-detail-dl dd{ margin: 0; color: var(--ink-soft); font-variant-numeric: tabular-nums; text-align: right; }
/* accordion */
.dw-acc-list{ display: grid; gap: 0.4rem; margin-top: 0.5rem; }
.dw-acc{ border: 1px solid var(--line); border-radius: 8px; background: var(--panel-sunk); overflow: hidden; }
.dw-acc > summary{
  display: flex; align-items: center; gap: 0.6rem; cursor: pointer;
  padding: 0.55rem 0.7rem; list-style: none;
}
.dw-acc > summary::-webkit-details-marker{ display: none; }
.dw-acc > summary:hover{ background: var(--accent-bg); }
.dw-acc-rank{ font-size: var(--fs-micro); color: var(--faint); font-variant-numeric: tabular-nums; min-width: 1rem; }
.dw-acc-title{ flex: 1; font-size: var(--fs-meta); font-weight: 600; color: var(--ink); }
.dw-acc-plus{ font-size: 1rem; color: var(--muted); transition: transform 140ms ease; }
.dw-acc[open] .dw-acc-plus{ transform: rotate(45deg); }
.dw-acc-body{ padding: 0 0.7rem 0.7rem; display: grid; gap: 0.35rem; }
.dw-acc:not([open]) > .dw-acc-body{ display: none; }
.dw-acc-body p{ margin: 0; font-size: var(--fs-meta); color: var(--body); line-height: 1.55; }
.dw-acc-body .dw-acc-work{ color: var(--ink-soft); }
.dw-acc-body .dw-acc-limit{ font-size: var(--fs-micro); color: var(--muted); }
.dw-acc-plot{ margin-top: 0.25rem; }
.dw-acc-plot .dw-chart{ max-width: 34rem; }
/* sankey inside the QC card */
.qc-flow{ margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--line-soft); }
.qc-flow-head{ display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.2rem; }
.qc-flow-head h3{ margin: 0; font-size: var(--fs-meta); font-weight: 600; color: var(--ink); }
.qc-flow-head span{ font-size: var(--fs-micro); color: var(--faint); }
.qc-flow svg{ width: 100%; height: auto; display: block; }
@media (max-width: 640px){
  .dw-stat-grid { grid-template-columns: repeat(auto-fit, minmax(6.2rem, 1fr)); }
  .dw-read-row { grid-template-columns: 1fr; gap: 0.1rem; }
  .dw-table-scroll { max-height: 260px; }
}
/* ---------- QC explorer ---------- */
.qc-explorer{ margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--line-soft); }
.qc-tabs{ display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.55rem; }
.qc-tab{
  min-height: 32px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: var(--fs-micro); padding: 0.3rem 0.7rem;
  cursor: pointer; transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.qc-tab:hover{ color: var(--ink); border-color: var(--accent-line); transform: translateY(-1px); }
.qc-tab[aria-selected="true"]{ background: var(--accent-bg); color: var(--accent); border-color: var(--accent-line); }
.qc-ctrls{
  display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; align-items: center;
  padding: 0.4rem 0.55rem; margin-bottom: 0.5rem; min-height: 2rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-sunk);
}
.qc-ctrls label{ display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--fs-micro); color: var(--muted); }
.qc-ctrls select, .qc-ctrls input[type="range"]{ font: inherit; font-size: var(--fs-micro); }
.qc-ctrls select{ padding: 0.14rem 0.3rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink-soft); }
.qc-ctrls b{ color: var(--ink); font-weight: 600; }
.qc-plot{ position: relative; }
.qc-plot svg{ width: 100%; height: auto; display: block; }
.qc-explain{ margin: 0.45rem 0 0; font-size: var(--fs-micro); color: var(--muted); line-height: 1.55; max-width: 68ch; }
.qc-enter{ animation: qc-in 320ms cubic-bezier(.2,.7,.3,1) both; }
@keyframes qc-in{ from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* ---------- sample table ---------- */
.st-toolbar{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.st-search input{
  width: 20rem; max-width: 60vw; font: inherit; font-size: var(--fs-micro);
  padding: 0.36rem 0.6rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-sunk); color: var(--ink); transition: border-color 140ms ease, box-shadow 140ms ease;
}
.st-search input:focus{ outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.st-actions{ display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.st-btn{
  font: inherit; font-size: var(--fs-micro); padding: 0.34rem 0.65rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink-soft);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}
.st-btn:hover{ border-color: var(--accent-line); color: var(--ink); background: var(--accent-bg); transform: translateY(-1px); }
.st-check{ display: inline-flex; align-items: center; gap: 0.3rem; font-size: var(--fs-micro); color: var(--muted); }
.st-panel{ position: relative; }
.st-colpanel{
  color: var(--ink);
  position: absolute; z-index: 12; top: 2.4rem; right: 0; width: min(42rem, 92vw);
  max-height: 24rem; overflow: auto; padding: 0.6rem 0.7rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  box-shadow: 0 16px 40px var(--shadow-panel);
}
.st-colhead{ display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; font-size: var(--fs-micro); color: var(--muted); }
.st-link{ border: 0; background: none; color: var(--accent); font: inherit; font-size: var(--fs-micro); cursor: pointer; padding: 0 0.3rem; }
.st-colgroup h4{ margin: 0.4rem 0 0.2rem; font-size: var(--fs-micro);  color: var(--faint); }
.st-collist{ display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.1rem 0.8rem; }
.st-collist label{ display: flex; align-items: center; gap: 0.3rem; font-size: var(--fs-micro); color: var(--ink-soft); }
.st-scroll{ max-height: 34rem; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.st-table{ width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.7rem; table-layout: fixed; }
.st-table th, .st-table td{ text-align: left; padding: 0.32rem 0.45rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; overflow: hidden; }
.st-table thead th{
  position: sticky; top: 0; z-index: 3; background: var(--panel); color: var(--muted);
  font-weight: 560; white-space: nowrap; user-select: none; cursor: pointer;
}
.st-table thead th:hover{ color: var(--accent); }
.st-table .st-th-label{ display: inline-block; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-resize{ display: inline-block; width: 7px; height: 0.95em; margin-left: 4px; vertical-align: -1px; border-left: 1px solid var(--line); cursor: col-resize; }
.st-table th{ position: sticky; top: 0; }
.st-table thead th{ position: sticky; }
.st-table .st-filters th{ position: sticky; top: 2rem; z-index: 2; background: var(--panel-sunk); padding: 0.2rem 0.25rem; }
.st-table .st-filters input{ width: 100%; font: inherit; font-size: 0.66rem; padding: 0.16rem 0.3rem; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink-soft); }
.st-table tbody tr{ transition: background 100ms ease; }
.st-table tbody tr:hover td{ background: var(--accent-bg); }
.st-table td{ color: var(--ink-soft); white-space: normal; word-break: break-word; }
.st-table.is-nowrap td{ white-space: nowrap; text-overflow: ellipsis; }
.st-table .st-id{ color: var(--ink); font-weight: 560; }
.st-info{ margin: 0.4rem 0 0; font-size: var(--fs-micro); color: var(--faint); }
.dw-tab{ white-space: nowrap; transition: background 140ms ease, color 140ms ease; }
@media (prefers-reduced-motion: reduce){
  .qc-enter { animation: none; }
  * { transition: none !important; }
}
.st-pager{ display: flex; align-items: center; gap: 0.5rem; margin-top: 0.45rem; font-size: var(--fs-micro); color: var(--muted); }
.st-pager .st-btn[disabled]{ color: var(--faint); background: var(--panel-sunk); border-color: var(--line-soft); cursor: not-allowed; transform: none; }
.st-pageinfo{ color: var(--faint); }
/* reserve space so late-rendered blocks do not shift the page */
#study-map{ min-height: 320px; }
.qc-plot{ min-height: 280px; }
.dw-chart{ min-height: 200px; }
.dw-panels{ min-height: 420px; }
.st-panel{ min-height: 260px; }
.dw-stat:hover{ border-color: var(--accent-line); background: var(--accent-bg); }
.dw-stat{ transition: background 140ms ease, border-color 140ms ease, transform 140ms ease; }
.dw-stat:hover{ transform: translateY(-1px); }
.qc-plot svg rect, .qc-plot svg circle, .dw-chart svg rect, .dw-chart svg circle, #sankey rect, #sankey path{
  transition: opacity 120ms ease, filter 120ms ease;
}
.qc-plot svg rect:hover, .qc-plot svg circle:hover,
.dw-chart svg rect:hover, .dw-chart svg circle:hover,
#sankey rect:hover{ filter: brightness(1.35); }
.st-table thead th:focus-visible{ outline-offset: -2px; }
.st-table tbody tr:hover td{ background: var(--accent-bg); }
.st-collist label{ transition: color 120ms ease; }
.st-collist label:hover{ color: var(--ink); }
.dw-legend span{ transition: color 120ms ease; }
.dw-legend span:hover{ color: var(--ink); }
@keyframes rise-in{
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.st-btn:active, .qc-tab:active, .dw-tab:active, .af-link:active, .pub-jump:active{ transform: translateY(0) scale(0.985); }
.st-btn, .qc-tab, .dw-tab, .af-link{ transition-timing-function: var(--ease-out); }
.dw-close{ min-width: 32px; min-height: 32px; }
.dw-tab{ min-height: 32px; }
.dw-controls select, .dw-controls input[type="text"], .dw-controls input[type="search"],
.qc-ctrls select, .st-search input, .st-btn{ min-height: 32px; }