/* ==========================================================================
   SRWeb — interface mockup stylesheet
   Design tokens first, then shell, then components.
   No JS dependencies, no framework. Plain CSS custom properties.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
  /* Neutrals — the product is mostly text, so the greys do the heavy lifting */
  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #f0f2f5;
  --border:        #dfe3e8;
  --border-strong: #c3cad3;

  --text:          #1a1f26;
  --text-muted:    #5c6672;
  --text-faint:    #8b95a1;

  /* Brand — a single calm blue; everything else is semantic */
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-soft:   #e8efff;

  /* Screening decisions get their own fixed colour language.
     These three are load-bearing: users learn them in the first minute. */
  --include:       #14804a;
  --include-soft:  #e3f4ea;
  --exclude:       #c0392b;
  --exclude-soft:  #fbe9e7;
  --maybe:         #b7791f;
  --maybe-soft:    #fdf3e0;

  --radius:        8px;
  --radius-sm:     5px;
  --shadow:        0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --shadow-lg:     0 4px 12px rgba(16,24,40,.08), 0 12px 28px rgba(16,24,40,.10);

  --sidebar-w:     232px;
  --topbar-h:      56px;


  /* Surfaces that vary by theme but aren't part of the core scale */
  --avatar-bg:     #dbe4f0;
  --avatar-fg:     #33507a;
  --prose:         #2c333c;
  --highlight:     #fff3bf;
  --highlight-fg:  #1a1f26;
  --ai-body-fg:    #33456b;
  --excl-border:   #f0c8c2;
  --final-border:  #b8ddc6;
  --note-bg:       #fffdf5;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Dark theme. Tokens only — components never reference colours directly,
   so redefining this set is enough to reskin the whole app.
   Guarded so an explicit light choice still beats a dark OS setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #12151a;
    --surface:       #1a1e25;
    --surface-2:     #232830;
    --border:        #2e343e;
    --border-strong: #414956;

    --text:          #e6e9ee;
    --text-muted:    #a3acb9;
    --text-faint:    #78828f;

    --accent:        #4d84f5;
    --accent-hover:  #6b9bff;
    --accent-soft:   #1c2942;

    --include:       #3dbd7d;
    --include-soft:  #14301f;
    --exclude:       #e8695a;
    --exclude-soft:  #331b18;
    --maybe:         #dda43c;
    --maybe-soft:    #33270f;

    --shadow:    0 1px 2px rgba(0,0,0,.34), 0 1px 3px rgba(0,0,0,.28);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.36), 0 12px 28px rgba(0,0,0,.32);

    --avatar-bg:     #2c3a4f;
    --avatar-fg:     #b9cbe4;
    --prose:         #d3d8e0;
    --highlight:     #5c4a12;
    --highlight-fg:  #f5e9c4;
    --ai-body-fg:    #b3c5e8;
    --excl-border:   #5c322c;
    --final-border:  #2a5c3f;
    --note-bg:       #221f16;
  }
}
:root[data-theme="dark"] {
  --bg:            #12151a;
  --surface:       #1a1e25;
  --surface-2:     #232830;
  --border:        #2e343e;
  --border-strong: #414956;

  --text:          #e6e9ee;
  --text-muted:    #a3acb9;
  --text-faint:    #78828f;

  --accent:        #4d84f5;
  --accent-hover:  #6b9bff;
  --accent-soft:   #1c2942;

  --include:       #3dbd7d;
  --include-soft:  #14301f;
  --exclude:       #e8695a;
  --exclude-soft:  #331b18;
  --maybe:         #dda43c;
  --maybe-soft:    #33270f;

  --shadow:    0 1px 2px rgba(0,0,0,.34), 0 1px 3px rgba(0,0,0,.28);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.36), 0 12px 28px rgba(0,0,0,.32);

  --avatar-bg:     #2c3a4f;
  --avatar-fg:     #b9cbe4;
  --prose:         #d3d8e0;
  --highlight:     #5c4a12;
  --highlight-fg:  #f5e9c4;
  --ai-body-fg:    #b3c5e8;
  --excl-border:   #5c322c;
  --final-border:  #2a5c3f;
  --note-bg:       #221f16;
}

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }

/* ==========================================================================
   Shell: topbar + sidebar + main
   ========================================================================== */
.app { display: flex; flex-direction: column; min-height: 100vh; }

/* --- Topbar --------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
}
.logo-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent);
  color: #fff; font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
}
.topbar-divider { width: 1px; height: 24px; background: var(--border); }

/* Project switcher — the anchor for "which review am I in" */
.project-switch {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 340px;
}
.project-switch:hover { background: var(--surface-2); }
.project-switch .name {
  font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.project-switch .caret { color: var(--text-faint); font-size: 10px; }

.topbar-spacer { flex: 1; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--avatar-bg); color: var(--avatar-fg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}

/* --- Body split ----------------------------------------------------------- */
.body { display: flex; flex: 1; min-height: 0; }

/* --- Sidebar -------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  display: flex; flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 10px 10px 4px;
}

/* Each stage row carries: state dot, label, and a count badge.
   The dot is what makes pipeline progress readable at a glance. */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}
.nav-item .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong); flex: 0 0 7px;
}
.nav-item .dot.done    { background: var(--include); }
.nav-item .dot.current { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nav-item .label { flex: 1; }
.nav-item .count {
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--text-faint); font-weight: 500;
}
.nav-item.active .count { color: var(--accent-hover); }

.sidebar-foot { margin-top: auto; padding: 10px; }

/* --- Main ----------------------------------------------------------------- */
.main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
.main-wide { max-width: 1180px; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 20px;
}
.page-head .titles { flex: 1; min-width: 0; }
.page-head h1 { font-size: 21px; }
.page-head .sub { color: var(--text-muted); margin-top: 3px; }
.page-head .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ==========================================================================
   Primitives
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-head h2 { font-size: 15px; }
.card-head .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag-include { background: var(--include-soft); color: var(--include); border-color: transparent; }
.tag-exclude { background: var(--exclude-soft); color: var(--exclude); border-color: transparent; }
.tag-maybe   { background: var(--maybe-soft);   color: var(--maybe);   border-color: transparent; }
.tag-ai      { background: var(--accent-soft);  color: var(--accent-hover); border-color: transparent; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono  { font-family: var(--mono); font-size: 12.5px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Stat tiles ----------------------------------------------------------- */
.stat { padding: 16px 18px; }
.stat .k {
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint);
}
.stat .v {
  font-size: 27px; font-weight: 650; letter-spacing: -0.02em;
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.stat .d { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* --- Progress ------------------------------------------------------------- */
.bar {
  height: 7px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
  display: flex;
}
.bar > span { display: block; height: 100%; }
.bar .fill-accent  { background: var(--accent); }
.bar .fill-include { background: var(--include); }
.bar .fill-exclude { background: var(--exclude); }
.bar .fill-maybe   { background: var(--maybe); }

/* --- Table ---------------------------------------------------------------- */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky; top: 0;
}
.tbl td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }

/* --- Forms ---------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-weight: 600; font-size: 12.5px;
  margin-bottom: 5px;
}
.field .hint { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 84px; resize: vertical; }

/* ==========================================================================
   Screening — the screen users spend 90% of their time in
   ========================================================================== */
.screen-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

/* Full text works the other way round: the paper is the thing being read,
   so it takes the wide column and the assessment sits beside it. */
.ft-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) {
  .ft-layout { grid-template-columns: 1fr; }
}

/* Queue list on the left */
.queue { max-height: calc(100vh - 190px); overflow-y: auto; }
.queue-item {
  display: block; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.queue-item:hover { background: var(--surface-2); }
.queue-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.queue-item .qt {
  font-weight: 500; font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.queue-item .qm {
  font-size: 11.5px; color: var(--text-faint);
  margin-top: 3px; display: flex; align-items: center; gap: 6px;
}

/* The record card itself */
.record { padding: 24px 26px; }
.record h2 { font-size: 18px; line-height: 1.35; }
.record .meta {
  color: var(--text-muted); font-size: 13px; margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.record .abstract {
  margin-top: 18px; font-size: 14.5px; line-height: 1.65;
  color: var(--prose); max-width: 68ch;
}
.record .abstract mark {
  background: var(--highlight); color: var(--highlight-fg); padding: 1px 2px; border-radius: 2px;
}

/* AI suggestion strip — clearly machine output, visually separated */
.ai-strip {
  margin-top: 20px; padding: 13px 15px;
  border: 1px solid var(--accent);
  border-left-width: 3px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.ai-strip .ai-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 12.5px; color: var(--accent-hover);
}
.ai-strip .ai-body { margin-top: 6px; font-size: 13px; color: var(--ai-body-fg); }

/* Decision bar — sticky so it never scrolls away mid-abstract */
.decision-bar {
  position: sticky; bottom: 0;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; gap: 10px;
}
.dbtn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600;
}
.dbtn kbd {
  font-family: var(--mono); font-size: 10.5px;
  padding: 1px 5px; border-radius: 3px;
  background: rgba(255,255,255,.28); border: 1px solid rgba(255,255,255,.35);
}
.dbtn-include { background: var(--include); color: #fff; }
.dbtn-exclude { background: var(--exclude); color: #fff; }
.dbtn-maybe   { background: var(--maybe);   color: #fff; }
.dbtn:hover { filter: brightness(1.07); }

/* ==========================================================================
   PRISMA flow diagram — pure CSS boxes, no library
   ========================================================================== */
.prisma { display: flex; flex-direction: column; align-items: center; gap: 0; }
.prisma-row { display: flex; align-items: center; gap: 22px; }
.prisma-box {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); padding: 12px 16px;
  min-width: 240px; text-align: center;
}
.prisma-box .pv { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.prisma-box .pl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.prisma-box.excl { background: var(--exclude-soft); border-color: var(--excl-border); }
.prisma-box.final { background: var(--include-soft); border-color: var(--final-border); }
.prisma-arrow { width: 1px; height: 26px; background: var(--border-strong); position: relative; }
.prisma-arrow::after {
  content: ""; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 6px solid var(--border-strong);
}
.prisma-side { width: 22px; height: 1px; background: var(--border-strong); }

/* ==========================================================================
   Misc
   ========================================================================== */
.empty {
  padding: 44px 20px; text-align: center; color: var(--text-muted);
}
.empty .icon { font-size: 28px; opacity: .5; }
.empty h3 { margin-top: 10px; font-size: 15px; color: var(--text); }
.empty p { margin-top: 4px; }

.mock-note {
  margin: 0 0 18px; padding: 9px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--note-bg); color: var(--text-muted); font-size: 12.5px;
}

@media (max-width: 1000px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: 1fr; }
  .screen-layout { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Dual-reviewer screening
   The AI is a reviewer of record here, not an advisor — so its verdict uses
   the same vote chip as a human's, distinguished by the ◆ mark and border,
   never by being visually weaker.
   ========================================================================== */

/* Who is screening: shown as a persistent strip so the mode is never ambiguous */
.reviewer-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.reviewer-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12.5px; font-weight: 500;
}
.reviewer-chip .who { font-weight: 600; }
.reviewer-chip.is-ai { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.reviewer-chip .mini-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--avatar-bg); color: var(--avatar-fg);
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}

/* A single reviewer's verdict on a record */
.vote {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650;
  border: 1px solid transparent;
}
.vote-include { background: var(--include-soft); color: var(--include); }
.vote-exclude { background: var(--exclude-soft); color: var(--exclude); }
.vote-maybe   { background: var(--maybe-soft);   color: var(--maybe); }
.vote-pending  { background: var(--surface-2); color: var(--text-faint); }

/* Two verdicts side by side, with the agreement state between them */
.vote-pair { display: flex; align-items: center; gap: 9px; }
.vote-pair .vs {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--text-faint); text-transform: uppercase;
}

/* Conflict rows get a left stripe so they're findable while scrolling */
.conflict-row { border-left: 3px solid var(--maybe); }
.agree-row    { border-left: 3px solid transparent; }

/* The adjudication card: two columns of reasoning, one decision below */
.adjudicate { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.adjudicate > div { padding: 16px 18px; }
.adjudicate > div:first-child { border-right: 1px solid var(--border); }
.adjudicate .adj-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 10px;
}
.adjudicate .adj-reason {
  font-size: 13px; line-height: 1.6; color: var(--prose);
  margin-top: 10px;
}
.adjudicate .adj-quote {
  margin-top: 10px; padding: 9px 12px;
  border-left: 2px solid var(--border-strong);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px; color: var(--text-muted);
}

/* Agreement stats */
.agreement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.agreement-grid .ag { text-align: center; padding: 12px; }
.agreement-grid .ag .agv {
  font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.agreement-grid .ag .agl { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

@media (max-width: 900px) {
  .adjudicate { grid-template-columns: 1fr; }
  .adjudicate > div:first-child { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ==========================================================================
   Screening sub-navigation + coverage policy
   ========================================================================== */

/* Filter row: conflicts live here as a state, not a separate destination */
.filter-row {
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-row .fchip {
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.filter-row .fchip:hover { background: var(--surface-2); color: var(--text); }
.filter-row .fchip.on {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.filter-row .fchip .n { font-variant-numeric: tabular-nums; opacity: .8; }
.filter-row .fchip.alert { border-color: var(--maybe); color: var(--maybe); }
.filter-row .fchip.alert.on { background: var(--maybe); border-color: var(--maybe); color: #fff; }

/* Coverage meter — how many verdicts a record has vs. how many the policy needs */
.coverage {
  display: inline-flex; align-items: center; gap: 5px;
}
.coverage .pip {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
}
.coverage .pip.filled  { background: var(--include); border-color: var(--include); }
.coverage .pip.ai      { background: var(--accent);  border-color: var(--accent); }
.coverage .pip.clash   { background: var(--maybe);   border-color: var(--maybe); }

/* Policy editor rows */
.policy-row {
  display: grid;
  grid-template-columns: 1.4fr 150px 130px 1fr;
  gap: 14px; align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.policy-row:last-child { border-bottom: none; }
.policy-row .pname { font-weight: 600; font-size: 13px; }
.policy-row .pdesc { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.stepper {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  overflow: hidden;
}
.stepper button {
  border: none; background: var(--surface); color: var(--text-muted);
  padding: 5px 11px; font-size: 14px; line-height: 1;
}
.stepper button:hover { background: var(--surface-2); color: var(--text); }
.stepper .val {
  padding: 5px 13px; font-weight: 650; font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  min-width: 38px; text-align: center;
}

/* Toggle switch */
.toggle {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; cursor: pointer;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 38px; height: 22px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  transition: background .15s ease;
  flex-shrink: 0;
}
.toggle .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s ease;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Role badges */
.role {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.role-owner { background: var(--accent-soft); color: var(--accent-hover); border-color: transparent; }
.role-adj   { background: var(--maybe-soft);  color: var(--maybe);        border-color: transparent; }

/* Self-adjudication warning */
.self-warn {
  border: 1px solid var(--maybe);
  border-left-width: 3px;
  background: var(--maybe-soft);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.self-warn .sw-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 650; font-size: 12.5px; color: var(--maybe);
}

/* Work-in-progress placeholder */
.wip {
  padding: 56px 28px; text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.wip .wip-tag {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  background: var(--maybe-soft); color: var(--maybe);
  font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
}
.wip h2 { font-size: 19px; margin-top: 14px; }
.wip p { color: var(--text-muted); margin-top: 8px; max-width: 56ch; margin-left: auto; margin-right: auto; }
.wip .wip-open {
  margin-top: 22px; text-align: left; max-width: 480px;
  margin-left: auto; margin-right: auto;
  border-top: 1px solid var(--border); padding-top: 18px;
}
.wip .wip-open h3 {
  font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 9px;
}
.wip .wip-open li { font-size: 13px; color: var(--text-muted); margin-bottom: 7px; line-height: 1.5; }

@media (max-width: 900px) {
  .policy-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ==========================================================================
   Data extraction — one question at a time
   The reviewer answers from the paper first. The AI hint is opt-in and
   recorded, so a value is either independently derived or known not to be.
   ========================================================================== */

.extract-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 18px;
  align-items: start;
}

/* --- PDF pane ------------------------------------------------------------- */
.pdf-pane { position: sticky; top: 16px; overflow: hidden; }
.pdf-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pdf-toolbar .pg {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; margin-left: auto;
}
.pdf-stage {
  background: var(--surface-2);
  height: 600px; overflow-y: auto;
  padding: 18px; display: flex; justify-content: center;
}
/* The rendered page is paper — a fixed light sheet in both themes. */
.pdf-page {
  width: 100%; max-width: 560px;
  background: #ffffff; color: #1a1f26;
  border: 1px solid #d8dde4;
  box-shadow: 0 2px 10px rgba(16,24,40,.14);
  padding: 30px 34px;
  font-size: 11px; line-height: 1.65;
}
.pdf-page .pp-jrnl {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: #98a2af;
}
.pdf-page h4 { font-size: 14px; line-height: 1.35; margin-top: 12px; color: #11161d; }
.pdf-page .pp-auth { font-size: 10px; color: #5c6672; margin-top: 6px; }
.pdf-page .pp-sec {
  font-size: 9.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: #6b7684; margin-top: 16px; margin-bottom: 5px;
}
.pdf-page p { margin-bottom: 8px; }

/* Reviewer-selected evidence. Nothing is highlighted until they choose it. */
.ev {
  background: #d9e7ff; border-bottom: 2px solid var(--accent);
  border-radius: 2px; padding: 0 2px;
}
/* A hint the AI pointed at — amber, and only visible after Show AI hint */
.ev-hint {
  background: #fff2b8; border-bottom: 2px solid #e8c63f;
  border-radius: 2px; padding: 0 2px;
}

/* --- Question card -------------------------------------------------------- */
.qpane { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }

.qcard { padding: 20px 22px; }
.qcard .q-num {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
}
.qcard .q-text {
  font-size: 17px; font-weight: 650; line-height: 1.35;
  margin-top: 7px; letter-spacing: -0.01em;
}
.qcard .q-help { font-size: 12.5px; color: var(--text-muted); margin-top: 7px; }

.q-answer { margin-top: 18px; }
.q-answer label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 6px;
}
.q-input {
  width: 100%; padding: 11px 13px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.q-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Evidence the reviewer anchored themselves */
.q-ev {
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.5;
}
.q-ev.empty { border-style: dashed; font-style: italic; color: var(--text-faint); }
.q-ev .q-ev-src {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; font-size: 11.5px; color: var(--text-faint);
}

/* --- The AI hint: opt-in, and costly ------------------------------------- */
.hint-ask {
  margin-top: 16px; padding: 13px 15px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 12px;
}
.hint-ask .ha-copy { flex: 1; font-size: 12.5px; color: var(--text-muted); }

.hint-open {
  margin-top: 16px;
  border: 1px solid var(--maybe); border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--maybe-soft);
  padding: 13px 15px;
}
.hint-open .ho-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--maybe);
  letter-spacing: .03em;
}
.hint-open .ho-val {
  font-size: 15px; font-weight: 650; margin-top: 8px;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.hint-open .ho-quote {
  font-size: 12.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.5;
}
.hint-open .ho-note {
  font-size: 11.5px; color: var(--maybe); margin-top: 9px;
  padding-top: 9px; border-top: 1px solid rgba(183,121,31,.25);
}

/* --- Question navigation -------------------------------------------------- */
.q-nav {
  display: flex; align-items: center; gap: 9px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Compact progress rail: every question as a dot */
.q-rail {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 14px 16px;
}
.q-rail .qd {
  width: 24px; height: 24px; border-radius: 5px;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; font-family: inherit;
  background: var(--surface-2); color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 0; cursor: pointer;
  transition: transform .08s ease;
}
.q-rail .qd:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.q-rail .qd:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Three states only — whether the answer is settled, not how it was reached.
   Hint use is recorded in the audit trail, never shown here: it is disclosure,
   not a problem, and colouring it would discourage a legitimate tool. */
.q-rail .qd.done   { background: var(--include-soft); color: var(--include); border-color: transparent; }
.q-rail .qd.review { background: var(--maybe-soft);   color: var(--maybe);   border-color: transparent; }
/* Current question wins over any state class, whatever the source order. */
.q-rail .qd.on.on {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- Cross-check ---------------------------------------------------------- */
.reconcile {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; margin-top: 12px;
}
.reconcile > div { background: var(--surface); padding: 11px 13px; }
.reconcile .rc-who {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-faint);
  margin-bottom: 6px;
}
.reconcile .rc-val {
  font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.reconcile .rc-quote {
  font-size: 11.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.45;
}

/* Verification chain, compact */
.chain { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.chain .link {
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-faint); font-weight: 600;
}
.chain .link.ai    { background: var(--maybe-soft);   color: var(--maybe);   border-color: transparent; }
.chain .link.done  { background: var(--include-soft); color: var(--include); border-color: transparent; }
.chain .link.wait  { border-style: dashed; }
.chain .link.clash { background: var(--exclude-soft); color: var(--exclude); border-color: transparent; }
.chain .arrow { color: var(--border-strong); font-size: 10px; }

/* Study switcher */
.study-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.study-pill {
  flex-shrink: 0; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 7px;
}
.study-pill:hover { background: var(--surface-2); color: var(--text); }
.study-pill.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; }
.study-pill .sp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.study-pill .sp-dot.done    { background: var(--include); }
.study-pill .sp-dot.partial { background: var(--maybe); }
.study-pill.on .sp-dot { background: rgba(255,255,255,.85); }

/* Field class badge */
.fclass {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.fclass-critical { background: var(--exclude-soft); color: var(--exclude); }
.fclass-standard { background: var(--surface-2);   color: var(--text-faint); }

@media (max-width: 1100px) {
  .extract-layout { grid-template-columns: 1fr; }
  .pdf-pane, .qpane { position: static; }
  .reconcile { grid-template-columns: 1fr; }
}

/* One question visible at a time; the rail swaps which. */
.qslide { display: none; }
.qslide.is-on { display: block; }

/* Evidence highlight only shows for the active question's passage */
.ev { display: inline; }
.ev.dim { background: transparent; border-bottom-color: transparent; }

/* "Not reported" recorded state */
.q-notrep {
  margin-top: 12px; padding: 10px 12px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--text-muted); font-style: italic;
}

/* ==========================================================================
   Disagreement: an inline banner on the question, and a modal to resolve it.
   The banner belongs on the question (it is a fact about this field).
   The resolution is an occasional task, so it gets a modal, not a permanent pane.
   ========================================================================== */

/* --- Inline notice on the question card --------------------------------- */
.disagree-note {
  margin-top: 16px; padding: 12px 14px;
  border: 1px solid var(--exclude); border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--exclude-soft);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.disagree-note .dn-body { flex: 1; min-width: 190px; }
.disagree-note .dn-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--exclude);
}
.disagree-note .dn-copy {
  font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5;
}

/* Topbar bell */
.bell { position: relative; display: inline-flex; }
.bell .bell-dot {
  position: absolute; top: -2px; right: -2px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--exclude); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center;
  border: 2px solid var(--surface);
}

/* --- Modal ---------------------------------------------------------------- */
.modal-veil {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 24, 40, .55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.modal-veil.is-on { display: flex; }

.modal {
  width: 100%; max-width: 660px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.modal-head {
  padding: 17px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.modal-head .mh-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--exclude);
}
.modal-head h2 { font-size: 17px; margin-top: 7px; line-height: 1.3; }
.modal-head .mh-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }
.modal-x {
  border: none; background: transparent; color: var(--text-faint);
  font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: var(--radius-sm);
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 0; }
.modal-foot {
  padding: 15px 20px; background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* Where the two readings differ, spelled out */
.diff-note {
  margin: 15px 20px; padding: 10px 13px;
  background: var(--maybe-soft); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text); line-height: 1.5;
}
.diff-note strong { color: var(--maybe); }

/* Candidate readings */
.reading {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 13px; align-items: flex-start; cursor: pointer;
}
.reading:hover { background: var(--surface-2); }
.reading .rd-pick { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; }
.reading .rd-body { flex: 1; min-width: 0; }
.reading .rd-who {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 650; color: var(--text-muted);
}
.reading .rd-val {
  font-size: 17px; font-weight: 700; margin-top: 5px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.reading .rd-quote {
  font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5;
  padding-left: 10px; border-left: 2px solid var(--border);
}
.reading.picked { background: var(--include-soft); }
.reading.picked:hover { background: var(--include-soft); }
.reading.picked .rd-val { color: var(--include); }

/* The self-fix path — cheapest resolution, so it reads as ordinary, not alarming */
.self-fix {
  margin: 15px 20px 0; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.5;
}

/* Rail legend — three states, matching the squares exactly. */
.rail-key {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 0 16px 14px;
  font-size: 11.5px; color: var(--text-muted);
}
.rail-key span { display: inline-flex; align-items: center; gap: 6px; }
.rail-key i {
  width: 11px; height: 11px; border-radius: 3px; display: inline-block;
  border: 1px solid var(--border);
}
.rail-key i.k-done   { background: var(--include-soft); border-color: transparent; }
.rail-key i.k-review { background: var(--maybe-soft);   border-color: transparent; }
.rail-key i.k-todo   { background: var(--surface-2); }

/* ==========================================================================
   Overview — built for someone tired, opening the tool to find their next task
   One question: what do I do now? Reference numbers live on their own stages.
   ========================================================================== */

.ov-wrap { max-width: 780px; }

/* Greeting + the single most useful sentence */
.ov-head { margin-bottom: 26px; }
.ov-head h1 {
  font-size: 25px; letter-spacing: -0.02em;
}
.ov-head .ov-line {
  font-size: 15px; color: var(--text-muted); margin-top: 8px; line-height: 1.5;
}
.ov-head .ov-line strong { color: var(--text); font-weight: 650; }

/* The primary action — one button, unmissable */
.ov-cta {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; margin-bottom: 26px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.ov-cta .cta-body { flex: 1; min-width: 220px; }
.ov-cta .cta-what { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.ov-cta .cta-why { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Task list — everything waiting on this person, nothing else */
.ov-task {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.ov-task:last-child { border-bottom: none; }
.ov-task:hover { background: var(--surface-2); }
.ov-task .t-count {
  flex-shrink: 0; min-width: 38px; text-align: center;
  font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.ov-task .t-body { flex: 1; min-width: 0; }
.ov-task .t-what { font-size: 14px; font-weight: 600; }
.ov-task .t-where { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.ov-task .t-go { color: var(--text-faint); font-size: 15px; flex-shrink: 0; }
.ov-task:hover .t-go { color: var(--accent); }

.t-count.urgent { color: var(--exclude); }
.t-count.soon   { color: var(--maybe); }
.t-count.calm   { color: var(--text-muted); }

/* Single quiet progress line, no chart */
.ov-progress {
  margin-top: 26px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ov-progress .op-top {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px;
}
.ov-progress .op-stage { font-size: 13.5px; font-weight: 650; }
.ov-progress .op-n {
  font-size: 12.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums; margin-left: auto;
}
.ov-progress .op-foot {
  font-size: 12.5px; color: var(--text-muted); margin-top: 10px;
}

/* All-clear state */
.ov-clear {
  padding: 34px 22px; text-align: center;
  color: var(--text-muted);
}
.ov-clear .oc-mark { font-size: 24px; color: var(--include); }
.ov-clear h3 { font-size: 15px; color: var(--text); margin-top: 8px; }

/* ==========================================================================
   Project completion — one number, based on papers reaching a terminal state.
   A paper is resolved when it is excluded, or included AND extracted.
   Anything else is still in flight, however far through the stages it is.
   ========================================================================== */

.done-card { padding: 20px 22px; }

.done-top {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px;
}
.done-top .dt-label { font-size: 13.5px; font-weight: 650; }
.done-top .dt-pct {
  margin-left: auto;
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.done-top .dt-frac {
  font-size: 12.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Segmented bar: the two resolved kinds, then the remainder */
.done-bar {
  height: 12px; border-radius: 999px; overflow: hidden;
  display: flex; background: var(--surface-2);
}
.done-bar > span { display: block; height: 100%; }
.done-bar .seg-excluded { background: var(--text-faint); }
.done-bar .seg-extracted { background: var(--include); }

/* The breakdown beneath — three lines, no chart */
.done-key { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.done-key .dk-row {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.done-key .dk-swatch {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.done-key .dk-swatch.s-excluded  { background: var(--text-faint); }
.done-key .dk-swatch.s-extracted { background: var(--include); }
.done-key .dk-swatch.s-flight    { background: var(--surface-2); border: 1px solid var(--border-strong); }
.done-key .dk-n {
  font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 26px; text-align: right;
}
.done-key .dk-what { color: var(--text-muted); }
.done-key .dk-row.muted-row .dk-what { color: var(--text-faint); }

/* Where the in-flight papers are stuck — indented, quiet */
.done-flight {
  margin-top: 8px; margin-left: 20px;
  display: flex; flex-direction: column; gap: 5px;
}
.done-flight a {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-faint);
}
.done-flight a:hover { color: var(--accent); }
.done-flight .df-n {
  font-variant-numeric: tabular-nums; font-weight: 650;
  min-width: 20px; text-align: right;
}

/* ==========================================================================
   Eligibility criteria — one list. PICO is a tag on a criterion, not a
   parallel form: writing "adults with T2DM" in both places was redundant,
   but design/language/date rules have no PICO home, so criteria are primary.
   ========================================================================== */

.crit-row {
  display: grid;
  grid-template-columns: 26px 1fr 132px 40px;
  gap: 11px; align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.crit-row:last-of-type { border-bottom: none; }
.crit-grip { color: var(--text-faint); cursor: grab; text-align: center; font-size: 13px; }

.crit-rule {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; flex-shrink: 0;
}
.crit-rule.inc { background: var(--include-soft); color: var(--include); }
.crit-rule.exc { background: var(--exclude-soft); color: var(--exclude); }

.crit-group-head {
  display: flex; align-items: center; gap: 9px;
  margin: 18px 0 4px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.crit-group-head:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.crit-group-head h3 { font-size: 13px; }
.crit-group-head .cg-n { font-size: 12px; color: var(--text-faint); margin-left: auto; }

/* PICO tag on a criterion — a label, not a section */
.pico-tag {
  font-size: 11px; font-weight: 650;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.pico-tag.none { color: var(--text-faint); font-style: italic; font-weight: 500; }

/* Coverage row — humans only now */
.cov-row {
  display: grid;
  grid-template-columns: 1.5fr 160px 1fr;
  gap: 16px; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.cov-row:last-child { border-bottom: none; }
.cov-row .cv-name { font-weight: 650; font-size: 13.5px; }
.cov-row .cv-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.cov-row .cv-effect { font-size: 12.5px; color: var(--text-muted); }

/* ==========================================================================
   Settings — API credentials. Per person, never shared with the team.
   ========================================================================== */

.key-state {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  flex-wrap: wrap;
}
.key-state.set { border-color: var(--include); background: var(--include-soft); }
.key-state .ks-icon { font-size: 16px; flex-shrink: 0; }
.key-state .ks-body { flex: 1; min-width: 200px; }
.key-state .ks-what { font-size: 13.5px; font-weight: 650; }
.key-state .ks-detail {
  font-size: 12.5px; color: var(--text-muted); margin-top: 3px;
  font-family: var(--mono);
}

.privacy-note {
  margin-top: 14px; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
}
.privacy-note strong { color: var(--text); }

/* ==========================================================================
   Extraction form builder — one block per field, not a table row.
   A field is a question plus the guidance that makes two reviewers answer it
   the same way, so the description needs room to be a real sentence.
   ========================================================================== */

.xf-def {
  display: grid;
  grid-template-columns: 24px 1fr 210px;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.xf-def:last-of-type { border-bottom: none; }
.xf-def .xd-grip {
  color: var(--text-faint); cursor: grab;
  text-align: center; font-size: 13px; padding-top: 8px;
}

.xf-def .xd-main { min-width: 0; }
.xf-def .xd-q {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600;
}
.xf-def .xd-q:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* The description: what reviewers see under the question while extracting */
.xf-def .xd-desc {
  width: 100%; margin-top: 7px; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-muted);
  font: inherit; font-size: 12.5px; line-height: 1.5;
  resize: vertical; min-height: 38px;
}
.xf-def .xd-desc:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.xf-def .xd-desc::placeholder { font-style: italic; }

.xf-def .xd-hint-label {
  font-size: 11px; color: var(--text-faint); margin-top: 5px;
  display: flex; align-items: center; gap: 5px;
}

.xf-def .xd-side { display: flex; flex-direction: column; gap: 9px; }
.xf-def .xd-side .xs-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
}
.xf-def .xd-side .xs-row select { font-size: 12px; padding: 4px 8px; }
.xf-def .xd-side .xs-label { min-width: 62px; }
.xf-def .xd-del {
  align-self: flex-end; margin-top: auto;
}

/* ==========================================================================
   Add papers — one input area, switchable between ingest modes.
   A switcher rather than stacked cards, so adding RIS / citation chasing
   later costs a tab instead of another block of page.
   ========================================================================== */

.mode-tabs {
  display: flex; gap: 4px; align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.mode-tabs button {
  padding: 10px 15px; font-size: 13px; font-weight: 550;
  color: var(--text-muted); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.mode-tabs button:hover { color: var(--text); }
.mode-tabs button[aria-selected="true"] {
  color: var(--accent-hover); border-bottom-color: var(--accent); font-weight: 650;
}
.mode-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.mode-panel { display: none; padding: 20px 22px; }
.mode-panel.is-on { display: block; }

/* DOI textarea — monospace, since identifiers are being read character by character */
.doi-input {
  width: 100%; min-height: 168px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.85;
  resize: vertical;
}
.doi-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.doi-input::placeholder { color: var(--text-faint); }

.doi-foot {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; flex-wrap: wrap;
}
.doi-count {
  font-size: 12.5px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.doi-count strong { color: var(--text); }

/* ==========================================================================
   Search mode — an agent proposes papers, a human admits them.
   Results are candidates, never imports: nothing enters the pool unticked.
   ========================================================================== */

.search-bar { display: flex; gap: 9px; align-items: flex-start; }
.search-bar .sq {
  flex: 1; min-height: 74px; padding: 11px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; line-height: 1.55; resize: vertical;
}
.search-bar .sq:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.src-picks { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 11px; }
.src-picks label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-muted);
}

/* Agent progress — what it did, so the search is describable afterwards */
.agent-log {
  margin-top: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
  padding: 13px 15px;
}
.agent-log .al-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  letter-spacing: .03em;
}
.agent-log .al-step {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12.5px; color: var(--text-muted);
  margin-top: 8px; line-height: 1.5;
}
.agent-log .al-tick { color: var(--include); flex-shrink: 0; }
.agent-log .al-n {
  font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text);
}

/* Candidate papers awaiting a decision */
.cand {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.cand:last-of-type { border-bottom: none; }
.cand .cd-pick { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; }
.cand .cd-body { flex: 1; min-width: 0; }
.cand .cd-title { font-size: 13.5px; font-weight: 620; line-height: 1.4; }
.cand .cd-meta {
  font-size: 12.5px; color: var(--text-muted); margin-top: 3px;
}
.cand .cd-why {
  font-size: 12.5px; color: var(--text-muted); margin-top: 7px;
  padding-left: 10px; border-left: 2px solid var(--border);
  line-height: 1.5;
}
.cand .cd-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.cand-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 0 4px; flex-wrap: wrap;
}
.cand-head h3 { font-size: 13.5px; }
.cand-head .ch-n { font-size: 12.5px; color: var(--text-faint); }

/* Already-known papers, listed quietly so the agent's work is visible
   without cluttering the decision */
.dupe-note {
  margin-top: 14px; padding: 11px 13px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
}

/* Provenance strip — what makes this describable in a methods section */
.prov {
  margin-top: 16px; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.6;
}
.prov strong { color: var(--text); }

/* ==========================================================================
   Screening: criteria reference + optional rationale + opt-in hint
   ========================================================================== */

/* Criteria panel — collapsible, so it can sit open while you learn the rules
   and be folded away once you know them. */
.crit-ref { margin-bottom: 16px; }
.crit-ref summary {
  list-style: none; cursor: pointer;
  padding: 11px 16px;
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600;
}
.crit-ref summary::-webkit-details-marker { display: none; }
.crit-ref summary::before {
  content: "▸"; color: var(--text-faint); font-size: 11px;
  transition: transform .12s ease;
}
.crit-ref[open] summary::before { transform: rotate(90deg); }
.crit-ref summary .cr-hint {
  margin-left: auto; font-size: 12px; font-weight: 400; color: var(--text-faint);
}
.crit-ref .cr-body {
  padding: 4px 16px 15px;
  border-top: 1px solid var(--border);
}
.crit-ref .cr-col-head {
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; margin: 12px 0 7px;
}
.crit-ref .cr-col-head.inc { color: var(--include); }
.crit-ref .cr-col-head.exc { color: var(--exclude); }
.crit-ref ul { margin: 0; padding-left: 18px; }
.crit-ref li {
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 5px; line-height: 1.5;
}

/* Optional rationale under the decision buttons */
.why-box { margin-top: 14px; }
.why-box label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 6px;
}
.why-box textarea {
  width: 100%; min-height: 54px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.5; resize: vertical;
}
.why-box textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.why-box textarea::placeholder { color: var(--text-faint); }

/* --- Hint toggle ---------------------------------------------------------
   The hint can be hidden again, but the first reveal is already logged —
   collapsing is a tidiness convenience, not an undo. The prompt says so
   once it has been opened. */
.hint-wrap .hint-open { display: none; }
.hint-wrap.is-open .hint-open { display: block; }

.hint-ask.seen {
  border-style: solid;
  border-color: var(--maybe);
  background: var(--maybe-soft);
}
.hint-ask.seen .ha-copy { color: var(--maybe); }

/* --- Accept ---------------------------------------------------------------
   Accept takes the hint's answer into the reviewer's own form. It does not
   submit: the form stays editable and the act that commits is still theirs.
   That is the whole distinction from pre-filling, which we do not do. */
.ho-act {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ho-act-note { font-size: 12px; color: var(--text-muted); }
.ho-accept[disabled] { opacity: .55; cursor: default; filter: none; }

/* A decision button the reviewer has settled on. The buttons are solid by
   default, so "picked" reads as a ring plus everything else receding. */
.dbtn.is-picked { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-muted); }
.dbtn.is-picked::before { content: "\2713"; font-weight: 700; }
.has-pick .dbtn:not(.is-picked) { opacity: .38; }

/* Momentary cue that something was written into a field you did not type in.
   Without it, Accept looks like nothing happened. */
@keyframes justFilled {
  from { background: var(--accent-soft); border-color: var(--accent); }
  to   { background: var(--surface); }
}
.just-filled { animation: justFilled 1.4s ease-out; }


/* --- Which criteria the hint leaned on ------------------------------------
   A verdict with no criteria behind it is an opinion. When the hint is open,
   every criterion it used says what it found and quotes the text it found it
   in — so a reviewer can check the reasoning criterion by criterion instead
   of judging the conclusion whole.

   Amber throughout, the same as every other AI-sourced mark: these are claims
   awaiting a check, not findings. They appear with the hint and go with it. */
.ai-cite { display: none; }
.show-ai .ai-cite,
.ft-showai .ai-cite { display: block; }

.ai-cite {
  margin-top: 5px; padding-left: 9px;
  border-left: 2px solid #e8c63f;
  font-size: 11.5px; line-height: 1.5; color: var(--text-muted);
}
.ai-cite .aic-verdict {
  display: block;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--maybe);
  margin-bottom: 2px;
}
.ai-cite .aic-verdict::before { content: "\25C6  "; }
/* Nothing to quote — an exclusion rule that simply does not bite */
.ai-cite.aic-na { color: var(--text-faint); font-style: italic; }

/* Criteria list gets more air once each item carries a citation under it */
.crit-ref.show-ai li { margin-bottom: 10px; }

/* ==========================================================================
   Risk of bias — protocol side

   The instrument is fixed, and the interface should look fixed: no dropdown,
   no edit affordance on the domain names.
   ========================================================================== */
.rob-tool {
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.rob-tool .rt-name { font-size: 14px; font-weight: 650; }
.rob-tool .rt-fixed {
  display: inline-block; margin-left: 7px; vertical-align: 2px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border-strong); border-radius: 99px;
  padding: 1px 7px;
}
.rob-tool .rt-domains {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px;
}
.rob-tool .rt-domains span {
  font-size: 11.5px; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 10px;
}

/* ==========================================================================
   Quality appraisal — Cochrane RoB 1, one domain at a time

   RoB 1 is a study-level instrument: seven domains, each judged Low /
   Unclear / High on the reviewer's own reading, supported by a quote from
   the paper. There is no algorithm — unlike RoB 2, the reviewer judges
   directly, so the interface lets them.
   ========================================================================== */
.dom-rail { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.dom-rail .dr-btn {
  font: inherit; font-size: 12px; cursor: pointer;
  padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 7px;
}
.dom-rail .dr-btn:hover { background: var(--surface-2); color: var(--text); }
.dom-rail .dr-btn .dr-dot { font-size: 13px; line-height: 1; }
.dom-rail .dr-btn.low     .dr-dot { color: var(--include); }
.dom-rail .dr-btn.unclear .dr-dot { color: var(--maybe); }
.dom-rail .dr-btn.high    .dr-dot { color: var(--exclude); }
.dom-rail .dr-btn.todo    .dr-dot { color: var(--text-faint); }
/* Doubled for specificity: the current domain must win over its rating colour */
.dom-rail .dr-btn.on.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.dom-rail .dr-btn.on.on .dr-dot { color: #fff; }

.dslide { display: none; }
.dslide.is-on { display: block; }

/* What the domain is asking. RoB 1's prompts are short, so they read as a
   question rather than a checklist. */
.rob-q {
  margin-top: 14px; padding: 12px 14px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.55; color: var(--text-muted);
}
.rob-q strong { color: var(--text); }

/* The judgement. Chosen, not computed — that is the instrument. */
.rob-judge { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.jbtn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted);
}
.jbtn:hover { background: var(--surface-2); color: var(--text); }
.jbtn.on.jbtn-low     { background: var(--include); border-color: var(--include); color: #fff; }
.jbtn.on.jbtn-unclear { background: var(--maybe);   border-color: var(--maybe);   color: #fff; }
.jbtn.on.jbtn-high    { background: var(--exclude); border-color: var(--exclude); color: #fff; }

/* The classic Cochrane traffic light: + low, ? unclear, - high. Recognisable
   at a glance to anyone who has read a Cochrane review. */
.tl {
  display: inline-grid; place-items: center;
  width: 19px; height: 19px; border-radius: 50%;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.tl-low     { background: var(--include-soft); color: var(--include); border: 1px solid var(--include); }
.tl-unclear { background: var(--maybe-soft);   color: var(--maybe);   border: 1px solid var(--maybe); }
.tl-high    { background: var(--exclude-soft); color: var(--exclude); border: 1px solid var(--exclude); }
.tl-none    { background: var(--surface-2);    color: var(--text-faint); border: 1px solid var(--border-strong); }

/* ==========================================================================
   Full text — evidence against criteria

   At extraction, evidence attaches to a question. Here it attaches to a
   criterion, because that is the unit the verdict is actually built from:
   "included" means every inclusion rule was met, and a reviewer should be
   able to point at the sentence that met each one.

   Two colours, and the distinction is the whole point of this screen:
     .ev      blue  — a passage a person marked
     .ev-hint amber — a passage the AI pointed at, claim not yet checked
   Both defined in the PDF-pane block above; what follows is the criteria
   list that indexes into them.
   ========================================================================== */
.ev-crit { display: flex; flex-direction: column; }

.ec-row {
  display: grid; grid-template-columns: 18px 1fr;
  gap: 10px; align-items: start;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: none; border-left: 0; border-right: 0; border-top: 0;
  font: inherit; text-align: left; width: 100%;
  color: var(--text);
}
.ec-row:last-child { border-bottom: 0; }
.ec-row:hover { background: var(--surface-2); }
.ec-row.on { background: var(--accent-soft); }
.ec-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The tick reads met / not met / not yet looked at */
.ec-mark {
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; margin-top: 1px;
  border: 1.5px solid var(--border-strong); color: var(--text-faint);
}
.ec-row.met  .ec-mark { background: var(--include-soft); border-color: var(--include); color: var(--include); }
.ec-row.fail .ec-mark { background: var(--exclude-soft); border-color: var(--exclude); color: var(--exclude); }

.ec-text { font-size: 12.5px; line-height: 1.45; }
.ec-row.fail .ec-text { color: var(--exclude); }

/* The evidence a reviewer has attached to this criterion, quoted back */
.ec-ev {
  display: block; margin-top: 6px;
  font-size: 11.5px; line-height: 1.5; color: var(--text-muted);
  padding-left: 9px; border-left: 2px solid var(--accent);
}
.ec-ev .ec-pg { color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* Same quote, but sourced from the AI — amber, and labelled as a claim */
.ec-ev.from-ai { border-left-color: #e8c63f; }
.ec-ev.from-ai .ec-src {
  display: inline-block; margin-top: 3px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--maybe);
}

/* Nothing attached yet */
.ec-none {
  display: block; margin-top: 5px;
  font-size: 11.5px; font-style: italic; color: var(--text-faint);
}

/* Prompt shown when the reviewer has text selected in the PDF */
.ev-attach {
  padding: 10px 15px; border-top: 1px solid var(--border);
  background: var(--surface-2); font-size: 12px; color: var(--text-muted);
}
.ev-attach strong { color: var(--text); }

/* Passage the reviewer is hovering/selecting from the list side */
.pdf-page .ev.focus-ev {
  box-shadow: 0 0 0 3px rgba(37,99,235,.25);
}
.pdf-page .ev-hint.focus-ev {
  box-shadow: 0 0 0 3px rgba(232,198,63,.35);
}

/* AI evidence stays hidden until the hint is opened — the passage marks are
   part of the hint, not a preview of it. */
.pdf-page .ev-hint { background: transparent; border-bottom-color: transparent; }
.ft-showai .pdf-page .ev-hint {
  background: #fff2b8; border-bottom-color: #e8c63f;
}

/* ==========================================================================
   Auth pages — a single centred card, no app shell
   ========================================================================== */
.auth {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px 16px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-logo { justify-content: center; margin-bottom: 20px; font-size: 17px; }
.auth-title { font-size: 19px; margin-bottom: 18px; }
.auth-submit { width: 100%; justify-content: center; padding: 9px 13px; margin-top: 4px; }
.auth-submit:disabled { opacity: .7; cursor: default; }
.auth-error {
  margin-bottom: 16px; padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--exclude-soft); color: var(--exclude);
  font-size: 13px; font-weight: 500;
}
.auth-alt { margin-top: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.auth-alt a { color: var(--accent); font-weight: 500; }
.auth-alt a:hover { text-decoration: underline; }

/* ==========================================================================
   Account — top-bar link to settings, and the message line inside a form
   ========================================================================== */
.topbar-account {
  display: flex; align-items: center; gap: 10px;
  padding: 3px 4px 3px 10px; border-radius: 999px;
}
.topbar-account:hover { background: var(--surface-2); }

.input:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }

.form-message {
  margin-bottom: 16px; padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
}
.form-message.is-error { background: var(--exclude-soft); color: var(--exclude); }
.form-message.is-ok    { background: var(--include-soft); color: var(--include); }

/* An "i" button that opens a short explanation, so the page itself stays brief.
   The button names its panel with popovertarget; the browser opens it, closes it
   on Escape or a click elsewhere, and places it beside the button. Browsers
   without anchor positioning show the panel in the middle of the window. */
.info-btn {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: transparent; color: var(--text-muted);
  font: italic 600 11px/1 Georgia, serif;
  cursor: pointer;
}
.info-btn:hover { background: var(--surface-2); color: var(--text); }
.card-head h2 + .info-btn { margin-left: -5px; }
.page-head .title-row { display: flex; align-items: center; gap: 8px; }

/* Eligibility criteria on the Protocol page: a heading, then one line per criterion. */
.criteria-heading { font-size: 13.5px; font-weight: 650; margin-bottom: 8px; }
.selection-fields { display: flex; flex-wrap: wrap; gap: 0 16px; }
.selection-fields .field { margin-bottom: 0; }
.selection-fields .field { width: 140px; max-width: 100%; }
.selection-fields .selection-resolver { align-self: flex-end; margin: 0 0 9px; font-size: 13px; }
.criteria-heading .faint { font-weight: 400; }
.criteria { list-style: none; padding: 0; margin: 0 0 8px; }
.criterion { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.criterion .input { flex: 1; min-width: 0; }
.criterion .btn:disabled { opacity: .35; cursor: default; }
.criteria-read li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.criteria-read li:last-child { border-bottom: none; }
.field .label-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.field .label-row label { margin-bottom: 0; }
.info-pop {
  max-width: min(340px, calc(100vw - 32px)); padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text-muted); box-shadow: var(--shadow-lg);
  font-size: 12.5px; font-weight: 400; line-height: 1.55;
}
.info-pop p + p { margin-top: 8px; }
@supports (position-area: bottom) {
  .info-pop {
    inset: auto; margin: 6px 0;
    position-area: bottom span-right;
    position-try-fallbacks: flip-inline, flip-block, flip-block flip-inline;
  }
}

/* ==========================================================================
   Projects — the reviews grid, the new-review dialog, not-yet-built stages
   ========================================================================== */
/* A native <dialog> wearing the .modal look; the browser supplies the focus
   trap, Escape to close, and the backdrop. */
.dialog { max-width: 460px; padding: 0; color: var(--text); }
.dialog::backdrop { background: rgba(16, 24, 40, .55); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.project-card { display: block; }
.project-card:hover { border-color: var(--border-strong); }
.project-card-new {
  display: grid; place-items: center; align-content: center; gap: 6px;
  min-height: 130px;
  border-style: dashed; box-shadow: none; background: transparent;
}
.project-card-new:hover { background: var(--surface); }

.nav-item.is-disabled { opacity: .55; cursor: default; }
.nav-item.is-disabled:hover { background: transparent; color: var(--text-muted); }
.team-actions { text-align: right; white-space: nowrap; }
.team-actions .btn + .btn { margin-left: 4px; }

/* One invitation on the home page: what it is for, then the two answers. */
.invitation { display: flex; align-items: center; gap: 10px; }
.invitation + .invitation { border-top: 1px solid var(--border); }

/* ==========================================================================
   Add papers — each uploaded paper with every version the sources found
   ========================================================================== */
.paper { padding: 14px 16px; border-top: 1px solid var(--border); }
.paper-head { display: flex; align-items: flex-start; gap: 10px; }
.paper-title { flex: 1; font-size: 14.5px; line-height: 1.4; }
.versions { list-style: none; margin: 10px 0 0; padding: 0; }
.version {
  display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px;
  padding: 8px 0; border-top: 1px dashed var(--border); font-size: 12.5px;
}
.version-source { font-weight: 650; color: var(--text-muted); }
.version-title { font-weight: 600; margin-bottom: 2px; }
.version-ids { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; font-size: 12px; }
.version-ids a { color: var(--accent); overflow-wrap: anywhere; }
.version-abstract { margin-top: 4px; }
.version-abstract summary { cursor: pointer; color: var(--text-muted); font-size: 12px; }
.version-abstract p { margin-top: 6px; line-height: 1.55; color: var(--text); }
@media (max-width: 640px) {
  .version { grid-template-columns: 1fr; gap: 2px; }
}
.paper-head .btn { flex: none; }
.more-versions { margin-top: 2px; }
.more-versions > summary {
  cursor: pointer; padding: 6px 0;
  font-size: 12.5px; font-weight: 600; color: var(--accent);
}
.more-versions[open] > summary { color: var(--text-muted); }

/* Lists of papers on a screening stage */
.screen-list { list-style: none; margin: 0; padding: 0; }
.screen-list li {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.screen-list li:last-child { border-bottom: none; }
.screen-list a { flex: 1; min-width: 200px; color: var(--text); }
.screen-list a:hover { color: var(--accent); }
.screen-list .screen-list-title { flex: 1; min-width: 200px; }

/* Screen and Resolve tabs on a screening stage: links styled like .mode-tabs buttons */
.stage-tabs { margin-bottom: 14px; padding: 0; }
.stage-tabs a {
  padding: 10px 15px; font-size: 13px; font-weight: 550;
  color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.stage-tabs a:hover { color: var(--text); }
.stage-tabs a[aria-current="page"] { color: var(--accent-hover); border-bottom-color: var(--accent); font-weight: 650; }
.stage-tabs .n {
  font-size: 11px; font-weight: 650; padding: 1px 6px; border-radius: 999px;
  background: var(--maybe-soft); color: var(--maybe);
}
.stage-links { margin: 0 0 12px; font-size: 13px; }

/* A resolver sees the votes side by side */
.vote-compare {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
  margin-top: 22px;
}
.vote-card {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.vote-card .vote-who { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13px; }
.vote-card p { margin-top: 6px; font-size: 13px; white-space: pre-line; }

/* The Assignment page: a list of papers to pick from, and a bar to assign the picked ones */
.assignment-tools { flex-wrap: wrap; }
.assignment-search { display: flex; gap: 6px; align-items: center; flex: 0 1 340px; min-width: 0; }
.assignment-search .input { flex: 1; min-width: 0; padding-top: 5px; padding-bottom: 5px; }
.assignment-papers td:first-child, .assignment-papers th:first-child { padding-right: 0; }
.assign-bar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font-weight: 550;
}
.assign-bar[hidden] { display: none; }
.assign-bar .spacer { flex: 1; }
.assign-shares .input { width: 90px; text-align: right; }
.assign-left { margin: 12px 0 0; font-size: 13px; color: var(--maybe); }
.assign-left.is-done { color: var(--include); }
.share-input { width: 72px; text-align: right; padding-top: 4px; padding-bottom: 4px; }
.shares-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.shares-foot .spacer { flex: 1; }
#shares-total { font-weight: 550; color: var(--include); }
#shares-total.is-off { color: var(--maybe); }
.shares-table td { vertical-align: middle; }
.shares-foot .form-message { margin: 0 0 0 8px; padding: 5px 10px; }
.tbl .num a { color: var(--accent); font-weight: 600; }
.tbl .num a:hover { text-decoration: underline; }

/* Full text: the paper's PDF beside its assessment */
.pdf-toolbar .pdf-actions { display: flex; gap: 4px; margin-left: auto; }
.pdf-frame { display: block; width: 100%; height: calc(100vh - 220px); min-height: 520px; border: 0; background: var(--surface-2); }
.pdf-empty { padding: 56px 24px; text-align: center; color: var(--text-muted); background: var(--surface-2); font-size: 13.5px; }
.ft-reason { margin-top: 22px; }
.ft-reason .select { width: 100%; }
.ft-abstract { margin-top: 14px; font-size: 13px; }
.ft-abstract summary { cursor: pointer; color: var(--text-muted); font-weight: 600; }
.ft-abstract .abstract { margin-top: 8px; }
.vote-card .vote-reason { font-weight: 550; }
.pdfs-table td a { color: var(--accent); font-weight: 600; }

/* Protocol history: one folding card per version */
.protocol-version > summary { cursor: pointer; list-style: none; }
.protocol-version > summary::-webkit-details-marker { display: none; }
.protocol-version:not([open]) > summary { border-bottom: none; }
.version-changes { margin: 0 0 16px; padding-left: 18px; }
.version-changes li { margin-bottom: 4px; }
.version-note { margin: 0 0 14px; font-size: 13px; }
.version-criteria { margin: 0; padding-left: 20px; }

/* Review settings: what the review has spent on AI this month, and its limit */
.spend-line { margin: 0 0 14px; font-size: 14px; }
.spend-line strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.spend-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.spend-form .form-message { flex-basis: 100%; margin: 0; }
.spend-form .input { width: 140px; }

/* Protocol: quality appraisal forms, each with its questions and their answers */
.appraisal-form { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; }
.appraisal-row { display: flex; align-items: center; gap: 4px; }
.appraisal-row .input { flex: 1; min-width: 0; }
.appraisal-form-name { font-weight: 600; }
.appraisal-questions { margin: 12px 0 8px; padding-left: 22px; }
.appraisal-question { margin-bottom: 12px; }
.appraisal-answers { list-style: none; margin: 6px 0 2px 18px; padding: 0; }
.appraisal-answer { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.appraisal-answer .input { width: 220px; max-width: 50%; padding-top: 4px; padding-bottom: 4px; }
.appraisal-keeps { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.appraisal-form .btn:disabled { opacity: .35; cursor: default; }
.appraisal-read { border: 0; padding: 0; }
.appraisal-read-answers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* Quality appraisal: a reviewer's or resolver's answers to the form that fits the paper. */
.appraise { margin-top: 22px; }
.appraise-questions { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 14px; }
.appraise-questions[hidden] { display: none; }
.appraise-question label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.appraise-question .select { max-width: 320px; }
.appraise-kept { margin: 0; font-size: 13.5px; }
.appraise-others { margin: 6px 0 0; font-size: 12.5px; color: var(--text-muted); }
.appraise-outcome { margin: 16px 0 0; font-size: 13.5px; font-weight: 500; color: var(--text-muted); }
.appraise-outcome.is-pass { color: var(--include); }
.appraise-outcome.is-fail { color: var(--exclude); }

/* Protocol: data extraction forms, each with its fields and a dropdown's options */
.extraction-form { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; }
.extraction-row { display: flex; align-items: center; gap: 4px; }
.extraction-row .input { flex: 1; min-width: 0; }
.extraction-form-name { font-weight: 600; }
.extraction-fields { margin: 12px 0 8px; padding-left: 22px; }
.extraction-field { margin-bottom: 14px; }
.extraction-kind { width: auto; flex: none; }
.extraction-guidance { min-height: 0; margin-top: 4px; font-size: 12.5px; }
.extraction-options { margin: 6px 0 0 18px; }
.extraction-options ul { list-style: none; margin: 0; padding: 0; }
.extraction-option { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.extraction-option .input { width: 260px; max-width: 60%; padding-top: 4px; padding-bottom: 4px; }
.extraction-form .btn:disabled { opacity: .35; cursor: default; }
.extraction-read-guidance { margin: 2px 0 0; font-size: 12.5px; }

/* Data extraction: a value for each field, or not reported, with its rationale. */
.extract-guidance { margin: -2px 0 6px; font-size: 12.5px; }
.extract-value { display: flex; align-items: center; gap: 10px; }
.extract-value .input, .extract-value .select { max-width: 320px; }
.extract-rationale { margin-top: 6px; font-size: 12.5px; padding-top: 4px; padding-bottom: 4px; }

/* Data extraction: the Data tab's table of extracted values, as wide as its fields */
.data-scroll { overflow-x: auto; }
.data-table th, .data-table td { min-width: 140px; max-width: 280px; }
.data-table .data-paper { min-width: 240px; font-weight: 600; }
.data-table .data-paper .faint, .data-table .data-rationale { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; }

/* Quality appraisal: AI assist's suggested answer under a question */
.appraise-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--text-muted); }
.appraise-hint .appraise-hint-mark { color: var(--maybe); font-weight: 700; }
.appraise-hint strong { color: var(--text); }

/* AI reviewers: the built-in instructions of the stage chosen, above the owners' own */
.built-in-instructions { margin-bottom: 16px; font-size: 12.5px; }
.built-in-instructions summary { cursor: pointer; font-weight: 600; color: var(--text-muted); }
.built-in-instructions p { margin: 8px 0 0; line-height: 1.5; }

/* AI reviewers: a run in progress, and the papers that wait for a PDF */
.ai-run { margin-bottom: 16px; }
.ai-run-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ai-run-head .spacer { flex: 1; }
.ai-run .progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ai-run .progress-bar { height: 100%; background: var(--accent); transition: width .2s; }
.ai-run #ai-run-status { margin: 8px 0 0; font-size: 12.5px; }
.ai-no-pdf-actions { display: flex; gap: 6px; flex: none; }

/* ==========================================================================
   Feedback — the flag in the top bar, left of the account
   ========================================================================== */
.topbar-flag {
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: 50%;
  background: transparent; color: var(--text-muted);
  cursor: pointer;
}
.topbar-flag:hover { background: var(--surface-2); color: var(--text); }
.topbar-flag + .topbar-account { margin-left: -10px; }
#feedback-dialog .btn[hidden] { display: none; }
