/* Hallmark · genre: editorial · macrostructure: Workbench (one screen: the study on the left, the
 * questions on the right) · theme: studied-DNA (source: game-of-life/styles.css) · paper
 * oklch(97.4% 0.007 75) · accent oklch(63.5% 0.19 38) · display Instrument Serif · body Geist ·
 * enrichment: none · nav: N9 edge-aligned · footer: data band · pre-emit critique: P5 H4 E4 S5 R5 V4 */

/* Base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Scroll bars: narrow, a rounded warm gray thumb with no track, the accent while dragged. Chrome,
 * Edge and Safari draw them from the ::-webkit-scrollbar rules (which Chrome drops for an element
 * given scrollbar-width or scrollbar-color, so those two are kept for Firefox, which has only them). */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
  ::-webkit-scrollbar-button { display: none; }
  ::-webkit-scrollbar-thumb { min-height: 32px; border: 2.5px solid transparent; border-radius: 999px; background: var(--color-scroll) padding-box; }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--color-scroll-hover); }
  ::-webkit-scrollbar-thumb:active { background-color: var(--color-accent); }
}
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; }
  :root { scrollbar-color: var(--color-scroll) transparent; }
}

html { overflow-x: clip; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font: 400 var(--text-base) / 1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-style: normal;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  min-width: 0;
}

p, ol, ul { margin: 0; }
p { text-wrap: pretty; }
b { font-weight: 600; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.note { color: var(--color-muted); font-size: var(--text-sm); }

/* Controls: an ink pill for the one primary action, quiet pills and underlined links for the rest */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0 1.2rem;
  border: 1px solid var(--color-ink);
  border-radius: 999px;
  background: var(--color-ink);
  color: var(--color-paper);
  font: 500 var(--text-base) / 1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.btn:hover { background: var(--color-ink-hover); border-color: var(--color-ink-hover); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn--quiet { background: transparent; color: var(--color-ink); border-color: var(--color-rule); }
.btn--quiet:hover { background: var(--color-paper-2); border-color: var(--color-faint); }
.btn--sm { min-height: 2.1rem; padding: 0 0.95rem; font-size: var(--text-sm); }
.btn--icon { width: 2.5rem; padding: 0; }
.btn--icon svg { width: 1.1rem; height: 1.1rem; }
.btn--sm.btn--icon { width: 2.1rem; }
.btn--sm.btn--icon svg { width: 1rem; height: 1rem; }

.link {
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: 500 var(--text-sm) / 1.4 var(--font-body);
  text-decoration: underline;
  text-decoration-color: var(--color-rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  white-space: nowrap;
  cursor: pointer;
  transition: text-decoration-color var(--dur-short) var(--ease-out);
}

.link:hover { text-decoration-color: var(--color-accent); }
.link:disabled { color: var(--color-faint); text-decoration-color: transparent; cursor: not-allowed; }

/* Page frame */

.app { display: grid; grid-template-rows: auto auto auto auto; min-height: 100dvh; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-lg);
  padding: var(--space-sm) var(--gutter);
  border-bottom: 1px solid var(--color-rule);
}

.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; white-space: nowrap; }
.brand__mark { width: 1rem; height: 1rem; }
.brand__mark .ink { fill: var(--color-ink); }
.brand__mark .hi { fill: var(--color-accent); }

.tagline { order: 3; flex-basis: 100%; font-size: var(--text-title); }
.top__actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-left: auto; }
.new__icon { display: none; width: 1.15rem; height: 1.15rem; }
@media (max-width: 30rem) {
  /* Phones: the brand and the buttons share one line; New study shows its plus (its name stays for
   * screen readers) and the buttons come down a little, still above the 2rem touch floor */
  .top { column-gap: var(--space-sm); }
  .top__actions { gap: 0.35rem; }
  .top__actions .btn { width: 2.25rem; min-height: 2.25rem; padding: 0; }
  #newBtn .new__icon { display: block; }
  #newBtn .new__label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.work { display: grid; min-height: 0; }

/* The projects column: every project and its studies. A drawer on phones; on wide screens a
   column left of the files that folds to a rail. */

.side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: min(20rem, 86vw);
  background: var(--color-paper);
  border-right: 1px solid var(--color-rule);
  box-shadow: var(--shadow-sheet);
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform var(--dur-long) var(--ease-out), visibility 0s linear var(--dur-long);
}

[data-side="open"] .side { transform: none; visibility: visible; transition: transform var(--dur-long) var(--ease-out); }
.side__scrim { position: fixed; inset: 0; z-index: 19; padding: 0; border: 0; background: var(--color-scrim); }

.side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  min-height: 3.35rem;
  padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--gutter);
  border-bottom: 1px solid var(--color-rule);
}

.side__title { font-size: var(--text-title); }

.side__toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}

.side__toggle:hover { color: var(--color-ink); border-color: var(--color-faint); }
.side__toggle svg { width: 1rem; height: 1rem; transition: transform var(--dur-short) var(--ease-out); }
[data-side="closed"] .side__toggle svg { transform: rotate(180deg); }

.side__body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; justify-items: start; gap: var(--space-md); padding: var(--space-md) var(--gutter) var(--space-lg); }
.side__body > * { width: 100%; }
.side__body > .link { width: auto; }
.side__note, .side__empty { color: var(--color-faint); font-size: var(--text-xs); }

.side__input {
  width: 100%;
  min-height: 2.1rem;
  padding: 0 0.65rem;
  border: 1px solid var(--color-rule);
  border-radius: 8px;
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: 400 var(--text-sm) / 1 var(--font-body);
}

.side__input::placeholder { color: var(--color-faint); }
.side__input:hover { border-color: var(--color-faint); }
.side__input:focus-visible { outline-offset: 0; }

.tree { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); }
.tree__proj { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }

.tree__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
  list-style: none;
  font: 400 1.15rem / 1.2 var(--font-display);
  cursor: pointer;
}

.tree__head::-webkit-details-marker { display: none; }
.tree__head::before {
  content: "";
  flex: none;
  width: 0.4rem;
  height: 0.4rem;
  margin: 0 0.1rem 0 0.15rem;
  border-right: 1.5px solid var(--color-faint);
  border-bottom: 1.5px solid var(--color-faint);
  transform: rotate(-45deg);
  transition: transform var(--dur-short) var(--ease-out);
}

.tree__proj[open] > .tree__head::before { transform: rotate(45deg); }
.tree__proj.is-current > .tree__head .tree__name { text-decoration: underline 2px var(--color-accent); text-underline-offset: 0.22em; }
.tree__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree__count { flex: none; color: var(--color-faint); font: 500 var(--text-xs) / 1 var(--font-body); font-variant-numeric: tabular-nums; }
.tree__studies { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; }

.tree__study {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
  min-height: 2.1rem;
  padding: 0 0.6rem 0 1.1rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  font: 500 var(--text-sm) / 1.2 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}

.tree__study:hover { background: var(--color-paper-2); color: var(--color-ink); }
.tree__study[aria-current="true"] { background: var(--color-accent-soft); color: var(--color-accent-ink); }
.tree__study[aria-current="true"] .tree__count { color: inherit; }
.tree__study.is-excluded .tree__name { text-decoration: line-through; text-decoration-color: var(--color-faint); color: var(--color-faint); }
.tree__row { display: flex; align-items: center; gap: 2px; }
.tree__row .tree__study { flex: 1; min-width: 0; }

/* Delete: out of the way until the row is pointed at or focused; armed, it says so in the accent */
.tree__del, .entry__del {
  flex: none;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-faint);
  font: 500 var(--text-xs) / 1 var(--font-body);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}

.tree__del:hover, .entry__del:hover { background: var(--color-paper-2); color: var(--color-ink); }
.tree__row:hover .tree__del, .tree__head:hover .tree__del, .entry__head:hover .entry__del, .entry.is-active .entry__del,
.tree__del:focus-visible, .entry__del:focus-visible, .tree__del.is-armed, .entry__del.is-armed { opacity: 1; }
.tree__del.is-armed, .entry__del.is-armed, .file__close.is-armed, .link--danger.is-armed { color: var(--color-accent-ink); }
.entry__del { align-self: center; margin-left: -0.35rem; }
.file__close.is-armed { width: auto; padding: 0 0.45rem; border-radius: 999px; font-size: var(--text-xs); }
.tree__add { padding: 2px 0 0 1.1rem; }
.tree__tools { display: grid; justify-items: start; gap: 0.1rem; padding: 0.4rem 0 0 1.1rem; }
.tree__tools:empty { display: none; }
.tree__tools .link { font-size: var(--text-xs); }
.tree__note { color: var(--color-muted); font-size: var(--text-xs); }
.tree__note.is-warn { color: var(--color-accent-ink); }
.tree__add .side__input { min-height: 1.9rem; background: transparent; border-style: dashed; }

/* The study: file tabs, the desk, the pages */

.viewer {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 64dvh;
  min-height: 22rem;
  background: var(--color-desk);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  padding: var(--space-xs) var(--gutter);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-paper);
}

/* Every file's tab stays in sight: tabs that do not fit wrap to a second line, and past two lines
 * the strip scrolls down (a few files share the row with the tools; many take a row of their own) */
.files {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  max-height: calc(2 * 1.9rem + 2px + 6px);
  padding: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-paper-2);
  border-radius: calc(0.95rem + 3px);
}

.tabs::-webkit-scrollbar { display: none; }
/* The list of a study's files names the open one in full: it takes the room the row has */
.file-jump { flex: 1 1 auto; min-width: 0; max-width: 100%; min-height: 2.25rem; padding: 0 2rem 0 0.9rem; border: 1px solid var(--color-rule); border-radius: 999px; background: var(--color-paper); color: var(--color-ink); font: 500 var(--text-md) / 1.2 var(--font-body); text-overflow: ellipsis; cursor: pointer; }
.tools:has(> .file-jump:not([hidden])) > .tools__spacer { display: none; }
@media (max-width: 30rem) {
  /* Phones, two files or more: the list stands for the tabs, with a × for the open file, on one line;
   * Add file, the page and the zoom share the next */
  .tools:has(> .file-drop:not([hidden])) > .files { display: none; }
  .tools:has(> .file-drop:not([hidden])) > .file-jump { order: -2; flex: 1 1 calc(100% - 2.6rem); }
  .tools:has(> .file-drop:not([hidden])) > .file-drop { order: -1; flex: none; align-self: center; }
  .tools:has(> .file-drop:not([hidden])) > .tools__spacer { display: block; }
}
.file-jump:hover { border-color: var(--color-faint); }
.file-jump:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.files:empty { display: none; }

.file { display: flex; align-items: center; flex: none; border-radius: 999px; transition: background-color var(--dur-short) var(--ease-out); }
.file:has(.file__open[aria-pressed="true"]) { background: var(--color-paper); box-shadow: var(--shadow-whisper); }

.file__open {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.9rem;
  padding: 0 0.4rem 0 0.75rem;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font: 500 var(--text-sm) / 1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}

.file__open:hover, .file__open[aria-pressed="true"] { color: var(--color-ink); }
.file__name { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; }

.key {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 4px;
  background: var(--color-ink);
  color: var(--color-paper);
  font: 600 0.6875rem / 1 var(--font-body);
}

.file__close {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-faint);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.file__close:hover { background: var(--color-paper-2); color: var(--color-ink); }

.tools__spacer { flex: 1; }

/* The reference an imported study came from, under its file tabs */
.viewer:has(> .cite:not([hidden])) { grid-template-rows: auto auto minmax(0, 1fr); }
.cite { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem var(--space-sm); min-width: 0; padding: 0.3rem var(--gutter); border-bottom: 1px solid var(--color-rule); background: var(--color-paper); color: var(--color-muted); font-size: var(--text-xs); }
.cite__text { flex: 1 1 12rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite .link { font-size: var(--text-xs); }
.cite__flag { padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 600; text-decoration: none; }
.cite__flag.is-retracted { background: var(--color-accent); color: var(--color-paper); }
.cite__flag.is-concern { background: var(--color-accent-soft); color: var(--color-accent-ink); }
.cite__flag.is-note { background: var(--color-paper-2); color: var(--color-muted); }
.tree__study.is-flagged .tree__name, .grid__study.is-flagged { color: var(--color-accent-ink); }
.tree__study.is-flagged .tree__name::after, .grid__study.is-flagged::after { content: " ⚠"; }
.checks__list { display: grid; gap: 0.2rem; padding-left: 1.1rem; font-size: var(--text-sm); color: var(--color-ink); }
.checks__list:empty { display: none; }
.cite { justify-content: flex-end; }
.cite__tools { display: flex; gap: 0.25rem; margin-left: auto; }
.cite__tool { width: 1.7rem; height: 1.7rem; }
.cite__tool.has-note { border-color: var(--color-accent); color: var(--color-accent-ink); }
.cite__tool[aria-expanded="true"] { background: var(--color-paper-2); color: var(--color-ink); }
.tree__icons { display: flex; gap: 0.3rem; }
.cite__excluded { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--color-accent-soft); color: var(--color-accent-ink); font-weight: 500; }
.cite__form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.cite__form .side__input { width: min(18rem, 60vw); min-height: 1.9rem; }
.cite__abstract { flex-basis: 100%; max-height: 12rem; overflow: auto; padding: 0.4rem 0.6rem; border-left: 2px solid var(--color-rule); color: var(--color-ink); font-size: var(--text-sm); line-height: 1.5; }
.cite__note { flex-basis: 100%; min-height: 3.2rem; padding: 0.4rem 0.6rem; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper-2); color: var(--color-ink); font: 400 var(--text-sm) / 1.4 var(--font-body); resize: vertical; }
.page-no { color: var(--color-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }

.zoom { display: flex; gap: 2px; padding: 3px; background: var(--color-paper-2); border-radius: 999px; flex: none; }

.zoom button {
  min-width: 1.9rem;
  min-height: 1.9rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  font: 500 var(--text-sm) / 1 var(--font-body);
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}

.zoom button:hover { background: var(--color-paper); color: var(--color-ink); }

.pages { position: relative; overflow: auto; overscroll-behavior: contain; padding: var(--space-md); }
.doc { position: relative; }

.page { position: relative; margin: 0 auto var(--space-md); background: var(--color-pdf-page); box-shadow: var(--shadow-page); --scale-round-x: 1px; --scale-round-y: 1px; }
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.page .hl { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: multiply; }
.page .textLayer { z-index: 2; }
/* The PDF's own links, over its text: a reader's pointer, a thin accent line on hover */
.page .links { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.links__a { position: absolute; pointer-events: auto; border-radius: 2px; cursor: pointer; }
.links__a:hover { box-shadow: inset 0 -2px 0 var(--color-accent); }
.links__a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
/* What a link within the file points to (a cited reference), over the page, above later pages */
.refpop { position: absolute; z-index: 10; pointer-events: auto; display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); color: var(--color-ink); box-shadow: var(--shadow-sheet); font: 400 var(--text-sm) / 1.5 var(--font-body); overflow-wrap: anywhere; }
.refpop__text { max-height: 12rem; overflow-y: auto; }
.refpop__acts { display: flex; justify-content: flex-end; }
.mark { position: absolute; border-radius: 2px; background: var(--color-mark); }
.mark.focus { background: var(--color-mark-focus); }

/* Any file but a PDF, set on a sheet; a slide deck marks where each slide starts */

.textdoc {
  max-width: 44rem;
  margin: 0 auto var(--space-md);
  padding: clamp(1.25rem, 4vw, 3rem);
  background: var(--color-sheet);
  box-shadow: var(--shadow-page);
  font-size: calc(var(--text-base) * var(--zoom, 1));
  line-height: 1.6;
}

.textdoc h3 { margin: 1.2em 0 0.4em; font-size: 1.45em; }
.textdoc h3:first-child { margin-top: 0; }
.textdoc p + p { margin-top: 0.65em; }

.textdoc .row { display: flex; flex-wrap: wrap; border-top: 1px solid var(--color-rule); font-size: 0.92em; line-height: 1.45; font-variant-numeric: tabular-nums; }
.textdoc .row + p, .textdoc .row + h3 { margin-top: 1em; }
.textdoc .row .seg { display: flex; flex-wrap: wrap; width: 100%; }
.textdoc .cell { flex: 1 1 7rem; min-width: 0; padding: 0.3rem 0.6rem 0.3rem 0; overflow-wrap: anywhere; }

.textdoc .textdoc__at {
  margin: 2em 0 0.6em;
  padding-top: 0.5em;
  border-top: 1px solid var(--color-rule);
  color: var(--color-faint);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.textdoc .textdoc__at:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.textdoc .textdoc__at + h3 { margin-top: 0; }

.seg { border-radius: 2px; transition: background-color var(--dur-short) var(--ease-out); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.seg.mark { position: static; background: var(--color-mark-text); }
.seg.mark.focus { background: var(--color-mark-text-focus); }

/* Empty desk */

/* The welcome sits on the desk, where the pages go, never over the tools: while no file is open
 * the tools have nothing to act on and step aside, and on phones the desk grows to hold it */
.pages, .empty { grid-row: -2; grid-column: 1; }
.empty {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: center;
  align-content: safe center;
  gap: var(--space-md);
  padding: var(--space-xl) var(--gutter);
  max-width: 40rem;
}
.viewer:has(> .empty:not([hidden])) > .tools { display: none; }
.viewer:has(> .empty:not([hidden])) { height: auto; }

.empty h2 { font-size: var(--text-display); }
.empty p { max-width: 34rem; color: var(--color-muted); }
.empty__actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.viewer.dragging { outline: 2px dashed var(--color-accent); outline-offset: -6px; }

/* The questions */

.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--color-paper); }

/* The open study's citation, in full, over its questions */
.citation { display: grid; gap: 0.35rem; padding: var(--space-sm) var(--gutter); border-bottom: 1px solid var(--color-rule); background: var(--color-paper-2); font-size: var(--text-sm); line-height: 1.45; }
.citation__text { color: var(--color-ink); overflow-wrap: anywhere; }
.citation__label { color: var(--color-muted); font-size: var(--text-xs); }
.citation__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem var(--space-md); }
.citation__acts .link { font-size: var(--text-xs); }
.citation__form { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.citation__form .side__input { flex: 1 1 14rem; min-width: 0; background: var(--color-paper); }
.ask { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-lg) var(--gutter) var(--space-md); border-bottom: 1px solid var(--color-rule); }
.ask__row { display: flex; align-items: flex-end; gap: var(--space-xs); }

.ask__input {
  flex: 1;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0 0.1em 0.15rem;
  border: 0;
  border-bottom: 2px solid var(--color-rule);
  border-radius: 0;
  background: transparent;
  color: var(--color-ink);
  font: 400 var(--text-md) / 1.3 var(--font-body);
  transition: border-color var(--dur-short) var(--ease-out);
}

.ask__input::placeholder { color: var(--color-faint); }
.ask__input:hover, .ask__input:focus-visible { border-bottom-color: var(--color-accent); }
.ask__input:focus-visible { outline: none; }

.mic[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-paper); }
.theme-toggle .moon { display: none; }
.theme-toggle[aria-pressed="true"] .sun { display: none; }
.theme-toggle[aria-pressed="true"] .moon { display: block; }
.heard { min-height: 1.3em; color: var(--color-muted); font-size: var(--text-sm); }
.heard .interim { font-style: italic; }

.batch { display: grid; gap: 0.15rem; }
.batch__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem var(--space-md); }
.batch__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-left: auto; }
.tool-link { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 1.85rem; padding: 0 0.7rem 0 0.5rem; border: 1px solid var(--color-rule); border-radius: 999px; background: var(--color-paper); color: var(--color-ink); font: 500 var(--text-sm) / 1 var(--font-body); cursor: pointer; }
.tool-link:hover { border-color: var(--color-faint); }
.tool-link svg { width: 0.95rem; height: 0.95rem; flex: none; }
.batch.has-list .tool-link { width: 1.85rem; padding: 0; justify-content: center; color: var(--color-muted); }
.batch.has-list .tool-link span { display: none; }
/* Before there is a list there is nothing to ask: the row is only the ways to get one */
.batch:not(.has-list) :is(#askLabel, #runBtn, #runAllBtn) { display: none; }
.batch:not(.has-list) .batch__tools { margin-left: 0; }
.ex__tool:disabled { opacity: 0.4; cursor: default; }
.batch__label { min-width: 4.6rem; color: var(--color-faint); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; }

/* The project's questions, to check what "Run" will ask */
.qlist { color: var(--color-muted); font-size: var(--text-sm); }
.qlist summary { width: fit-content; cursor: pointer; }
.qlist ol { display: grid; gap: 0.2rem; max-height: 12rem; margin: var(--space-xs) 0 var(--space-2xs); padding-left: 1.4rem; overflow: auto; overscroll-behavior: contain; }
/* Each listed question: its id, its wording (press to change it), and up, down and remove */
.qlist__q { display: flex; align-items: baseline; gap: 0.35rem; }
.qlist__id { flex: none; color: var(--color-faint); font-size: var(--text-xs); }
.qlist__text { flex: 1; min-width: 0; padding: 0.1rem 0.2rem; border: 0; border-radius: 4px; background: none; color: var(--color-muted); font: inherit; text-align: left; cursor: text; }
.qlist__text:hover { background: var(--color-paper-2); color: var(--color-ink); }
.qlist__input { flex: 1; min-width: 0; padding: 0.15rem 0.35rem; border: 1px solid var(--color-focus); border-radius: 4px; background: var(--color-paper); color: var(--color-ink); font: inherit; }
.qlist__tools { display: flex; flex: none; }
.qlist__tool { min-width: 1.5rem; height: 1.5rem; padding: 0 0.3rem; border: 0; border-radius: 999px; background: transparent; color: var(--color-faint); font: 500 var(--text-xs) / 1 var(--font-body); cursor: pointer; }
.qlist__tool:hover:not(:disabled) { background: var(--color-paper-2); color: var(--color-ink); }
.qlist__tool:disabled { opacity: 0.3; cursor: default; }
.qlist__data { white-space: nowrap; }
.sheet .entry__guide, .entry__guide { margin-top: -0.2rem; padding-left: 0.6rem; border-left: 2px solid var(--color-rule); color: var(--color-muted); font-size: var(--text-xs); line-height: 1.45; }
.qlist__data.is-on { background: var(--color-accent-soft); color: var(--color-accent-ink); }

/* Outcome data: a small grid of the study's arms by the numbers the outcome needs */
.arms { display: grid; gap: 0.35rem; justify-items: start; }
.arms__wrap { max-width: 100%; overflow-x: auto; }
.arms__grid { border-collapse: collapse; font-size: var(--text-sm); }
.arms__grid th { padding: 0 0.3rem 0.2rem 0; color: var(--color-muted); font-weight: 500; font-size: var(--text-xs); text-align: left; }
.arms__grid td { padding: 0.15rem 0.3rem 0.15rem 0; }
.arms__grid tbody th { padding: 0.15rem 0.3rem 0.15rem 0; }
.arms__name, .arms__cell { min-height: 2rem; padding: 0.25rem 0.45rem; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); color: var(--color-ink); font: 400 var(--text-sm) / 1.3 var(--font-body); }
.arms__name { width: 8rem; }
.arms__cell { width: 4.2rem; font-variant-numeric: tabular-nums; }
.arms__name:focus-visible, .arms__cell:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.qlist__tool.is-armed { color: var(--color-accent-ink); }
.status { padding: var(--space-xs) var(--gutter); color: var(--color-muted); font-size: var(--text-sm); border-bottom: 1px solid var(--color-rule); }
.status.error { color: var(--color-accent-ink); }

/* How far the checking has gone, and a switch to leave only what is left to check */
.progress { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2xs) var(--space-md); padding: var(--space-2xs) var(--gutter); border-bottom: 1px solid var(--color-rule); color: var(--color-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.progress .link[aria-pressed="true"] { text-decoration-color: var(--color-accent); }
#nextStudy { margin-left: auto; color: var(--color-accent-ink); }
.tree__count.is-done { color: var(--color-check-ink); font-weight: 600; }
.keys summary { width: fit-content; color: var(--color-muted); cursor: pointer; }
.keys p { margin-top: var(--space-xs); }
kbd { padding: 0.05em 0.4em; border: 1px solid var(--color-rule); border-bottom-width: 2px; border-radius: 4px; background: var(--color-paper-2); color: var(--color-ink); font: 500 0.85em / 1.4 var(--font-body); }


.results { display: grid; align-content: start; padding: var(--space-xs) var(--gutter) var(--space-xl); }
.hint { display: grid; gap: var(--space-sm); max-width: 34rem; padding: var(--space-md) 0; color: var(--color-muted); }
.hint__steps { display: grid; gap: var(--space-xs); padding-left: 1.2rem; }
.hint__steps b { color: var(--color-ink); }

/* One asked question: the question, its verdict, where Jev looked, and the quotes */

.entry {
  display: grid;
  gap: var(--space-xs);
  margin-inline: calc(var(--space-sm) * -1);
  padding: var(--space-md) var(--space-sm);
  border-top: 1px solid var(--color-rule);
  border-radius: 0;
  transition: background-color var(--dur-short) var(--ease-out);
}

.entry:first-child { border-top: 0; }
.entry.is-checked .entry__q { color: var(--color-muted); }
.entry.is-checked .entry__id::before { content: "✓ "; color: var(--color-check); font-weight: 700; }
.entry--find .entry__id { color: var(--color-accent-ink); }
.entry.is-active { overflow: clip; background: var(--color-paper-2); border-radius: var(--radius); border-top-color: transparent; } /* clip: rounds the question's corners, and is no scroll box, so it still sticks */
.entry.is-active + .entry { border-top-color: transparent; }

/* The question stays in view while its quotes scroll by, until the next question takes its place */
.entry__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin: calc(var(--space-2xs) * -1) calc(var(--space-sm) * -1) 0;
  padding: var(--space-2xs) var(--space-sm);
  background: var(--color-paper);
  cursor: pointer;
}

.entry.is-active .entry__head { background: var(--color-paper-2); }
.entry__q { flex: 1; font-size: var(--text-question); line-height: 1.2; }
.entry__id { margin-right: 0.35em; color: var(--color-faint); font: 500 var(--text-xs) / 1 var(--font-body); letter-spacing: 0.02em; vertical-align: 0.2em; }

.verdict {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font: 500 var(--text-xs) / 1 var(--font-body);
  white-space: nowrap;
}

.verdict b { font-weight: 600; }
.verdict[data-v="reported"] { background: var(--color-accent-soft); color: var(--color-accent-ink); }
.verdict[data-v="unclear"] { background: var(--color-paper); color: var(--color-muted); box-shadow: inset 0 0 0 1px var(--color-rule); }
.verdict[data-v="not found"] { color: var(--color-faint); box-shadow: inset 0 0 0 1px var(--color-rule); }
.verdict[data-v="busy"] { color: var(--color-muted); }

.spin {
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--color-rule);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spots { display: flex; gap: 0.4rem; align-items: center; }
.spots__doc { display: flex; flex: 1; gap: 2px; align-items: center; min-width: 0; }
.spots__doc .key { width: 0.95rem; height: 0.95rem; margin-right: 0.2rem; font-size: 0.5625rem; }

.spot {
  flex: 1 1 0;
  min-width: 3px;
  height: 0.45rem;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: color-mix(in oklch, var(--color-accent) calc(var(--h, 0) * 100%), var(--color-rule));
  cursor: pointer;
}

.spot::before { content: ""; display: block; height: 1.4rem; margin-top: -0.5rem; }

.excerpts { list-style: none; padding: 0; display: grid; gap: 2px; }

.ex {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out);
}

.ex:hover { background: var(--color-paper); }
.entry:not(.is-active) .ex:hover { background: var(--color-paper-2); }
.ex.is-focus { background: var(--color-accent-soft); }
.ex.is-final, .entry:not(.is-active) .ex.is-final:hover { background: var(--color-check-soft); box-shadow: inset 3px 0 0 var(--color-check); }
.ex--closest { opacity: 0.8; }
.ex--stale { opacity: 0.55; }

.ex__meta { display: flex; align-items: center; gap: 0.4rem; min-width: 0; color: var(--color-muted); font-size: var(--text-xs); }
.ex__where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex__score { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-ink); }
.ex__text { white-space: pre-line; overflow-wrap: anywhere; }

/* Check, edit and copy: three small round buttons at the end of each quote's place line */
.excerpts li { position: relative; --tools: 2.4rem; }
.excerpts li:has(.ex__check) { --tools: 6.6rem; }
.ex__meta { padding-right: var(--tools); }
.ex__tools { position: absolute; top: 0.3rem; right: 0.35rem; display: flex; gap: 0.2rem; }
@media (hover: hover) {
  /* With a mouse, edit and copy wait until the quote is pointed at; the tick is always there */
  .excerpts li:not(:hover):not(:focus-within) .ex__tool:not(.ex__check) { opacity: 0; }
}

.ex__tool {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  background: var(--color-paper);
  color: var(--color-muted);
  cursor: pointer;
  transition: color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}

.ex__tool svg { width: 0.95rem; height: 0.95rem; }
.ex__tool:hover { color: var(--color-ink); border-color: var(--color-faint); }
.ex__check { color: var(--color-check); }
.ex__check:hover { border-color: var(--color-check); color: var(--color-check); background: var(--color-check-soft); }
.ex__check[aria-pressed="true"], .ex__tool.is-done { border-color: var(--color-check); background: var(--color-check); color: var(--color-paper); }

.entry__foot { display: flex; flex-wrap: wrap; gap: 0 var(--space-md); }
@media (hover: hover) {
  /* With a mouse, a question's own actions wait until it is chosen; touch screens always show them */
  .entry:not(.is-active):not(:focus-within) .entry__act { display: none; }
  .entry:not(.is-active):not(:focus-within) .entry__foot:not(:has(> :not(.entry__act))) { display: none; }
}

/* The reviewer's part: the answer as it goes in the extraction form (shown, or open in its
   editor until Done), and the question's tick */
.review { display: grid; gap: 0.35rem; }
.review__row { display: flex; align-items: flex-end; gap: var(--space-sm); }
.review__lead { flex: 1; min-width: 0; display: grid; justify-items: start; gap: 0.35rem; }
.review__lead.has-answer { display: flex; align-items: flex-start; gap: var(--space-xs); }
.review__lead > .review__note { justify-self: stretch; }
.review__label { display: block; color: var(--color-muted); font-size: var(--text-xs); }
.review__answer { flex: 1; min-width: 0; margin: 0; padding: 0.35rem 0.6rem; border-left: 2px solid var(--color-rule); color: var(--color-ink); font-size: var(--text-sm); line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.entry.is-checked .review__answer { border-left-color: var(--color-check); }
.review__same { color: var(--color-muted); }
.review__acts { display: flex; align-items: center; gap: var(--space-md); }
.review__na { align-self: center; color: var(--color-muted); font-weight: 400; }
.review__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.review__chips .review__label { flex-basis: 100%; }
.chip { min-height: 1.7rem; padding: 0 0.55rem; border: 1px solid var(--color-rule); border-radius: 999px; background: var(--color-paper-2); color: var(--color-ink); font: 500 var(--text-xs) / 1 var(--font-body); font-variant-numeric: tabular-nums; cursor: pointer; }
.chip:hover { border-color: var(--color-faint); }

.review__note {
  width: 100%;
  min-height: 3.2rem;
  max-height: 16rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-paper);
  color: var(--color-ink);
  font: 400 var(--text-sm) / 1.45 var(--font-body);
  resize: vertical;
  field-sizing: content;
}

.review__note::placeholder { color: var(--color-faint); }
.review__note:focus-visible { outline: none; border-color: var(--color-focus); box-shadow: 0 0 0 1px var(--color-focus); }

.review__tick {
  flex: none;
  min-height: 2.1rem;
  padding: 0 0.9rem;
  border: 1px solid var(--color-rule);
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  font: 500 var(--text-sm) / 1 var(--font-body);
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}

.review__tick:hover { color: var(--color-ink); border-color: var(--color-faint); }
.review__tick[aria-pressed="true"] { background: var(--color-check); border-color: var(--color-check); color: var(--color-paper); }
.review__tick[aria-pressed="true"]::before { content: "✓ "; }
.entry__note { color: var(--color-muted); font-size: var(--text-sm); }
.entry__note.error { color: var(--color-accent-ink); }

/* Data band */

.band {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-lg);
  padding: var(--space-sm) var(--gutter);
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.band b { color: var(--color-ink); }
.band__links { display: flex; gap: var(--space-md); margin-left: auto; white-space: nowrap; }
.noscript { padding: var(--space-md) var(--gutter); border-bottom: 1px solid var(--color-rule); }

/* Sheets: projects, settings and how it works */

.sheet {
  position: fixed;
  inset: 0;
  width: min(34rem, 100% - 2rem);
  height: fit-content;
  max-height: calc(100dvh - 2rem); /* as tall as the content, up to the screen: a scroll bar only when it must */
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: var(--shadow-sheet);
}

.sheet::backdrop { background: var(--color-scrim); }
.sheet[open] { animation: sheet-in var(--dur-short) var(--ease-out); }
.sheet__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); padding: var(--space-lg); } /* a wide table scrolls in its own box, not the sheet */
.sheet h2 { font-size: var(--text-title); }
.sheet p { color: var(--color-muted); }
.sheet__actions { display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: var(--space-xs); }
.sheet__msg { color: var(--color-accent-ink); font-size: var(--text-sm); }
.sheet__msg:empty { display: none; }

.field-label { display: grid; gap: 0.35rem; font-size: var(--text-sm); font-weight: 500; }

.text-field {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--color-rule);
  border-radius: 8px;
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: 400 var(--text-base) / 1 var(--font-body);
}

.text-field:hover { border-color: var(--color-faint); }
.text-field:focus-visible { outline-offset: 0; }
.check { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--color-accent); }

/* Projects: every project with its studies, names edited in place */

.sheet--wide { width: min(44rem, 100% - 2rem); }
#method .sheet__body { gap: var(--space-sm); } /* a long read: closer paragraphs, so it fits without scrolling on most screens */
.lib-actions { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); }
.lib-new { display: flex; gap: var(--space-xs); }
.proj__run { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); }
.proj__run:empty { display: none; }
.proj__progress { color: var(--color-muted); font-size: var(--text-sm); }
.proj__label { min-width: 4.6rem; color: var(--color-faint); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; }

/* An import waiting for a yes: what was found, and the button that creates the studies */
.proj__import { display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); background: var(--color-accent-soft); font-size: var(--text-sm); }
.sheet .proj__import p { color: var(--color-ink); }
.sheet .proj__import .proj__progress { color: var(--color-muted); }
.lib-new .text-field { flex: 1; min-width: 0; }
.library { display: grid; }
.proj { display: grid; gap: var(--space-xs); padding: var(--space-md) 0; border-top: 1px solid var(--color-rule); }
.proj__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-md); }
.proj__meta, .study-row__meta { color: var(--color-muted); font-size: var(--text-sm); white-space: nowrap; }
.proj__studies { list-style: none; padding: 0; display: grid; gap: 2px; }

.name-field {
  flex: 1 1 11rem;
  min-width: 0;
  margin-left: -0.35rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink);
  text-overflow: ellipsis;
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}

.name-field:hover { border-color: var(--color-rule); }
.name-field:focus-visible { outline: none; border-color: var(--color-focus); background: var(--color-paper-2); }
.proj__head .name-field { font: 400 var(--text-title) / 1.2 var(--font-display); }
.proj.is-current .proj__head .name-field { text-decoration: underline 2px var(--color-accent); text-underline-offset: 0.2em; }
.proj__head .name-field:focus-visible { text-decoration: none; }

.study-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-sm); padding: 0.3rem 0.5rem; margin-inline: -0.5rem; border-radius: var(--radius-sm); }
.study-row.is-current { background: var(--color-accent-soft); }
.study-row .name-field { font: 500 var(--text-base) / 1.3 var(--font-body); }
.proj__add { display: flex; gap: var(--space-xs); }
.proj__add .text-field { flex: 1; min-width: 0; min-height: 2.1rem; font-size: var(--text-sm); }
.link--danger:hover { color: var(--color-accent-ink); text-decoration-color: var(--color-accent); }

/* The header's place: project / study, which opens the projects sheet */

.place {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.4em;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.place__project { color: var(--color-muted); }
.place__sep { color: var(--color-faint); }
.place:hover .place__project, .place:hover .place__study { text-decoration: underline 1px var(--color-accent); text-underline-offset: 0.18em; }

/* Question templates */
.templates { list-style: none; padding: 0; display: grid; }
.template { display: grid; gap: var(--space-2xs); padding: var(--space-sm) 0; border-top: 1px solid var(--color-rule); }
.template__name { font-size: 1.2rem; }
.sheet .template p { font-size: var(--text-sm); }
.template__acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); padding-top: var(--space-2xs); }

/* The extraction table: studies down, questions across, one small square per answer */
.sheet--table { width: min(72rem, 100% - 2rem); margin-top: 1rem; } /* held at the top: its tabs change its height, not where it starts */
.sheet__kicker { color: var(--color-faint); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; }
.sheet__kicker + h2 { margin-top: calc(var(--space-md) * -0.75); }
.grid-wrap { max-height: min(56dvh, 34rem); overflow: auto; overscroll-behavior: contain; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); }
.grid-wrap > .note { padding: var(--space-md); }
.grid { border-collapse: separate; border-spacing: 0; }
.grid th, .grid td { padding: 2px; background: var(--color-paper); }
.grid thead th { position: sticky; top: 0; z-index: 1; vertical-align: bottom; border-bottom: 1px solid var(--color-rule); }
.grid tbody th, .grid thead th:first-child { position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--color-rule); text-align: left; }
.grid thead th:first-child { z-index: 3; padding: 0 var(--space-sm); color: var(--color-faint); font: 500 var(--text-xs) / 1 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; }
.grid__q span { display: block; max-height: 8.5rem; padding: 0.4rem 0 0.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; writing-mode: vertical-rl; transform: rotate(180deg); color: var(--color-muted); font: 500 var(--text-xs) / 1.6rem var(--font-body); }

.grid__study {
  display: block;
  max-width: 13rem;
  padding: 0.3rem var(--space-sm);
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: 500 var(--text-sm) / 1.2 var(--font-body);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.grid__study:hover { text-decoration: underline 1px var(--color-accent); text-underline-offset: 0.2em; }

.grid__cell {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px dashed var(--color-rule);
  border-radius: 4px;
  background: transparent;
  color: var(--color-ink);
  font: 600 var(--text-xs) / 1 var(--font-body);
  font-style: normal;
  vertical-align: middle;
  cursor: pointer;
}

.grid__cell[data-v="reported"] { border: 0; background: var(--color-accent); color: var(--color-paper); }
.grid__cell[data-v="unclear"] { border: 0; background: var(--color-accent-soft); color: var(--color-accent-ink); }
.grid__cell[data-v="not found"] { border-style: solid; background: var(--color-paper-2); }
.grid__cell[data-ok] { border: 0; background: var(--color-check); color: var(--color-paper); }
.grid__cell[data-v="na"] { border-style: solid; background: var(--color-paper-2); color: var(--color-muted); font-size: 0.5625rem; font-weight: 500; }
.grid__cell[data-stale] { background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--color-paper) 3px 5px); } /* hatched: an answer from before a rewording or a new file */
button.grid__cell:hover { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.grid tfoot th, .grid tfoot td { position: sticky; bottom: 0; border-top: 1px solid var(--color-rule); }
.grid tfoot th:first-child { z-index: 2; }
.grid__count { color: var(--color-muted); font: 500 var(--text-xs) / 1.6rem var(--font-body); text-align: center; font-variant-numeric: tabular-nums; }
/* Tabs in a sheet: the extraction table's parts, on one line that scrolls sideways when narrow */
.tabs { display: flex; gap: var(--space-sm); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--color-rule); padding-inline-end: 2rem; mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
/* the fade says there is more to the right; the end padding lets the last tab scroll clear of it */
.tab { flex: none; padding: 0.5rem 0.1rem; border: 0; background: none; color: var(--color-muted); font: 500 var(--text-sm) / 1 var(--font-body); white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--color-ink); }
.tab[aria-selected="true"] { box-shadow: inset 0 -2px 0 var(--color-ink); color: var(--color-ink); }
.tab:focus-visible { outline-offset: -2px; }
.tabpanel { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); }
.grid-flow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }
.grid-flow span { flex-basis: 100%; }

/* Risk of bias: judgments by domain, colored by how serious they are */
.rob { display: grid; gap: var(--space-sm); }
.rob__domain { display: grid; gap: var(--space-xs); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); background: var(--color-paper-2); }
.rob__name { font-size: 1.15rem; }
.rob__levels { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rob__level { min-height: 2rem; padding: 0 0.8rem; border: 1px solid var(--color-rule); border-radius: 999px; background: var(--color-paper); color: var(--color-ink); font: 500 var(--text-sm) / 1 var(--font-body); cursor: pointer; }
.rob__level:hover { border-color: var(--color-faint); }
.rob__level.is-suggested { border-style: dashed; border-color: var(--color-faint); }
.rob__level[aria-pressed="true"][data-kind="low"], .rob__cell[data-kind="low"] { border-color: var(--color-check); background: var(--color-check); color: var(--color-paper); }
.rob__level[aria-pressed="true"][data-kind="mid"], .rob__cell[data-kind="mid"] { border-color: var(--color-accent-soft); background: var(--color-accent-soft); color: var(--color-accent-ink); }
.rob__level[aria-pressed="true"][data-kind="high"], .rob__cell[data-kind="high"] { border-color: var(--color-accent); background: var(--color-accent); color: var(--color-paper); }
.rob__level[aria-pressed="true"][data-kind="critical"], .rob__cell[data-kind="critical"] { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-paper); }
.rob__level[aria-pressed="true"][data-kind="ni"], .rob__cell[data-kind="ni"] { border-style: solid; border-color: var(--color-faint); background: var(--color-paper-2); color: var(--color-muted); }
.rob__cell { font-size: var(--text-sm); }
.rob__support { list-style: none; padding: 0; display: grid; gap: 0.2rem; font-size: var(--text-sm); }
.rob__support li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-xs); }
.rob__support .link { font-size: var(--text-xs); }
.sheet .rob__said { flex: 1 1 14rem; min-width: 0; color: var(--color-ink); overflow-wrap: anywhere; }
.sheet .rob__said.is-open { color: var(--color-muted); }
.rob__note { width: 100%; min-height: 2.1rem; padding: 0.35rem 0.55rem; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); color: var(--color-ink); font: 400 var(--text-sm) / 1.4 var(--font-body); resize: vertical; field-sizing: content; }
.rob__overall { background: transparent; border: 1px solid var(--color-rule); }

/* Deduplication: the exports, the counts, and the pairs to decide */
.dd__files { list-style: none; padding: 0; display: grid; gap: 0.15rem; font-size: var(--text-sm); }
.dd__files li { display: flex; align-items: center; gap: var(--space-xs); }
.sheet .dd__msg { color: var(--color-ink); }
.dd__review { display: grid; gap: var(--space-xs); max-height: min(50dvh, 30rem); overflow: auto; overscroll-behavior: contain; }
.dd__review:empty { display: none; }
.dd__pair { display: grid; gap: 0.2rem; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); background: var(--color-paper-2); font-size: var(--text-sm); }
.dd__pair.is-decided { opacity: 0.6; }

/* The Report tab: the flow diagram as it will print, and the columns for the table of studies */
.prisma { max-width: 100%; overflow-x: auto; border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-pdf-page); }
.prisma svg { display: block; width: 100%; max-width: 760px; height: auto; }
.char summary { cursor: pointer; color: var(--color-ink); font-size: var(--text-sm); }
.char__list { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; padding-top: var(--space-xs); font-size: var(--text-sm); }
.char__q { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--color-ink); cursor: pointer; }

/* Title and abstract screening: one record at a time, decided with a press or a key */
.sc__criteria { display: grid; gap: var(--space-xs); }
@media (hover: none) { .sc__keys { display: none; } } /* no keyboard to speak of */
.sc__criteria summary { cursor: pointer; color: var(--color-ink); font-size: var(--text-sm); overflow-wrap: anywhere; }
.sc__criteria textarea { width: 100%; min-height: 6rem; resize: vertical; field-sizing: content; }
.sc__list { list-style: none; padding: 0; display: grid; gap: var(--space-xs); }
.sc__rec { display: grid; gap: 0.3rem; padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-rule); border-radius: var(--radius-sm); background: var(--color-paper); }
.sc__rec.is-active { border-color: var(--color-ink); box-shadow: inset 3px 0 0 var(--color-ink); }
.sc__rec:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.sheet .sc__title { color: var(--color-ink); font-weight: 600; overflow-wrap: anywhere; }
.sheet .sc__meta { color: var(--color-muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.sheet .sc__abs { color: var(--color-ink); font-size: var(--text-sm); line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.sheet .sc__rec.is-active .sc__abs { display: block; }
.sheet .sc__jev { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font-size: var(--text-xs); }
.sc__says { color: var(--color-muted); }
.sc__says.is-include { color: var(--color-check-ink); }
.sc__says.is-exclude { color: var(--color-accent-ink); }
.sc__crit { padding: 0.1rem 0.4rem; border-radius: 999px; background: var(--color-paper-2); color: var(--color-muted); cursor: help; }
.sc__crit.is-meets { background: var(--color-check-soft); color: var(--color-check-ink); }
.sc__crit.is-fails { background: var(--color-accent-soft); color: var(--color-accent-ink); }
.sc__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.sc__theirs { padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--color-accent-soft); color: var(--color-accent-ink); font-size: var(--text-xs); }
.sc__dec { min-height: 2rem; padding: 0 0.8rem; border: 1px solid var(--color-rule); border-radius: 999px; background: var(--color-paper); color: var(--color-ink); font: 500 var(--text-sm) / 1 var(--font-body); cursor: pointer; }
.sc__dec:hover { border-color: var(--color-faint); }
.sc__dec[aria-pressed="true"][data-as="include"] { border-color: var(--color-check); background: var(--color-check); color: var(--color-paper); }
.sc__dec[aria-pressed="true"][data-as="maybe"] { border-color: var(--color-accent-soft); background: var(--color-accent-soft); color: var(--color-accent-ink); }
.sc__dec[aria-pressed="true"][data-as="exclude"] { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-paper); }
.sheet .dd__rec { color: var(--color-ink); overflow-wrap: anywhere; }

/* The second reviewer: a blank copy out, their copy back in, the answers that differ */
.compare { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); }
.compare__tools .link { white-space: normal; text-align: left; }
.compare__h { font-size: 1.25rem; }
.compare__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-lg); font-size: var(--text-sm); }
.compare__with { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); max-width: 100%; }
.compare__with select { max-width: min(16rem, 100%); min-height: 2.1rem; padding: 0 0.5rem; border: 1px solid var(--color-rule); border-radius: 8px; background: var(--color-paper-2); color: var(--color-ink); font: 400 var(--text-sm) / 1 var(--font-body); }
.compare__sum { color: var(--color-ink); font-size: var(--text-sm); }
.compare__rows { list-style: none; padding: 0; display: grid; gap: 2px; max-height: min(40dvh, 24rem); overflow: auto; overscroll-behavior: contain; }
.compare__row { display: grid; gap: 0.15rem; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); background: var(--color-paper-2); font-size: var(--text-sm); }
.compare__what { color: var(--color-muted); }
.compare__what b { color: var(--color-ink); }
.sheet .compare__said { color: var(--color-ink); overflow-wrap: anywhere; }
.compare__said.is-empty { color: var(--color-faint); }
.compare__who { display: inline-block; min-width: 3.6rem; color: var(--color-faint); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; }
.compare__acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); }
.compare__row.is-settled { opacity: 0.7; }
.grid-legend { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); color: var(--color-muted); font-size: var(--text-xs); }
.grid-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.grid-legend .grid__cell { width: 1rem; height: 1rem; font-size: 0.625rem; cursor: default; }

/* The guide: a long read on the same paper, in the same type */
a.brand, a.btn { color: inherit; text-decoration: none; }
a.btn:not(.btn--quiet) { color: var(--color-paper); }
.guide-page { display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.guide { width: min(42rem, 100% - 2 * var(--gutter)); margin: 0 auto; padding: var(--space-xl) 0 calc(var(--space-xl) * 1.5); }
.guide__kicker { color: var(--color-faint); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; }
.guide h1 { margin: var(--space-xs) 0 var(--space-md); font-size: var(--text-display); }
.guide h2 { margin: calc(var(--space-xl) * 1.2) 0 var(--space-sm); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.guide h3 { margin: var(--space-lg) 0 var(--space-2xs); font-size: 1.3rem; }
.guide p, .guide li { line-height: 1.65; }
.guide p + p { margin-top: var(--space-sm); }
.guide ul, .guide ol { display: grid; gap: var(--space-xs); padding-left: 1.2rem; }
.guide li::marker { color: var(--color-faint); }
.guide .link { font-size: inherit; }
.guide code { padding: 0.05em 0.3em; border-radius: 4px; background: var(--color-paper-2); font-size: 0.9em; }
.guide__lead { color: var(--color-muted); font-size: var(--text-md); }
.guide__cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-lg); margin-top: var(--space-lg); }
.guide p.guide__cta { margin-top: var(--space-lg); }
.guide__quote { margin: var(--space-md) 0 0; padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--color-accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--color-paper-2); }
.guide__faq h3:first-child { margin-top: 0; }

@keyframes sheet-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }

/* Wider screens: the study and the questions side by side, one screen tall */

@media (min-width: 60rem) {
  :root { --side-width: 15.5rem; }
  [data-side="closed"] { --side-width: 3.35rem; }
  .app { grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; }
  .tagline { order: 0; flex-basis: auto; }
  .work { grid-template-columns: var(--side-width) minmax(0, 1fr) clamp(21rem, 34vw, 32rem); }
  .side { position: static; z-index: auto; width: auto; min-height: 0; box-shadow: none; transform: none; visibility: visible; transition: none; }
  .side__scrim { display: none; }
  [data-side="closed"] .side__title, [data-side="closed"] .side__body { display: none; }
  [data-side="closed"] .side__head { justify-content: center; padding-inline: 0; border-bottom: 0; }
  .files { flex: 0 1 auto; }
  .viewer { height: auto; min-height: 0; }
  .panel { border-left: 1px solid var(--color-rule); }
  .results { overflow: auto; overscroll-behavior: contain; }
  .entry__head { top: calc(var(--space-xs) * -1); } /* the results' top padding, which sticking keeps clear */
}

@media (pointer: coarse) {
  /* Fingers need room: every control at least 2rem tall, links padded out */
  .excerpts li:has(.ex__check) { --tools: 7.6rem; }
  .ex__tool { width: 2.2rem; height: 2.2rem; }
  .qlist__tool { min-width: 2.2rem; min-height: 2rem; }
  .chip { min-height: 2.2rem; padding: 0 0.8rem; }
  .batch .link, .tree__tools .link, .entry__foot .link, .cite .link, .progress .link, .compare__acts .link { padding-block: 0.45rem; }
  .file__close { width: 2rem; height: 2rem; }
  .tree__del, .entry__del { opacity: 1; min-width: 2rem; height: 2rem; }
  .review__note { font-size: 1rem; }
  .zoom button { min-height: 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .spin { animation: none; border-top-color: var(--color-rule); }
}
