/* ═══════════════════════════════════════════════════════════════════════════
   Folio — the application

   Loaded after genie.css, on Folio's page only; Galley keeps genie.css alone.
   Laid out as Docket is (evidite/docket static/briefaudit.css): a bar in the
   product's own colour, a rail beside the stage, Home with the intake beside
   the most recent audits, and a report that sets the article beside its
   findings. Panels take a small radius, lines are fine, icons are single
   colour and stroked.

   Every colour is an evidite.com token (geniecore-website src/styles/
   tokens.css), or an alpha of one. Folio's are the site's Folio palette: teal
   #1c4550 carries the bar, the selected control and the primary action, as
   Docket's blue does; mist #d4e6eb holds the article; linen #f8f5f3 recesses
   a working surface; night #242422 sets the text.
   ═════════════════════════════════════════════════════════════════════════ */

:root {
  /* the instrument, in Folio's teal (genie.css calls it ink) */
  --ink-900: #0e2328;              /* --color-teal-deep */
  --ink-800: #1c4550;              /* --color-teal: bar, primary action, selection */
  --ink-700: #325964;              /* --color-teal-border: hover on teal, edges */
  --ink-600: #668d97;              /* --color-teal-grey: icons and quiet strokes */

  /* Bone on teal: teal is lighter than night, so the two quieter steps are
     raised to stay at AA (bone at 68% is 5.1:1 on teal; at 56% it was 4.0) */
  --on-ink-2:  rgba(240, 238, 229, 0.84);
  --on-ink-3:  rgba(240, 238, 229, 0.68);

  --mist:        #d4e6eb;          /* --color-mist: the article, selected rail item */
  --mist-soft:   rgba(212, 230, 235, 0.45);   /* the drop zone, the run's steps */
  --linen:       #f8f5f3;          /* --color-linen: recents, the reference index */

  --on-paper:   #242422;           /* --color-night */
  --on-paper-2: #504e4e;           /* --color-night-border */
  --on-paper-3: rgba(0, 0, 0, 0.6);/* --color-ink at 60%, the site's quote mark */

  /* selection, focus and the drop's highlight carry the teal on paper */
  --accent-deep: #1c4550;          /* --color-teal */
  --accent-hi:   #d4e6eb;          /* --color-mist */
  --accent-glow: rgba(102, 141, 151, 0.35);   /* --color-teal-grey */

  --bar-h: 76px;
  --control-h: 44px;
  --rail-w: 68px;
  --page-x: clamp(16px, 3.4vw, 56px);
}

/* The ring is the ground's colour: teal on paper; on the teal bar genie.css
   hands it back to sky. */
body { --focus: #1c4550; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ═══ SHELL ═══════════════════════════════════════════════════════════════
   A fixed-height application: each screen scrolls inside itself. */
body,
body[data-state="report"] {
  background: #fff;
  color: var(--on-paper);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: none;
}
::selection { background: var(--mist); color: var(--on-paper); }

.top {
  min-height: var(--bar-h);
  padding: 0 clamp(16px, 2.4vw, 36px);
  background: var(--ink-800);
  border-bottom: 0;
  gap: 22px;
}
.top-brand { gap: 12px; color: #fff; }
.top-mark { width: 28px; height: 27px; color: #fff; }
.top-name { font-weight: 700; font-size: 1.8rem; color: #fff; }
.top-org {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: #e7e1d5;                  /* --color-sand, as Docket sets its maker */
  padding-top: 4px;
}
.top-org a { color: inherit; border-bottom-color: transparent; }
.top-org a:hover { color: #fff; border-bottom-color: rgba(240, 238, 229, 0.56); }

.app { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: auto; }
.view.is-on { display: flex; animation: none; }

/* ── the rail ─────────────────────────────────────────────────────────── */
.sprite { display: none; }
.rail {
  flex: none;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  padding: 26px 0 18px;
  background: #fff;
  border-right: 1px solid var(--rule-soft);
  z-index: 20;
}
.rail-group { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }
.rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--on-paper);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s;
}
.rail-btn .ico { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--mist-soft); }
.rail-btn.is-on { background: var(--mist); }
.rail-btn.is-on .ico { stroke-width: 1.9; }
/* the name, on hover, as Docket's narrow rail shows it */
.rail-label {
  position: absolute;
  left: calc(100% + 10px);
  padding: 4px 9px;
  border-radius: var(--r-sm);
  background: var(--ink-800);
  color: #fff;
  font-size: 0.78rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
}
.rail-btn:hover .rail-label,
.rail-btn:focus-visible .rail-label {
  opacity: 1;
  transform: none;
  transition: opacity 0.14s, transform 0.14s var(--ease);
}

/* ── page furniture ──────────────────────────────────────────────────── */
.page-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  min-height: calc(var(--control-h) + 2 * 22px + 1px);
  padding: 22px var(--page-x);
  border-bottom: 1px solid var(--rule-soft);
}
.page-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 2.6vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.page-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 14px clamp(14px, 2vw, 32px); }
.section-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.2;
}

/* ── controls ─────────────────────────────────────────────────────────── */
.btn {
  height: var(--control-h);
  padding: 0 20px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.95rem;
}
.btn .ico { width: 19px; height: 19px; }
.btn-dark { background: var(--ink-800); color: #fff; border-color: var(--ink-800); }
.btn-dark:not(:disabled):hover { background: var(--ink-900); border-color: var(--ink-900); }
.btn-line { background: #fff; color: var(--on-paper); border-color: var(--rule); }
.btn-line:hover { border-color: var(--on-paper-3); }
.btn-risk { background: var(--on-paper); color: #fff; }
.btn-risk:hover { background: #000; }
.btn-ghost { height: auto; }
.btn-quiet { height: auto; padding: 8px 12px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--on-paper-2);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn .ico { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--mist-soft); color: var(--on-paper); }

.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(220px, 24vw, 420px);
}
.searchbox-ico {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--on-paper-3);
  pointer-events: none;
}
.searchbox input {
  width: 100%;
  height: var(--control-h);
  padding: 0 14px 0 48px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.92rem;
}
.searchbox input::placeholder { color: var(--on-paper-3); }
/* Text fields take the same two-pixel ring as every other control, not a
   pale glow: the glow was under 3:1 against white. */
.searchbox input:focus,
.field:focus,
.search:focus,
.form-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink-800); box-shadow: none; }

.link-act {
  display: inline-flex;
  flex: none;
  white-space: nowrap;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.link-act:hover { text-decoration: underline; text-underline-offset: 3px; }

.empty-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  color: var(--on-paper-3);
  font-size: 0.92rem;
}
.empty-note .ico { width: 22px; height: 22px; }

/* ── menus ───────────────────────────────────────────────────────────── */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 250px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: 0 12px 32px rgba(36, 36, 34, 0.14);
}
.menu[hidden] { display: none; }
.menu-right { left: auto; right: 0; }
.menu-label {
  padding: 8px 10px 4px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-3);
}
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--mist-soft); }
.menu-item:focus-visible { background: var(--mist-soft); }
.menu-kind { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--on-paper-3); }

.split { display: flex; }
.split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-caret { width: 44px; padding: 0; border-left-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.split-main[style*="none"] + .split-caret { border-left-width: 1px; border-radius: var(--r-sm); }

/* the downloads list is a list of links, not a menu */
.menu-list { list-style: none; margin: 0; padding: 0; }

/* ── the notice: a run finished while the reader was elsewhere, or a saved
   audit that could not be opened ──────────────────────────────────────── */
.notice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 12px 12px 18px;
  border: 1px solid var(--ink-800);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  box-shadow: 0 12px 32px rgba(36, 36, 34, 0.18);
}
.notice[hidden] { display: none; }
.notice-text { flex: 1 1 260px; font-size: 0.92rem; }
.notice-act[hidden] { display: none; }
.btn-line:disabled { color: var(--on-paper-3); cursor: not-allowed; }

/* ── the slim footer, on every screen but the report ─────────────────── */
.foot-app {
  flex: none;
  padding: 12px var(--page-x);
  background: #fff;
  border-top: 1px solid var(--rule-soft);
  color: var(--on-paper-3);
}
.foot-app .foot-links a { color: var(--on-paper-2); }
.foot-app .foot-links a:hover { color: var(--on-paper); }
body[data-state="report"] .foot-app { display: none; }

/* ═══ HOME ════════════════════════════════════════════════════════════════ */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr);
  gap: 36px;
  padding: 40px var(--page-x) 48px;
  align-items: stretch;
}
.home-intake { display: flex; flex-direction: column; min-width: 0; }

.drop {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 250px;
  padding: 28px 22px;
  border: 1px dashed var(--on-paper-3);
  border-radius: var(--r-sm);
  background: var(--mist-soft);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.drop:hover, .drop[data-drag="true"] { background: var(--mist); border-color: var(--on-paper); transform: none; }
.drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop input[type=file] {
  display: block;
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.drop-ico { width: 44px; height: 44px; color: var(--on-paper-2); margin-bottom: 14px; stroke-width: 1.25; }
.drop-title { font-size: 1.12rem; font-weight: 400; }
.drop-meta { font-size: 0.82rem; color: var(--on-paper-2); }

.picked {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff;
  border-color: var(--rule);
}
.picked > .ico { width: 22px; height: 22px; color: var(--on-paper-2); }

.pmc { margin-top: 22px; }
.pmc-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-2);
}
.field {
  height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
}
.formats-note { font-size: 0.8rem; color: var(--on-paper-2); max-width: 62ch; }
.formats-note b, .formats-note code { color: var(--on-paper); }

.btn-go {
  width: 100%;
  height: 50px;
  margin-top: 20px;
  font-size: 1rem;
  background: var(--ink-800);
  color: #fff;
}
.btn-go:not(:disabled):hover { background: var(--ink-900); }
.btn-go:not(:disabled)::after { display: none; }
.btn-go:disabled { background: var(--linen); color: var(--on-paper-3); border-color: var(--rule); opacity: 1; }

/* ── the most recent audits ──────────────────────────────────────────── */
.recents {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 32px clamp(20px, 2.6vw, 44px) 34px;
  border-radius: var(--r-sm);
  background: var(--linen);
}
.recents-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  align-content: start;
}
.recent-cards > .empty-note, .library > .empty-note { grid-column: 1 / -1; }
.recents-note, .library-note { font-size: 0.82rem; color: var(--on-paper-2); max-width: 66ch; }
.recents-note { margin-top: auto; }
.recents-note.is-warn, .library-note.is-warn { color: var(--on-paper); font-weight: 500; }

/* ── an audit, as a card ─────────────────────────────────────────────────
   No picture of page one, as Docket's cards have: an article audited by its
   PMC ID has no file to draw. The card names the article, says what it was
   audited from, and draws the verdicts as one bar. */
.audit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  background: #fff;
  transition: border-color 0.15s;
}
.audit-card:hover { border-color: var(--ink-800); }
.audit-card:has(.ac-name:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.ac-cover { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 14px; min-height: 168px; }
.ac-ident {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-paper-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-name {
  border: 0;
  background: none;
  padding: 0;
  color: var(--on-paper);
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.12rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* the name is the card's one link, stretched over all of it */
.ac-name::after { content: ""; position: absolute; inset: 0; }
.ac-name:focus-visible { outline: none; }
.ac-bar { display: flex; gap: 2px; height: 6px; margin-top: auto; border-radius: 3px; overflow: hidden; }
.ac-seg { flex: 1 1 0; min-width: 3px; background: var(--mute-mark); }
.ac-seg[data-v="flagged"], .ac-seg[data-v="unverified"] { background: var(--bad-mark); }
.ac-seg[data-v="partial"]  { background: var(--warn-mark); }
.ac-seg[data-v="verified"] { background: var(--ok-mark); }
.ac-facts { font-size: 0.8rem; color: var(--on-paper-2); }
.ac-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 6px 10px 6px 16px;
  border-top: 1px solid var(--rule-soft);
}
.ac-when { font-size: 0.8rem; color: var(--on-paper-2); }
.ac-remove { position: relative; z-index: 2; }

/* ═══ AUDITS ═════════════════════════════════════════════════════════════ */
.library-note { padding: 18px var(--page-x) 0; }
.library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  align-content: start;
  padding: 22px var(--page-x) 48px;
}

/* ── the library bar: shelves, order and layout, as Docket's ───────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.library-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 16px;
  padding: 18px var(--page-x) 0;
}
.library-bar-end { justify-content: flex-end; }
.library-tools { display: flex; align-items: center; gap: 14px; }
.pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  height: 38px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--mist);
  color: var(--on-paper);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.pill:hover { background: rgba(102, 141, 151, 0.35); }
.pill.is-on { background: var(--ink-800); color: #fff; }
.pill.is-on:hover { background: var(--ink-900); }

.select { position: relative; display: inline-flex; align-items: center; }
.select select {
  appearance: none;
  height: 38px;
  padding: 0 38px 0 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.select select:hover { border-color: var(--on-paper-3); }
.select select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.select-caret { position: absolute; right: 12px; pointer-events: none; color: var(--on-paper-2); }

.layout-toggle {
  display: flex;
  height: 38px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
}
.layout-toggle button {
  display: grid;
  place-items: center;
  width: 38px;
  border: 0;
  background: none;
  color: var(--on-paper-2);
  cursor: pointer;
}
.layout-toggle button[aria-pressed="true"] { color: var(--on-paper); background: var(--mist); }
.layout-toggle button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ── stars, and the actions on a card ────────────────────────────────── */
.star-btn[aria-pressed="true"] { color: var(--ink-800); }
.star-btn[aria-pressed="true"] .ico { fill: currentColor; }
.ac-acts { display: flex; align-items: center; gap: 4px; position: relative; z-index: 2; }
.ac-acts .star-btn { position: relative; }
.ac-name-static { cursor: default; }
.ac-name-static::after { display: none; }
.is-trashed .ac-cover { opacity: 0.86; }
.is-trashed .ac-foot { flex-wrap: wrap; align-items: center; row-gap: 8px; padding: 10px 12px 12px 16px; }
.btn-small { height: 34px; padding: 0 12px; font-size: 0.85rem; }
.btn-risk-line { color: var(--on-paper); }
.btn-risk-line:hover { border-color: var(--on-paper); }

/* ── an audit, as a row (the list layout) ────────────────────────────── */
.library[data-layout="list"] { display: block; }
.audit-table { display: flex; flex-direction: column; }
.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1.3fr) 40px minmax(150px, 0.9fr) 40px;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.9rem;
}
.audit-row-head { min-height: 44px; font-weight: 500; color: var(--on-paper-2); }
.ar-name button {
  max-width: 100%;
  border: 0;
  padding: 0;
  background: none;
  color: var(--on-paper);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ar-name button:hover { text-decoration: underline; text-underline-offset: 3px; }
.ar-ident, .ar-facts, .ar-when { color: var(--on-paper-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Starred's two shelves ───────────────────────────────────────────── */
.shelf { padding: 20px var(--page-x) 0; }
.shelf-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-display);
  font-size: 1.55rem;
  cursor: pointer;
  list-style: none;
}
.shelf-title::-webkit-details-marker { display: none; }
.shelf-title .ico { transform: rotate(-90deg); transition: transform 0.15s var(--ease); }
.shelf[open] .shelf-title .ico { transform: none; }
.shelf .library { padding: 18px 0 24px; }
.shelf > .empty-note { padding: 14px 0 24px; }

/* ── a screen not built yet (Projects) ───────────────────────────────── */
.placeholder {
  max-width: 540px;
  margin: clamp(40px, 11vh, 130px) auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  color: var(--on-paper-2);
}
.placeholder-ico { width: 34px; height: 34px; color: var(--on-paper-2); }
.placeholder-title { font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; color: var(--on-paper); }
.placeholder .btn { margin-top: 8px; }
/* A disabled primary button reads as unavailable and still reads: grey on
   linen, not a faded teal (which was 3.9:1). */
.btn-dark:disabled { background: var(--linen); border-color: var(--rule); color: var(--on-paper-2); opacity: 1; cursor: not-allowed; }

/* the article panel's star sits on the kicker's line */
.ap-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: -12px; }
.ap-bar .ap-kicker { margin-bottom: 0; }
.ap-bar .star-btn[hidden] { display: none; }

/* ═══ A RUN IN FLIGHT ════════════════════════════════════════════════════ */
.run {
  width: min(680px, 100% - 2 * var(--page-x));
  margin: clamp(32px, 9vh, 100px) auto 48px;
}
.run-kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-2);
}
.run-dot {
  position: relative;
  width: 20px;
  height: 20px;
  border: 1px solid var(--on-paper-3);
  border-radius: 50%;
}
.run-dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--ink-800);
  animation: run-pulse 1.4s var(--ease) infinite;
}
@keyframes run-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1); }
}
.run-subject {
  margin: 22px 0 28px;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.steps {
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 26px clamp(20px, 2.6vw, 34px);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--mist-soft);
}
.step {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 0;
  color: var(--on-paper-3);
}
.step[data-bar]::after { bottom: 2px; left: 38px; width: calc(100% - 38px); height: 3px; border-radius: 2px; background: var(--ink-800); }
.step-dot { width: 18px; height: 18px; border: 1px solid currentColor; }
.step-name { font-size: 1.02rem; font-weight: 400; }
.step-tag { font-size: 0.74rem; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.step[data-at="done"] { color: var(--on-paper); }
.step[data-at="done"] .step-dot { background: var(--ink-800); border-color: var(--ink-800); }
.step[data-at="now"] { color: var(--on-paper); }
.step[data-at="now"] .step-name { font-weight: 500; }
.step[data-at="now"] .step-dot { background: var(--ink-600); border-color: var(--ink-600); animation: none; }
.readout { background: var(--ink-800); }
.run-note {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 16px;
  font-size: 0.84rem;
  color: var(--on-paper-2);
}

/* ═══ REPORT ══════════════════════════════════════════════════════════════
   The article beside its findings, each scrolling inside itself. */
#view-report { overflow: hidden; }
.crumb {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 14px var(--page-x) -6px calc(var(--page-x) - 6px);
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--on-paper-2);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.crumb[hidden] { display: none; }
.crumb:hover { color: var(--on-paper); }

.report {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(250px, 23vw, 400px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px clamp(16px, 2.4vw, 40px) 24px;
  overflow: hidden;
}

/* ── the article ─────────────────────────────────────────────────────── */
.article-panel {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 26px 28px;
  border-radius: var(--r-sm);
  background: var(--mist);
}
.ap-kicker {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-2);
  margin-bottom: -12px;
}
.ap-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.24;
  overflow-wrap: anywhere;
}
.ap-meta { display: flex; flex-direction: column; gap: 16px; }
.ap-row dt {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-paper-2);
  margin-bottom: 3px;
}
.ap-row dd { font-size: 1rem; line-height: 1.4; overflow-wrap: anywhere; }
.article-panel .report-meta { margin-top: -6px; color: var(--on-paper-2); }
.article-panel .report-meta code { color: var(--on-paper); font-size: 0.86em; overflow-wrap: anywhere; }
.ap-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ap-saved { font-size: 0.84rem; color: var(--on-paper-2); }
.ap-saved:empty { display: none; }
.ap-remove[hidden] { display: none; }

/* ── the findings ────────────────────────────────────────────────────── */
.report-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.report-bar { flex: none; display: flex; justify-content: flex-end; }
.report-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

.tally {
  flex: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  background: none;
  max-width: none;
  margin: 0;
}
.tally-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 4px 12px;
  padding: 14px 16px 14px;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  transition: border-color 0.15s, background-color 0.15s;
}
.tally-cell:hover { background: #fff; border-color: var(--on-paper-3); }
.tally-cell[aria-pressed="true"] { background: var(--mist-soft); border-color: var(--ink-800); box-shadow: inset 0 0 0 1px var(--ink-800); }
.tally-cell[aria-pressed="true"]::before { display: none; }
.tally-k { grid-column: 1; grid-row: 1; font-weight: 500; font-size: 0.9rem; }
.tally-k::before { border-color: var(--on-paper-2); }
.tally-d { grid-column: 1; grid-row: 2; max-width: none; color: var(--on-paper-2); }
.tally-pct { color: var(--on-paper-2); }
.tally-n { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: clamp(1.9rem, 2.6vw, 2.5rem); }

.worksheet {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.workspace { max-width: none; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); }
.index { background: var(--linen); border-right-color: var(--rule-soft); }
.index-tools { padding: 10px 12px; border-bottom-color: var(--rule-soft); }
.index-tools .searchbox { flex: 1; width: auto; min-width: 0; }
.index-tools .searchbox input { height: 38px; padding-left: 40px; font-size: 0.86rem; }
.index-tools .searchbox-ico { left: 12px; width: 18px; height: 18px; }
.index-count { color: var(--on-paper-2); }
.spine { background: #fff; }
.row:hover { background: var(--mist-soft); }
.row-sub, .row-n { color: var(--on-paper-2); }
.detail { background: #fff; }
.d-nav-btn:hover:not(:disabled) { background: var(--ink-800); border-color: var(--ink-800); color: #fff; }

/* ── the remove dialog ───────────────────────────────────────────────── */
.confirm {
  margin: auto;
  max-width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--on-paper);
  box-shadow: 0 24px 60px rgba(36, 36, 34, 0.24);
}
.confirm::backdrop { background: rgba(14, 35, 40, 0.45); }
.confirm-inner { display: flex; flex-direction: column; gap: 14px; padding: 26px 26px 22px; }
.confirm h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.55rem; }
.confirm p { font-size: 0.92rem; color: var(--on-paper-2); }
.confirm .confirm-extra { color: var(--on-paper); font-weight: 500; }
.confirm .confirm-extra[hidden] { display: none; }
.confirm-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ═══ NARROW SCREENS ══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .drop { min-height: 200px; }
  .tally { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  /* The report scrolls as a page: the article, the verdicts, then the
     references, which take the whole screen when they are reached. */
  #view-report { overflow: auto; }
  .report { flex: none; display: flex; flex-direction: column; overflow: visible; }
  .article-panel, .report-main, .tally { flex: none; }
  .article-panel { overflow: visible; gap: 16px; padding: 20px; }
  .ap-meta { flex-direction: row; flex-wrap: wrap; gap: 12px 24px; }
  .worksheet { flex: none; height: calc(100dvh - var(--bar-h) - 24px); min-height: 460px; }
  .report-bar { justify-content: flex-start; }
}

@media (max-width: 620px) {
  :root { --rail-w: 54px; --bar-h: 64px; }
  .top { gap: 12px; }
  .top-name { font-size: 1.55rem; }
  .top-mark { width: 24px; height: 23px; }
  .rail { padding-top: 16px; }
  .rail-group { padding: 0 7px; }
  .page-head { padding: 16px var(--page-x); min-height: 0; }
  .page-acts, .searchbox { width: 100%; }
  .page-acts .btn { flex: 1; }
  .home-grid { padding: 20px var(--page-x) 32px; gap: 24px; }
  .recents { padding: 22px 16px 24px; }
  .recent-cards, .library { grid-template-columns: minmax(0, 1fr); }
  .library-bar { padding-top: 14px; }
  .audit-row { grid-template-columns: minmax(0, 1fr) 40px 40px; row-gap: 2px; padding: 8px 0; }
  .audit-row-head { display: none; }
  .ar-ident, .ar-facts, .ar-when { grid-column: 1; font-size: 0.8rem; }
  .ar-name { grid-column: 1; grid-row: 1; }
  .ar-star { grid-column: 2; grid-row: 1; }
  .ar-menu { grid-column: 3; grid-row: 1; }
  .ar-ident { grid-row: 2; }
  .ar-facts { grid-row: 3; }
  .ar-when { grid-row: 4; }
  .report { padding: 12px var(--page-x) 16px; gap: 14px; }
  .report-acts, .split { width: 100%; }
  .split-main { flex: 1; }
  .report-acts > .btn-dark { flex: 1; }
  .tally { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tally-cell { padding: 10px 14px; }
  .tally-d { display: block; }
  .tally-n { font-size: 1.9rem; }
  .run-note { flex-direction: column; gap: 6px; }
  .foot-app { font-size: 0.8rem; }
}
