/* PaperLens base chrome — header/nav, layout, buttons, badges, cards, tables,
 * catalog + landing + observatory page styles. Tokens only (see theme.css). */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--text-muted); }

/* ── header / nav ─────────────────────────────────────────────────────── */
header.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
  color: var(--accent-dark); letter-spacing: -.2px; font-size: 16px; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.brand-logo { height: 22px; width: auto; display: block; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { padding: 5px 11px; border-radius: var(--radius-sm); color: var(--text-muted);
  font-weight: 500; }
.topbar nav a:hover { background: var(--accent-wash); color: var(--accent); text-decoration: none; }
.topbar nav a.active { color: var(--accent); background: var(--accent-wash); }
.topbar .spacer { flex: 1; }
/* personal nav (Process · Data review · My Workspace) sits right, divided from the account */
.topbar nav.nav-personal { margin-right: 4px; padding-right: 14px; border-right: 1px solid var(--border); }
.account { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.account .acct { color: var(--text-muted); font-weight: 600; }

/* sign-in modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(18,39,64,.35); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 24px 26px; width: 360px; max-width: 92vw; }
.modal h3 { margin: 0 0 4px; }
.modal form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.modal input { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 14px var(--font); }
.modal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.pl-err { color: var(--error); font-size: 12px; min-height: 1em; }
.pl-toggle { margin: 12px 0 0; font-size: 13px; }
.modal .radio input, .modal .sv-warrant input { width: auto; padding: 0; border: none; box-shadow: none; }
/* duplicate-paper screen (extract page) */
.dup-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.dup-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.dup-name { font-weight: 600; word-break: break-word; }
.dup-meta { font-size: 12px; margin: 2px 0 6px; }
.dup-choice { display: flex; gap: 16px; }
.dup-choice .radio { margin: 0; }

/* ── buttons ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--radius-sm); font: 600 13px var(--font); cursor: pointer;
  border: 1px solid transparent; transition: background .15s, box-shadow .15s, color .15s; }
.btn[hidden] { display: none; }   /* .btn's display:inline-flex would otherwise defeat [hidden] */
/* disabled-look for "coming soon" affordances rendered as <span>/<a> (not real buttons) */
.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
/* badge on a preset picker card that comes from a personal (owned or shared) preset */
.mc-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent); vertical-align: middle; margin-left: 5px; }
/* credits: the extract-page key-mode switch + the account-page ledger table */
.credit-switch { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; margin: 2px 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.credit-switch[hidden] { display: none; }   /* display:flex would otherwise defeat [hidden] (logged out: no credits to choose) */
.cs-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.cred-ledger { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.cred-ledger th, .cred-ledger td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.cred-ledger th { color: var(--text-muted); font-weight: 600; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-dark); box-shadow: var(--shadow-md); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-wash); color: var(--accent); }

/* ── badges / chips / status ──────────────────────────────────────────── */
.status { font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 600;
  background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.status.verified { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.status.flagged { background: var(--error-bg); color: var(--error); border-color: var(--error); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.badge.tier-human_verified { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.badge.tier-sample_verified { background: var(--conf-med-bg); color: var(--conf-med); border-color: var(--conf-med-bd); }
.badge.tier-ai_only { background: var(--bg); color: var(--text-muted); }
.chip { font-size: 11px; border: 1px solid var(--border); background: var(--bg); color: var(--accent);
  border-radius: 999px; padding: 3px 9px; cursor: pointer; font-family: var(--font-mono); }
.chip:hover { background: var(--accent-2); color: var(--on-accent); border-color: var(--accent-2); }

/* ── cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); }

/* ── tables ───────────────────────────────────────────────────────────── */
table.tbl { border-collapse: collapse; font-size: 13px; width: 100%; }
table.tbl th, table.tbl td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
table.tbl th { background: var(--bg); font-weight: 600; }

/* ── workspace two-column (PDF | records) ─────────────────────────────── */
main.split { display: flex; height: calc(100vh - 53px); }
.pagespane { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.pages { flex: 1; min-width: 0; overflow: auto; padding: 16px; background: var(--bg); }
/* the review panel can be dragged as wide as the window allows; the PDF pane then scrolls
   sideways and can be zoomed instead of shrinking into an unreadable strip */
.panel { width: 480px; flex: 0 0 auto; min-width: 0; overflow: auto; padding: 16px; background: var(--surface); }
.pdfzoom { position: absolute; top: 8px; right: 18px; z-index: 6; display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 4px;
  font-size: 12px; color: var(--text-muted); box-shadow: var(--shadow-sm); }
.pdfzoom button { border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; padding: 2px 7px; border-radius: 4px; color: var(--text); }
.pdfzoom button:hover { background: var(--bg); }
.pdfzoom #pdfzoomval { min-width: 34px; text-align: center; }
.splitter { flex: 0 0 6px; cursor: col-resize; background: var(--bg); border-right: 1px solid var(--border); border-left: 1px solid var(--border); }
.splitter:hover, .splitter.drag { background: var(--accent-3); }
.panelhead { margin-bottom: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dlbtns { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.dlbtns .btn { padding: 5px 10px; font-size: 12px; }

/* paper switcher — a left sidebar listing the documents */
.docsidebar { flex: 0 0 200px; width: 200px; overflow: auto; padding: 12px 10px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.docsidebar-label, .doctabs-label { font-weight: 600; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
a.doctabs-label { display: block; text-decoration: none; }
a.doctabs-label:hover { color: var(--accent); }
.doctab { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  white-space: normal; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text-muted); cursor: pointer; padding: 7px 10px; font-size: 12.5px; }
.doctab:hover { border-color: var(--accent-3); }
.doctab.active { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.doctab .dt-n { font-size: 11px; background: var(--bg); border-radius: 8px; padding: 0 6px; }
/* the open paper's parts: Paper + one line per entry, under its tab */
.docsub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px 10px; padding-left: 8px; border-left: 2px solid var(--border); }
.docsub-item { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; border: 0; background: none;
  font-size: 12px; padding: 3px 6px; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; }
.docsub-item .docsub-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docsub-item:hover { background: var(--bg); color: var(--text); }
.docsub-item.active { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
/* this-round jobs still processing / failed, shown alongside the document tabs */
.doctab.jobpend { color: var(--text-muted); font-size: 12px; cursor: default; justify-content: space-between; }
.jobstop { border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 13px;
  padding: 0 2px; margin-left: 6px; line-height: 1; opacity: .6; }
.jobstop:hover { color: var(--error); opacity: 1; }
/* entry sub-nav in the records panel: Study information + one tab per table/record */
.rnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }
.rnav-tab { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text-muted); cursor: pointer; padding: 5px 11px; font-size: 12.5px; }
.rnav-tab:hover { border-color: var(--accent-3); }
.rnav-tab.active { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); font-weight: 600; }
/* Import page: one row per JSON+PDF pair */
.import-pairs { display: flex; flex-direction: column; gap: 6px; }
.import-row { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px; }
.import-row.ok { border-color: var(--accent-3); }
.import-row .ir-name { font-weight: 600; }
.import-row .ir-stat { color: var(--text-muted); }
.doctab.jobfail { color: var(--error); border-color: var(--error); font-size: 12px; cursor: pointer; }
/* "＋ Add papers" — back to the extract page in add-papers mode for this dataset */
.doctab-add { justify-content: center; margin-top: 8px; border-style: dashed; color: var(--accent);
  text-decoration: none; font-weight: 600; }
.doctab-add:hover { background: var(--accent-wash); border-color: var(--accent); text-decoration: none; }

/* raw JSON view */
.rawjson { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  font: 11.5px/1.5 var(--font-mono); overflow: auto; white-space: pre; margin: 8px 0 0; max-height: 460px; }

/* per-record change history */
.histbtn { margin-left: auto; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; font-size: 11px; padding: 3px 8px; border-radius: var(--radius-sm); }
.histbtn:hover { border-color: var(--accent-3); color: var(--accent); }
.histbody { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.hist-row { font-size: 12px; margin-bottom: 8px; }
.hist-meta { color: var(--text-muted); }
.hist-diff { margin-top: 2px; }

/* My Workspace: sectioned hub (Datasets + Analyses) */
.ws-section { margin: 0 0 34px; }
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ws-head h3 { margin: 0; }
.ws-hint { margin: 2px 0 14px; font-size: 12.5px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

/* My Workspace dataset/analysis tiles */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.proj-tile { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); }
.proj-tile:hover { border-color: var(--accent-3); box-shadow: var(--shadow-md); text-decoration: none; }
.pt-title { font-weight: 600; margin-bottom: 6px; }
.pt-meta { font-size: 12px; color: var(--text-muted); }
.pt-vis { text-transform: capitalize; }
.pt-vis.public { color: var(--success); }
.proj-tile-wrap { position: relative; }
.pt-del { position: absolute; top: 10px; right: 10px; border: none; background: none; cursor: pointer; font-size: 13px; opacity: .4; }
.pt-del:hover { opacity: 1; }
/* dataset activity feed: icon | what changed | when */
.ds-activity:empty { display: none; }
.act-head { padding: 0 0 8px; font-size: 12px; }
.act-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.act-icon { width: 1.2em; text-align: center; opacity: .6; flex: none; }
.act-main { flex: 1; min-width: 0; }
.act-when { flex: none; font-size: 12px; white-space: nowrap; }
.act-diff { font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.act-from { text-decoration: line-through; opacity: .6; }
.act-to { font-weight: 600; }
.act-note { font-size: 12px; margin-top: 2px; }

/* inline retitle affordance, sitting next to the heading it edits */
.pt-rename { position: absolute; top: 10px; right: 30px; border: none; background: none; cursor: pointer; font-size: 13px; opacity: .4; }
.pt-rename:hover { opacity: 1; }
.ds-rename { border: none; background: none; cursor: pointer; font-size: .6em; vertical-align: middle; opacity: .4; padding: 0 4px; }
.ds-rename:hover { opacity: 1; }
/* All my papers: cached-PDF tiles — the title is a link, and the card carries actions */
a.pt-title { display: block; text-decoration: none; color: var(--text); }
a.pt-title:hover { color: var(--accent); }
.pt-inds { margin-top: 3px; font-style: italic; }
.pt-actions { margin-top: 12px; }
.ds-pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 320px; overflow-y: auto; }
.ds-pick { justify-content: flex-start; text-align: left; }
.sv-warrant { display: flex; gap: 7px; align-items: center; font-size: 12.5px; margin: 10px 0 0; cursor: pointer; }

/* data-review dataset chooser */
.rv-choose { max-width: 720px; margin: 40px auto; padding: 0 20px; }
.rv-ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.rv-ds { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); }
.rv-ds:hover { border-color: var(--accent-3); box-shadow: var(--shadow-md); text-decoration: none; }
.rv-ds-t { font-weight: 600; margin-bottom: 6px; }
.rv-ds-m { font-size: 12px; color: var(--text-muted); text-transform: capitalize; }

/* analysis builder — new-analysis chooser */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.ch-card { text-align: left; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  background: var(--surface); cursor: pointer; box-shadow: var(--shadow-sm); font: inherit; color: var(--text); }
.ch-card:hover { border-color: var(--accent-3); box-shadow: var(--shadow-md); }
.ch-ic { font-size: 26px; margin-bottom: 8px; }
.ch-t { font-weight: 600; margin-bottom: 4px; }
.ch-d { font-size: 12.5px; color: var(--text-muted); }
.ch-soon { font-size: 10.5px; font-weight: 600; color: var(--conf-med); background: var(--conf-med-bg);
  border: 1px solid var(--conf-med-bd); border-radius: 999px; padding: 1px 7px; margin-left: 4px; white-space: nowrap; }

/* analysis builder */
.bld-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  background: var(--surface); margin-bottom: 18px; }
.bld-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.bld-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); min-width: 160px; }
.bld-field.bld-grow { flex: 1 1 260px; }
.bld-field input, .bld-field select { font-size: 13px; padding: 7px 9px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.bld-actions { display: flex; gap: 10px; align-items: center; }
.bld-split { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(340px, 1.2fr); gap: 18px; align-items: start; }
.bld-editor, .bld-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.bld-eh { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bld-savebar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 18px 0 40px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.fig-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.fc-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.fc-title { flex: 1; font-weight: 600; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.fc-del { border: none; background: none; cursor: pointer; font-size: 13px; opacity: .5; }
.fc-del:hover { opacity: 1; }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.fc-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted); }
.fc-grid select { font-size: 12px; padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.fc-warn { font-size: 11.5px; color: var(--conf-med); margin-top: 8px; }
@media (max-width: 860px) { .bld-split { grid-template-columns: 1fr; } }

/* add-papers banner (extract?dataset=) */
.add-banner { background: var(--accent-wash); border: 1px solid var(--accent-3); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 12px; margin: 0 0 12px; font-size: 13px; }

/* dataset overview page */
/* signed out: the dataset lives only as long as the session */
.ds-keep { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 4px; padding: 12px 16px;
  border: 1px solid var(--override-line); background: var(--override-bg); border-radius: var(--radius); font-size: 13.5px; }
.ds-dashrow { padding: 5px 0; border-top: 1px solid var(--border); color: var(--text); }
.ds-dashrow:first-child { border-top: none; }
.ds-keep .btn { flex: none; }
.ds-keep input { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 14px var(--font); background: var(--surface); color: var(--text); }
/* audit report on the dataset page: the platform's table style (the APA layout is in the downloads) */
.ds-card-h { display: flex; align-items: center; gap: 8px; }
.au-wrap { overflow-x: auto; }
table.au-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.au-table th, table.au-table td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.au-table th { font-weight: 600; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; cursor: help; }
table.au-table .au-var { text-align: left; white-space: normal; }
table.au-table .au-group td { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-muted); background: var(--bg); padding-top: 9px; }
table.au-table .au-hit { color: var(--error); font-weight: 600; }
table.au-table .au-idx { font-family: var(--mono, ui-monospace, monospace); }
table.au-table .au-total td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: none; }
.au-note { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); } .au-note summary { cursor: pointer; } .au-note p { margin: 6px 0 0; line-height: 1.5; }
.ds-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 12px 0 4px; }
.ds-sub { font-size: 13px; }
.ds-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.ds-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  background: var(--surface); margin-bottom: 16px; }
.ds-card-h { font-weight: 600; margin-bottom: 10px; }
.ds-recipe { display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 13px; }
.ds-recipe .rk { color: var(--text-muted); margin-right: 4px; }
.ds-prompt { margin-top: 10px; }
.ds-prompt summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.ds-prompt pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; margin: 8px 0 0;
  padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 320px; overflow: auto; }
.ds-mixed { font-size: 12px; margin: 8px 0 0; }
.ds-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.stat-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-num.small { font-size: 14px; font-weight: 600; }
.stat-lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ds-papers { display: flex; flex-direction: column; }
.paper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--border); }
.paper-row:first-child { border-top: none; }
.pr-name { font-weight: 500; word-break: break-word; }
.pr-meta { font-size: 12px; }
.pr-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pr-del { border: none; background: none; cursor: pointer; font-size: 13px; opacity: .4; }
.pr-del:hover { opacity: 1; }

/* empty workspace → guide to extraction */
.empty-state { max-width: 460px; margin: 64px auto; text-align: center; padding: 0 20px; }
.empty-state h3 { margin: 0 0 8px; }
.empty-state .btn { margin-top: 14px; }
/* 0-record doc: "add a finding" + "confirm no records" sit side by side */
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* account settings page */
.acct-sec { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; background: var(--surface); }
.acct-sec h3 { margin: 0 0 8px; font-size: 15px; }
.acct-sec.danger { border-color: var(--error); }
.acct-form { display: flex; flex-direction: column; gap: 10px; }
.acct-sec input { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 13px var(--font); max-width: 340px; }
.acct-sec input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.acct-sec .wf-field input { max-width: 100%; }
a.acct { color: var(--text); text-decoration: none; }
a.acct:hover { color: var(--accent); }

/* ── landing (centered, editorial-serif hero) ─────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.hero-c { text-align: center; max-width: 780px; margin: 0 auto; padding-top: 56px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700;
  color: var(--accent-2); margin-bottom: 16px; }
.hero-c h1 { font: 600 50px/1.1 var(--font-serif); color: var(--accent-dark);
  letter-spacing: -.5px; margin: 0 0 18px; }
.hero-c .lede { font-size: 17px; color: var(--text-muted); max-width: 58ch; margin: 0 auto 26px; }
.hero-c .cta { display: flex; gap: 12px; justify-content: center; }

/* the Extract → Verify → Visualize → Update infographic */
.pipeline { display: flex; align-items: stretch; justify-content: center; gap: 4px; flex-wrap: wrap;
  margin: 50px auto 0; max-width: 960px; }
.pstep { flex: 1 1 190px; max-width: 210px; text-align: center; padding: 20px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.picon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 999px; display: flex;
  align-items: center; justify-content: center; background: var(--accent-wash); color: var(--accent); font-size: 22px; }
.pname { font-weight: 700; margin-bottom: 6px; }
.pdesc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.pmodes { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; }
.pmode { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-wash); border-radius: 999px; padding: 2px 8px; }
.parrow { align-self: center; color: var(--accent-3); font-size: 24px; padding: 0 2px; }
.ploop { text-align: center; color: var(--text-muted); font-size: 13px; margin: 14px 0 0; }
@media (max-width: 760px) { .parrow { transform: rotate(90deg); } .pstep { max-width: none; } }

.statband { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; max-width: 840px; margin: 48px auto; }
.statband .stat { flex: 1; padding: 20px 22px; border-right: 1px solid var(--border); text-align: center; }
.statband .stat:last-child { border-right: none; }
.statband .num { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.statband .lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.section-h { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 28px 0 12px; }

/* ── catalog (A tool-faithful: search + facet rail + results) ─────────── */
.catalog { display: grid; grid-template-columns: 240px 1fr; gap: 22px; padding: 22px 0 60px; }
.facets h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  margin: 16px 0 6px; }
.facet-val { display: flex; justify-content: space-between; gap: 8px; padding: 3px 6px; border-radius: 4px;
  cursor: pointer; font-size: 13px; }
.facet-val:hover { background: var(--accent-wash); }
.facet-val.on { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.facet-val .c { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 14px var(--font); }
.searchbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fpill { font-size: 11px; background: var(--accent-wash); color: var(--accent); border-radius: 999px;
  padding: 3px 10px; cursor: pointer; }
.result { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 10px;
  background: var(--surface); cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.result:hover { box-shadow: var(--shadow-md); border-color: var(--accent-3); }
.result .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px;
  color: var(--text-muted); margin-bottom: 6px; }
.result .ptitle { font-weight: 600; color: var(--text); }
.catalog-list { padding: 10px 0 60px; max-width: 860px; }
/* Title / description / meta on the left, the credibility badge in a column of its own on the
   right. The badge is aligned to the top and never wraps, and the description is clamped, so one
   dataset with a long abstract cannot make its card five times the height of its neighbours. */
.dataset-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  background: var(--surface); }
.dataset-card:hover { box-shadow: var(--shadow-md); }
.dataset-card > div:first-child { min-width: 0; }
.dataset-card .ds-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 13px; color: var(--text-muted); margin: 3px 0 5px; line-height: 1.45; }
.dataset-card .ds-meta { font-size: 12px; color: var(--text-muted); }
.dataset-card > .badge { flex: none; white-space: nowrap; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; }

/* ── extraction workflow (sidebar + accordion) ────────────────────────── */
.extract-layout { display: grid; grid-template-columns: 210px 1fr; gap: 30px; align-items: start;
  padding: 22px 0 60px; }
/* Let the 1fr track shrink to the available width. Without this the grid item keeps
   its default min-width:auto, so a wide descendant (the masem 1fr/1fr card grid, long
   <code> help text, textareas) forces the track past .wrap's 1040px cap → the whole
   page overflows horizontally and the sticky sidebar scrolls off-screen. */
.extract-layout > main { min-width: 0; }
.wf-sidebar { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 4px; }
.wf-step-nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); font-size: 13px; }
.wf-step-nav:hover { background: var(--bg); }
.wf-step-nav.active { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.wf-num { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--accent-3);
  color: var(--on-accent); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.wf-step-nav.active .wf-num { background: var(--accent); }
.wf-step-nav.results .wf-num { background: transparent; color: var(--text-muted); }
/* FAQ sits under the steps, visibly separated: it is a page, not a step */
.wf-faq { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); border-radius: 0; text-decoration: none; }
.wf-faq .wf-num { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.wf-faq:hover { color: var(--text); }
.legal-ack { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; line-height: 1.45; cursor: pointer; }
.legal-ack input { margin-top: 3px; flex: none; }
.legal-ack.legal-missing { border-color: var(--error); background: var(--error-bg); }
/* logged out: the own-key path is the way to keep extracting, so it is spelled out, not tucked behind a toggle */
.ml-anon-hot { display: block; margin-top: 6px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--accent-wash); color: var(--text); }
.ml-anon-hot a { font-weight: 600; }
.wf-field { margin-bottom: 4px; }
.wf-field label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.wf-field input[hidden] { display: none; }
.local-text { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 10px 0 2px; }
.local-text[hidden] { display: none; }
/* auto-forward (brand default preset / ?preset=): steps stay invisible until step 2 is open */
.wf-autostart .extract-layout > main #acc, .wf-autostart .wf-sidebar { visibility: hidden; }
.wf-field select, .wf-field input { width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 14px var(--font); background: var(--surface); color: var(--text); }
.wf-field select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.wf-field select:focus, .wf-field input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash); }
.select-wrap { position: relative; }
.select-wrap::after { content: "▾"; position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: 11px; }
.key-row { display: flex; gap: 10px; }
.key-row input { flex: 1; }
.wf-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (max-width: 760px) {
  .extract-layout { grid-template-columns: 1fr; }
  .wf-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* ── extraction workflow (accordion) ──────────────────────────────────── */
.acc-step { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); margin-bottom: 12px; overflow: hidden; }
.acc-head { display: flex; align-items: center; gap: 14px; padding: 16px 22px; cursor: pointer;
  font-weight: 600; font-size: 15px; }
.acc-step.disabled .acc-head { cursor: default; color: var(--text-muted); }
.acc-num { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--bg);
  color: var(--text-muted); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.acc-step.open .acc-num, .acc-step.done .acc-num { background: var(--accent); color: var(--on-accent); }
.acc-title { flex: none; }
.acc-sum { flex: 1; color: var(--text-muted); font-weight: 500; font-size: 13px; }
.acc-chev { color: var(--text-muted); transition: transform .15s; }
.acc-step.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 4px 22px 22px; }
.acc-step.open .acc-body { display: block; }
.acc-divider { text-align: center; text-transform: uppercase; letter-spacing: .08em; font-size: 11px;
  font-weight: 700; color: var(--text-muted); margin: 22px 0 14px; position: relative; }
.acc-divider::before, .acc-divider::after { content: ""; position: absolute; top: 50%; width: 30%;
  height: 1px; background: var(--border); }
.acc-divider::before { left: 0; } .acc-divider::after { right: 0; }
.promptbox { width: 100%; min-height: 220px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 12.5px/1.5 var(--font-mono); resize: vertical; }
.promptbox:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.task-card.row { display: flex; text-align: left; align-items: flex-start; gap: 14px; padding: 16px 18px;
  border-style: dashed; }
.task-card.row .ticon { margin: 2px 0 0; width: 26px; height: 26px; }
.task-card.row .ticon svg { width: 22px; height: 22px; }

.task-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 6px 0 4px; }
.task-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 22px;
  text-align: center; cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .12s; }
.task-card:hover { border-color: var(--accent-3); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card.sel { border-color: var(--accent); background: var(--accent-wash); }
.task-card .ticon { width: 46px; height: 46px; margin: 0 auto 12px; display: flex; align-items: center;
  justify-content: center; color: var(--accent); }
.task-card .ticon svg { width: 30px; height: 30px; }
.task-card .tt { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.task-card .td { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* MASEMiner guided builder */
.masem-starters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.masem-starter { min-width: 0; text-align: left; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  background: var(--surface); cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.masem-starter:hover { border-color: var(--accent-3); box-shadow: var(--shadow-sm); }
.masem-starter.sel { border-color: var(--accent); background: var(--accent-wash); }
.masem-starter .ms-label { font-weight: 600; margin-bottom: 3px; }
.masem-starter .ms-tag { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.masem-scalar-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.masem-scalar-row .masem-grow { flex: 1 1 260px; }
.masem-scalar-row .masem-narrow { flex: 0 1 160px; }
@media (max-width: 640px) { .masem-starters { grid-template-columns: 1fr; } }
/* structured "Describe what to extract" form */
.sf-section { border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 18px 18px; margin: 16px 0; }
.sf-section > legend { padding: 0 8px; font-weight: 700; font-size: 14px; color: var(--text); }

/* step-3 mode switch (Guided / Advanced / Write your own) */
.mode-switch { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 16px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px; }
.mode-switch[hidden] { display: none; }   /* display:inline-flex would otherwise defeat [hidden] */
.mode-btn { border: none; background: none; cursor: pointer; font-size: 12.5px; padding: 5px 14px;
  border-radius: 999px; color: var(--text-muted); }
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); }
.sf-paper { font-size: 12.5px; color: var(--text-muted); background: var(--accent-wash); border: 1px solid var(--accent-3);
  border-radius: var(--radius-sm); padding: 9px 12px; margin: 14px 0 0; }
.sf-hint { font-size: 12.5px; margin: 10px 0 12px; }
.sf-help { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.sf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.radio { display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 5px 0; cursor: pointer; }
.radio-row { display: flex; gap: 20px; align-items: center; margin-top: 4px; }
.radio-row .radio { margin: 0; }
/* a radio inside a labelled field keeps its inline layout (the block label rule above would stack it) */
.wf-field .radio { display: flex; font-weight: 400; margin: 0; white-space: nowrap; }
.wf-field .radio input { width: auto; padding: 0; margin: 0; flex: none; }
/* hover-for-concrete-example tooltip on field headlines (positioned by JS to the
   side of the content column; light popover, not white-on-dark) */
.hl { cursor: help; border-bottom: 1px dotted var(--text-muted); }
.tip-pop { position: fixed; z-index: 60; width: 300px; max-width: 84vw; white-space: pre-line;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 11px 13px; font: 400 12px/1.55 var(--font); display: none; }
/* rich provenance tooltip for dashboard marks */
.tip-rich { white-space: normal; width: 320px; pointer-events: none; }
.tip-rich .tp-t { font-weight: 600; margin-bottom: 2px; }
.tip-rich .tp-m { color: var(--text-muted); font-size: 11.5px; }
.tip-rich .tp-v { margin: 5px 0 2px; font-variant-numeric: tabular-nums; }
.tip-rich .tp-e { margin-top: 5px; font-size: 11.5px; color: var(--text-muted); font-style: italic; }
.tip-rich .tp-c { margin-top: 7px; font-size: 11px; color: var(--accent); }
.sf-ta, .promptbox { width: 100%; }
.sf-ta { min-height: 96px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 12.5px/1.5 var(--font-mono); resize: vertical; }
.sf-ta:focus, .sf-section input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
@media (max-width: 620px) { .sf-row { grid-template-columns: 1fr; } }

/* structured designer — substep stepper */
.sf-stepper { display: flex; gap: 8px; margin: 4px 0 16px; flex-wrap: wrap; }
.sf-pill { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px;
  background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text-muted); }
.sf-pill.active { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.sf-sub[hidden] { display: none; }

/* unit template chips (one row) + the per-substep question heading */
.sf-q { font-size: 15px; font-weight: 700; margin: 2px 0; color: var(--text); }
.unit-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.unit-chip { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px;
  background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text); }
.unit-chip:hover { border-color: var(--accent-3); }
.unit-chip.sel { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.unit-chip.other { border-style: dashed; color: var(--text-muted); background: var(--bg); }
.unit-chip.other.sel { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

/* step-1 pre-built method gallery */
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 4px 0; }
.method-card { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; background: var(--surface); cursor: pointer; }
.method-card:hover { border-color: var(--accent-3); }
.method-card.sel { border-color: var(--accent); background: var(--accent-wash); }
.method-card.sub { border-style: dashed; margin-left: 14px; }           /* a saved setup under its base */
.masem-setup-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.masem-setup-row input { max-width: 260px; }
.method-card .mc-title { font-weight: 600; font-size: 13px; color: var(--text); }
.method-card .mc-sub { font-size: 11.5px; color: var(--text-muted); }

/* field rows */
.field-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 8px; background: var(--surface); }
.fr-main { display: flex; gap: 8px; align-items: center; }
.field-row input, .field-row select { padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 13px var(--font); min-width: 0; }
.field-row input:focus, .field-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.fr-main .fr-name { flex: 0 0 26%; }
.fr-main .fr-desc { flex: 1 1 auto; }
.fr-tab-wrap { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.fr-tab-wrap[hidden] { display: none; }   /* the class's display:inline-flex would otherwise defeat [hidden] */
.fr-rm, .fc-rm { border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 14px; padding: 4px 6px; }
.fr-rm:hover, .fc-rm:hover { color: var(--error); }
.fr-cols { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--rose-wash); }
.fr-cols[hidden] { display: none; }
.fc-hd { margin-bottom: 6px; }
.fc-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.fc-row .fc-name { flex: 0 0 30%; }
.fc-row .fc-desc { flex: 1 1 auto; }

/* review-tabs editor (substep 4) */
.tab-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.tab-row .tab-label { flex: 1 1 auto; padding: 7px 9px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 13px var(--font); }
.task-detail { margin: 12px 0 4px; }
.task-detail textarea { width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 13px var(--font); resize: vertical; }
.task-detail textarea:focus, .task-detail select:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash); }
.task-detail select { width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 14px var(--font); }
@media (max-width: 620px) { .task-grid { grid-template-columns: 1fr; } }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px;
  margin: 6px 0 8px; }
.preset-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
  cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.preset-card:hover { border-color: var(--accent-3); }
.preset-card.sel { border-color: var(--accent); background: var(--accent-wash); }
.preset-card .pt { font-weight: 600; }
.preset-card .tg { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.form-row input, .form-row select { flex: 1 1 200px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: 14px var(--font); }
.form-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input[type=file] { margin: 6px 0; }
.run-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* upload dropzone */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 20px; text-align: center;
  cursor: pointer; color: var(--text-muted); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }
.dz-icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--accent-3); }
.dz-icon svg { width: 100%; height: 100%; }
.dz-title { font-weight: 600; color: var(--text); }
.dz-sub { font-size: 12px; margin-top: 4px; }
.filelist { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.fileitem { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; background: var(--surface); }
.fileitem .fstatus { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.fi-right { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fi-ok { color: var(--success); }
.jobwait { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); }
.jobwait[hidden] { display: none; }
.radio-row[hidden] { display: none; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── observatory chart ────────────────────────────────────────────────── */
.obs { padding: 22px 0 60px; }
#chart svg { background: var(--surface); max-width: 100%; }
.bar { fill: var(--accent); }
.blabel { font-size: 12px; fill: var(--text); }
.bval { font-size: 12px; fill: var(--text-muted); }
#summary { margin-bottom: 14px; }
#attrib { margin-top: 16px; font-size: 12px; }
#tbl { border-collapse: collapse; margin-top: 18px; font-size: 13px; }
#tbl th, #tbl td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
#tbl th { background: var(--bg); }
header.topbar select { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 13px var(--font); }

/* ── model line (Review prompt): which model runs this, what's left, the way out ── */
.model-line { display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  flex-wrap:wrap; margin:10px 0 0; padding:10px 12px; border:1px solid var(--border);
  border-radius:var(--radius-sm); background:var(--bg); }
.ml-facts { display:flex; flex-direction:column; gap:3px; font-size:13px; color:var(--text-muted); }
.ml-row b { color:var(--text); font-weight:600; }
.ml-row a { color:var(--accent-2); }
.ml-row.ml-warn { color:var(--error); }
.ml-toggle { border:1px solid var(--border); background:var(--surface); color:var(--accent);
  font:inherit; font-size:13px; padding:6px 10px; border-radius:var(--radius-sm); cursor:pointer;
  white-space:nowrap; }
.ml-toggle:hover { background:var(--accent-wash); border-color:var(--border-focus); }
.ml-chev { opacity:.7; margin-left:2px; }
.ml-panel { margin-top:10px; padding:12px; border:1px solid var(--border);
  border-radius:var(--radius-sm); background:var(--surface); }

/* download is an account feature — the locked affordance still looks like a button */
.dl-locked { text-decoration:none; opacity:.75; }
.dl-locked:hover { opacity:1; }

/* ── rendered prompt preview (MASEMiner builder) ────────────────────────────── */
/* The preset prompts are markdown; rendering them beats a wall of monospace. */
.md-preview { max-height: 340px; overflow: auto; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
  line-height: 1.6; color: var(--text); }
.md-preview > :first-child { margin-top: 0; }
.md-preview > :last-child { margin-bottom: 0; }
.md-preview p { margin: 0 0 9px; }
.md-preview .md-h { font-weight: 600; line-height: 1.3; color: var(--accent); }
.md-preview .md-h1 { font-size: 15px; margin: 18px 0 8px; padding-bottom: 5px;
  border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
.md-preview .md-h2 { font-size: 13.5px; margin: 14px 0 6px; }
.md-preview .md-h3, .md-preview .md-h4 { font-size: 13px; margin: 12px 0 5px; color: var(--text); }
.md-preview .md-list { margin: 0 0 9px; padding-left: 20px; }
.md-preview .md-list li { margin: 2px 0; }
.md-preview code { font-family: var(--font-mono); font-size: 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; }
.md-preview .md-code { font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap;
  overflow-x: auto; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 10px; }
.md-preview .md-code code { background: none; border: none; padding: 0; }

/* ── a task that isn't shipping yet ─────────────────────────────────────────── */
.task-card.soon { cursor: not-allowed; opacity: .55; background: var(--bg); }
.task-card.soon:hover { border-color: var(--border); box-shadow: none; transform: none; }
.soon-badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-muted); }

/* ── preset editor: live validation + preview ───────────────────────────────── */
.pe-check { margin: 4px 0 12px; font-size: 13px; }
.pe-ok { color: var(--success); }
.pe-warn { color: var(--conf-med); margin-top: 4px; }
.pe-warn ul, .pe-err ul { margin: 4px 0 0; padding-left: 18px; }
.pe-err { color: var(--error); background: var(--error-bg); border: 1px solid var(--error); border-radius: var(--radius-sm); padding: 8px 12px; }
.pe-preview { margin: 0 0 14px; }
.pe-preview > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.pe-preview .md-preview { margin-top: 8px; max-height: 420px; }

/* brand surfaces: MASEMiner's extract page is one workflow — the other task cards stay out of sight */
.brand-maseminer .task-card[data-task]:not([data-task="workflow"]) { display: none; }

/* dataset publishing details */
.kw { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-wash); color: var(--accent);
  font-size: 12px; margin: 2px 2px 0 0; }
.ds-kws { margin: 4px 0 8px; }
.ds-desc { margin: 0 0 8px; }
.ds-readme { font-size: 13.5px; line-height: 1.5; }
.ds-readme h3, .ds-readme h4, .ds-readme h5, .ds-readme h6 { font-size: 15px; margin: 12px 0 4px; }   /* renderMarkdown maps # → h3, ## → h4 … */
.ds-cite blockquote { margin: 4px 0 8px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--bg); font-size: 13px; }
.ds-form { display: flex; flex-direction: column; gap: 10px; }
.ds-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ds-form label.radio { flex-direction: row; align-items: center; gap: 6px; }
.ds-form input[type="text"], .ds-form textarea { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.ds-form .pd-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* catalogue: paper coverage check */
.paper-check { margin: 6px 0 12px; }
.paper-check input { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.paper-check .pq-hit { padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: 13px; }

/* dataset page: the "create release" form */
.ds-relform { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 12px; font-size: 13px; background: var(--bg); }
.ds-relform textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 13px var(--font); background: var(--surface); color: var(--text); resize: vertical; }
.ds-relwarn { margin: 4px 0 8px; padding: 6px 10px 6px 26px; border-radius: var(--radius-sm); background: var(--override-bg); border: 1px solid var(--override-line); }

/* extract: said before any paper is dropped when a run cannot be paid for */
.nopay { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--override-bg); border: 1px solid var(--override-line); font-size: 13.5px; line-height: 1.5; }
.nopay .btn { margin-left: 6px; }
.dash-dupnote { font-size: 12.5px; margin: 0 0 10px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--override-bg); border: 1px solid var(--override-line); }
.ds-papers { max-height: 460px; overflow: auto; }
.ds-reldash { margin: 10px 0 2px; padding-top: 8px; border-top: 1px solid var(--border); display: grid; gap: 6px; }
.ds-reldash label { display: flex; gap: 8px; align-items: baseline; }
.ds-relpub { display: grid; gap: 4px; margin: 10px 0 2px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; } .ds-relpub label { display: flex; gap: 8px; align-items: baseline; }
.ds-relform input[type=text], .ds-relform input[type=url] { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 13px var(--font); background: var(--surface); color: var(--text); }
.dbs-in { display: block; width: 100%; margin-top: 6px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 13px var(--font); background: var(--surface); color: var(--text); }
#dbs-ds { padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 13px var(--font); background: var(--surface); color: var(--text); }
.pt-foot { font-size: 12px; color: var(--text-muted); margin: 4px 2px 0; }

/* the Dashboards page: picture tiles (image, kicker, serif headline, one line, authors) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 22px; margin: 6px 0 12px; }
.tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tile:hover { box-shadow: var(--shadow-md); border-color: var(--accent-3); }
.tile-a { display: block; color: inherit; text-decoration: none; }
.tile-a:hover { text-decoration: none; } .tile-a:hover .tile-h { color: var(--accent); }
.tile-img { aspect-ratio: 1200 / 630; background: var(--bg); border-bottom: 1px solid var(--border); overflow: hidden; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.tile-ph, .tile-sketch { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 14px 18px; }
.tile-sketch svg, .tile-ph svg { width: 100%; height: 100%; }
.tile-body { padding: 14px 16px 6px; }
.tile-k { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--accent-2); margin-bottom: 6px; }
.tile-new { color: var(--conf-med); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.tile-h { font: 600 20px/1.25 var(--font-serif); color: var(--accent-dark); margin: 0 0 8px; }
.tile-kws { display: flex; flex-wrap: wrap; gap: 3px; margin: -2px 0 8px; }
.tile-kws .kw { font-size: 11px; padding: 0 7px; color: var(--text-muted); background: var(--bg); }
.tile-p { font-size: 14px; line-height: 1.5; color: var(--text); margin: 0 0 8px; }
.tile-by { font-size: 13px; font-style: italic; color: var(--text-muted); margin: 0 0 8px; }
.tile-foot { font-size: 12px; color: var(--text-muted); padding: 8px 16px 12px; margin-top: auto; border-top: 1px solid var(--border); }
.ds-sync .lag { color: var(--conf-med); } .ds-sync.off b { color: inherit; }
.masem-edit-tools { float: right; display: inline-flex; gap: 6px; }
.masem-raw { width: 100%; box-sizing: border-box; margin: 0; max-height: 360px; overflow: auto; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
textarea.masem-raw { min-height: 360px; resize: vertical; }
.ds-cc { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.ds-cc th, .ds-cc td { text-align: left; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.ds-cc th { font-weight: 600; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.ds-cc tr.cc-mismatch td:last-child { color: var(--conf-low); font-weight: 600; }
.ds-cc tr.cc-exact td:last-child { color: var(--conf-high); }
.voc-c { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin: 6px 0; background: var(--surface); }
.voc-ch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 2px; }
.voc-ch input.voc-label { font: inherit; padding: 2px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 220px; }
.voc-ch select { font: inherit; font-size: 12.5px; }
.voc-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.voc-members .kw { font-size: 12.5px; padding: 2px 8px; } .voc-members .voc-detach { color: var(--text-muted); text-decoration: none; margin-left: 2px; }
.voc-lo { padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* the moderation queue on /dashboards, and the owner's tile-image slot on a dataset page */
.q-row { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: 10px 14px; margin-bottom: 8px; font-size: 13.5px; }
.q-row .muted { font-size: 12.5px; }
.ds-extimg { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); font-size: 13px; }
.ds-extimg[hidden] { display: none; }
