/* pubcheck — editorial styles
 * Manual + system theme, set on <html data-theme="light|dark"> with
 * data-effective="light|dark" reflecting the current rendering choice.
 */

:root,
:root[data-theme="light"] {
  --bg:           #faf8f5;
  --surface:      #ffffff;
  --surface-2:    #f4f1ec;
  --ink:          #1c1a18;
  --ink-2:        #3a3633;
  --muted:        #7a716a;
  --soft:         #ece8e2;
  --border:       #e6e0d8;
  --border-2:     #d6cfc4;
  --accent:       #1c1a18;
  --accent-ink:   #faf8f5;
  --accent-hover: #2c2925;
  --focus:        #2563eb;
  --focus-ring:   rgba(37, 99, 235, 0.18);

  /* Editorial accent — used sparingly, only for the hero stat and NOT_FOUND. */
  --good:    #2f6f4a;
  --good-bg: #e8f3ec;
  --bad:     #9a2a2a;
  --bad-bg:  #f5e6e3;
  --warn:    #8a5a1f;
  --warn-bg: #f5ebd8;
  --gray:    #5e564e;
  --gray-bg: #ece8e2;
  --info:    #2563eb;
  --info-bg: #e7f0fb;

  --pubmed:   #305b8a;
  --crossref: #a85a4a;
  --openalex: #2f6f4a;

  --radius: 12px;
  --radius-sm: 8px;
  --pad: 28px;
  --max: 1080px;
  --shadow-1: 0 1px 1px rgba(28, 26, 24, 0.04), 0 1px 2px rgba(28, 26, 24, 0.05);
  --shadow-2: 0 4px 14px rgba(28, 26, 24, 0.08), 0 2px 6px rgba(28, 26, 24, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #11100f;
    --surface:      #1a1917;
    --surface-2:    #23211e;
    --ink:          #f5efe6;
    --ink-2:        #ddd3c6;
    --muted:        #aaa094;
    --soft:         #2b2824;
    --border:       #302c27;
    --border-2:     #51493f;
    --accent:       #f5efe6;
    --accent-ink:   #11100f;
    --accent-hover: #e3d8c8;
    --focus:        #93bfff;
    --focus-ring:   rgba(147, 191, 255, 0.24);

    --good:    #90d7a8;
    --good-bg: #173321;
    --bad:     #ff8177;
    --bad-bg:  #421d18;
    --warn:    #efbb70;
    --warn-bg: #352612;
    --gray:    #c3b7aa;
    --gray-bg: #25221f;
    --info:    #9bc7ff;
    --info-bg: #142840;

    --pubmed:   #8dbff2;
    --crossref: #f1a58c;
    --openalex: #94d7ad;

    --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.56), 0 8px 22px rgba(0, 0, 0, 0.2);
    --shadow-2: 0 18px 44px rgba(0, 0, 0, 0.48), 0 2px 8px rgba(0, 0, 0, 0.38);
  }
}

:root[data-theme="dark"] {
  --bg:           #11100f;
  --surface:      #1a1917;
  --surface-2:    #23211e;
  --ink:          #f5efe6;
  --ink-2:        #ddd3c6;
  --muted:        #aaa094;
  --soft:         #2b2824;
  --border:       #302c27;
  --border-2:     #51493f;
  --accent:       #f5efe6;
  --accent-ink:   #11100f;
  --accent-hover: #e3d8c8;
  --focus:        #93bfff;
  --focus-ring:   rgba(147, 191, 255, 0.24);

  --good:    #90d7a8;
  --good-bg: #173321;
  --bad:     #ff8177;
  --bad-bg:  #421d18;
  --warn:    #efbb70;
  --warn-bg: #352612;
  --gray:    #c3b7aa;
  --gray-bg: #25221f;
  --info:    #9bc7ff;
  --info-bg: #142840;

  --pubmed:   #8dbff2;
  --crossref: #f1a58c;
  --openalex: #94d7ad;

  --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.56), 0 8px 22px rgba(0, 0, 0, 0.2);
  --shadow-2: 0 18px 44px rgba(0, 0, 0, 0.48), 0 2px 8px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root[data-effective="dark"] body {
  background:
    radial-gradient(circle at 50% -120px, rgba(245, 239, 230, 0.055), transparent 360px),
    linear-gradient(180deg, #131210 0%, #0f0e0d 100%);
}

.serif {
  font-family: ui-serif, "Charter", "Iowan Old Style", "Source Serif Pro", "Cambria", Georgia, serif;
  font-feature-settings: "kern", "liga";
}

code, pre, .mono {
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-feature-settings: "tnum", "zero", "ss01";
}

a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--focus-ring); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------- Scrollbars ------------------------- */
/* The browser default is a heavy bar in the gutter beside the panes. Thin it
   to a quiet rounded thumb that reads as part of the surface. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* ------------------------- Top bar ------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
:root[data-effective="dark"] .topbar {
  background: color-mix(in srgb, #11100f 82%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink);
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name {
  font-family: ui-serif, "Charter", "Iowan Old Style", Cambria, Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
}
.topbar-actions .counter {
  font-size: 12.5px;
  color: var(--muted);
  font-feature-settings: "tnum";
  margin: 0 4px;
}
.topbar-actions .counter strong { color: var(--ink); font-weight: 600; }
.topbar-actions .counter .flagged { color: var(--bad); font-weight: 600; }

/* Mode badge — quiet status pill, no border/popover. */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  border-radius: 99px;
  user-select: none;
}
.mode-dot {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--muted);
}
.mode-dot.is-offline { background: var(--warn); }
.mode-label { color: var(--ink-2); font-weight: 500; }

/* ------------------------- Help popover ------------------------- */

.help {
  position: absolute;
  right: var(--pad);
  top: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 16px 18px;
  width: 300px;
  font-size: 13px;
  color: var(--ink-2);
  z-index: 40;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}
.help.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.help h3 { margin: 0 0 10px; font-size: 13px; color: var(--ink); font-weight: 600; }
.help dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.help dt { display: flex; gap: 4px; }
.help dd { margin: 0; color: var(--muted); }

/* ------------------------- Layout ------------------------- */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px var(--pad) 96px;
}

/* ------------------------- Landing (editorial) ------------------------- */

.landing {
  /* Bare composition — no panel. Hero + verify zone live in the page itself. */
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.hero {
  text-align: center;
  padding: 32px 0 8px;
}
.hero-mark {
  font-family: ui-serif, "Charter", "Iowan Old Style", "Source Serif Pro", Cambria, Georgia, serif;
  margin: 0 auto 22px;
  font-size: clamp(44px, 7vw, 76px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--ink);
  font-feature-settings: "kern", "liga", "ss01";
  animation: hero-rise 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.hero-lede {
  font-family: ui-serif, "Charter", "Iowan Old Style", "Source Serif Pro", Cambria, Georgia, serif;
  margin: 0 auto;
  max-width: 720px;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.42;
  color: var(--ink-2);
  font-weight: 400;
  letter-spacing: -0.005em;
  animation: hero-rise 700ms 120ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.hero-stat {
  color: var(--bad);
  font-weight: 600;
  font-feature-settings: "tnum", "lnum", "kern", "liga";
  white-space: nowrap;
}
.hero-source {
  margin: 18px auto 0;
  max-width: 720px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  animation: hero-rise 700ms 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.hero-source a {
  color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 50%, transparent);
  padding-bottom: 1px;
}
.hero-source a:hover {
  color: var(--ink-2);
  border-bottom-color: var(--ink-2);
  text-decoration: none;
}
.hero-source em {
  font-style: italic;
  font-family: ui-serif, "Charter", Cambria, Georgia, serif;
  text-transform: none;
  letter-spacing: 0;
}
:root[data-effective="dark"] .hero-mark {
  color: #f7f0e6;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 48px rgba(0, 0, 0, 0.5);
}
:root[data-effective="dark"] .hero-lede {
  color: #e6dacb;
}
:root[data-effective="dark"] .hero-source,
:root[data-effective="dark"] .hero-source a {
  color: #9d9285;
}

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* ------------------------- Verify zone ------------------------- */

.verify {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  animation: hero-rise 700ms 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.verify-rule {
  display: flex;
  align-items: center;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.verify-rule::before,
.verify-rule::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}
.verify-rule span { padding: 0 14px; }

.quick-lookup {
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}
.quick-lookup label {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.quick-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.quick-lookup input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
:root[data-effective="dark"] .quick-lookup input,
:root[data-effective="dark"] .result-search input,
:root[data-effective="dark"] .edit-citation input[type="search"],
:root[data-effective="dark"] .note-field,
:root[data-effective="dark"] .textbox {
  background: linear-gradient(180deg, #201e1b 0%, #191817 100%);
  border-color: #39342e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
:root[data-effective="dark"] .quick-lookup input:hover,
:root[data-effective="dark"] .result-search input:hover,
:root[data-effective="dark"] .edit-citation input[type="search"]:hover,
:root[data-effective="dark"] .note-field:hover,
:root[data-effective="dark"] .textbox:hover {
  border-color: #4d463d;
}
.quick-lookup input:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.quick-lookup-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.dropzone {
  /* Bare drop region. No dashed-card border. Background does the affordance. */
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  background: var(--surface);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
:root[data-effective="dark"] .dropzone,
:root[data-effective="dark"] .pane,
:root[data-effective="dark"] .modal-card,
:root[data-effective="dark"] .about-callout,
:root[data-effective="dark"] .about-steps li {
  background: linear-gradient(180deg, #1f1d1a 0%, #181715 100%);
  border-color: #343029;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), var(--shadow-1);
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--surface-2);
}
:root[data-effective="dark"] .dropzone.dragover {
  background: #26231f;
  border-color: #cfc4b5;
}
.dropzone-title {
  font-family: ui-serif, "Charter", Cambria, Georgia, serif;
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.dropzone-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.dropzone-filename {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.separator {
  display: flex;
  align-items: center;
  margin: 22px 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.separator::before,
.separator::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}
.separator span { padding: 0 14px; }

.textbox {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.textbox::placeholder { color: var(--muted); opacity: 0.85; }
.textbox:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.actions {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.actions .btn-primary { padding: 11px 22px; font-size: 14px; }

.status {
  color: var(--muted);
  font-size: 13px;
  font-feature-settings: "tnum";
}
.status .spinner {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--focus);
  margin-right: 8px;
  vertical-align: 1px;
  animation: status-pulse 1.4s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.1); }
}

/* ------------------------- Buttons ------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}
.btn:hover { border-color: var(--border-2); background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  padding: 9px 20px;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled {
  background: var(--border-2);
  border-color: var(--border-2);
  cursor: progress;
  color: var(--muted);
  transform: none;
}
.btn-quiet { background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--border); }
:root[data-effective="dark"] .btn {
  border-color: #37322c;
}
:root[data-effective="dark"] .btn:hover,
:root[data-effective="dark"] .btn-quiet:hover {
  background: #26231f;
  border-color: #51493f;
}
:root[data-effective="dark"] .btn-primary {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}
.btn-icon {
  padding: 0;
  width: 32px;
  height: 32px;
  justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; display: block; }

/* New check — the primary next action once a check finishes. Visible against
   the surrounding quiet buttons without the weight of a filled accent. */
.btn-strong {
  background: var(--surface);
  border-color: var(--border-2);
  color: var(--ink);
  font-weight: 600;
}
.btn-strong:hover { background: var(--surface-2); border-color: var(--ink-2); }

/* Export dropdown — collapses the result export formats into one menu so the
   working-state top bar stays a short row instead of a wall of buttons. */
.menu { position: relative; display: inline-flex; }
.menu-trigger .menu-caret { width: 14px; height: 14px; opacity: 0.7; }
.menu-trigger[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 150px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13.5px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.kbd {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  padding: 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  box-shadow: 0 1px 0 var(--border);
}

/* Theme toggle: shows the icon for the *current* effective theme. */
.theme-toggle .icon-light { display: none; }
.theme-toggle .icon-dark { display: block; }
:root[data-effective="light"] .theme-toggle .icon-light { display: block; }
:root[data-effective="light"] .theme-toggle .icon-dark { display: none; }

/* ------------------------- Drag overlay (full viewport) ------------------------- */

.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
body.is-dragging .drag-overlay { opacity: 1; }
.drag-overlay-inner {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 36px 56px;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: scale(0.96);
  transition: transform 160ms ease;
}
body.is-dragging .drag-overlay-inner { transform: scale(1); }
.drag-overlay-mark {
  font-size: 56px;
  line-height: 1;
  color: var(--ink);
  font-weight: 300;
  font-family: ui-serif, Charter, Cambria, Georgia, serif;
}
.drag-overlay-text {
  font-family: ui-serif, Charter, Cambria, Georgia, serif;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

/* ------------------------- Working two-pane ------------------------- */

.working {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  animation: hero-rise 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 18px 20px 20px;
  max-height: calc(100vh - 132px);
  overflow: auto;
  position: sticky;
  top: 76px;
}
.pane-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.source-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-serif, "Charter", "Iowan Old Style", Cambria, Georgia, serif;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}
.source-text mark {
  background: transparent;
  border-bottom: 1.5px solid var(--border-2);
  padding: 0 1px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.93em;
}
.source-text mark:hover { background: var(--soft); }
.source-text mark.is-active {
  background: color-mix(in srgb, var(--focus) 14%, transparent);
  border-bottom-color: var(--focus);
}
/* Pattern + color so color-blind readers get a second cue. */
.source-text mark[data-verdict="VERIFIED"]            { border-bottom: 1.5px solid  var(--good); }
.source-text mark[data-verdict="RETRACTED"]           { border-bottom: 2px   solid  var(--bad); }
.source-text mark[data-verdict="NOT_FOUND"]           { border-bottom: 2px   solid  var(--bad); }
.source-text mark[data-verdict="METADATA_MISMATCH"]   { border-bottom: 1.5px dashed var(--warn); }
.source-text mark[data-verdict="INVALID_IDENTIFIER"]  { border-bottom: 2px   dashed var(--bad); }
.source-text mark[data-verdict="UNVERIFIABLE"]        { border-bottom: 1.5px dotted var(--gray); }
.source-text mark[data-verdict="ERROR"]               { border-bottom: 2px   double var(--info); }

/* ------------------------- Summary header ------------------------- */

.summary {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
:root[data-effective="dark"] .summary,
:root[data-effective="dark"] .first-run-tip,
:root[data-effective="dark"] .triage-bar,
:root[data-effective="dark"] .figures,
:root[data-effective="dark"] .edit-citation {
  background: linear-gradient(180deg, #24211e 0%, #1d1b18 100%);
  border-color: #37322c;
}
.summary-progress {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.summary-progress .lead {
  font-size: 13px;
  color: var(--ink-2);
  font-feature-settings: "tnum";
}
.summary-progress .lead strong { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.summary-progress .elapsed {
  font-size: 12px;
  color: var(--muted);
  font-feature-settings: "tnum";
}
.summary-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  display: flex;
}
.summary-bar > span {
  height: 100%;
  transition: flex-grow 240ms ease;
}
.summary-bar .seg-VERIFIED          { background: var(--good); }
.summary-bar .seg-RETRACTED         { background: var(--bad); }
.summary-bar .seg-NOT_FOUND         { background: var(--bad); }
.summary-bar .seg-METADATA_MISMATCH { background: var(--warn); }
.summary-bar .seg-INVALID_IDENTIFIER { background: var(--bad); }
.summary-bar .seg-UNVERIFIABLE      { background: var(--gray); }
.summary-bar .seg-ERROR             { background: var(--info); }
.summary-bar .seg-PENDING           { background: var(--border-2); }
.summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.first-run-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.first-run-tip-body {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  flex: 1 1 auto;
}
.first-run-tip-body .kbd { vertical-align: baseline; margin: 0 1px; }
.first-run-dismiss {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.first-run-dismiss:hover { color: var(--ink); background: var(--soft); }

.triage-bar {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 220px);
  gap: 10px 12px;
  align-items: center;
  margin: -2px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.filter-btn:hover {
  border-color: var(--border-2);
  color: var(--ink-2);
}
.filter-btn:focus-visible,
.result-search input:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.filter-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.result-search {
  min-width: 0;
}
.result-search input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  padding: 8px 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.result-search input::placeholder {
  color: var(--muted);
}
.visible-state {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-feature-settings: "tnum";
}

/* ------------------------- Result cards ------------------------- */

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 4px;
  text-align: center;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
  cursor: default;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 140ms ease, transform 140ms ease;
  position: relative;
  animation: card-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
:root[data-effective="dark"] .result-card,
:root[data-effective="dark"] .figure-card,
:root[data-effective="dark"] .report-warning,
:root[data-effective="dark"] .card-hint {
  background: linear-gradient(180deg, #201e1b 0%, #191817 100%);
  border-color: #353029;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.result-card .result-row { cursor: pointer; }
.result-card.is-reviewed { opacity: 0.55; }
.result-card.is-reviewed:hover { opacity: 1; }
.result-card.is-hidden {
  display: none;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-1);
}
:root[data-effective="dark"] .result-card:hover {
  border-color: #5b5146;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.result-card.is-active {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus), var(--shadow-2);
}
/* Flagged verdicts get a faint full-card wash instead of a left accent bar. */
.result-card[data-verdict="RETRACTED"],
.result-card[data-verdict="NOT_FOUND"],
.result-card[data-verdict="INVALID_IDENTIFIER"]   { background: var(--bad-bg); }
.result-card[data-verdict="METADATA_MISMATCH"]    { background: var(--warn-bg); }
.result-card[data-verdict="ERROR"]                { background: var(--info-bg); }
:root[data-effective="dark"] .result-card[data-verdict="RETRACTED"],
:root[data-effective="dark"] .result-card[data-verdict="NOT_FOUND"],
:root[data-effective="dark"] .result-card[data-verdict="INVALID_IDENTIFIER"] {
  background: linear-gradient(180deg, #331d19 0%, #241715 100%);
  border-color: color-mix(in srgb, var(--bad) 30%, #353029);
}
:root[data-effective="dark"] .result-card[data-verdict="METADATA_MISMATCH"] {
  background: linear-gradient(180deg, #2e2417 0%, #211a12 100%);
  border-color: color-mix(in srgb, var(--warn) 30%, #353029);
}
:root[data-effective="dark"] .result-card[data-verdict="ERROR"] {
  background: linear-gradient(180deg, #172434 0%, #121b27 100%);
  border-color: color-mix(in srgb, var(--info) 28%, #353029);
}
.result-card[data-verdict="PENDING"] {
  opacity: 0.55;
  animation: none;
}
.result-card.is-inflight { opacity: 1; }
.result-card.is-inflight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  border: 1px solid var(--focus);
  animation: card-pulse 1.4s ease-in-out infinite;
}
@keyframes card-pulse {
  0%, 100% { opacity: 0; }
  50%      { opacity: 0.45; }
}

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.result-claim { flex: 1 1 60%; min-width: 0; }
.claim-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-word;
}
.claim-line .sep,
.claim-meta .sep {
  color: var(--muted);
  margin: 0 6px;
  opacity: 0.5;
}
.claim-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.verdict-pill {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  align-self: flex-start;
  font-feature-settings: "tnum";
}
:root[data-effective="dark"] .verdict-pill,
:root[data-effective="dark"] .verdict-chip {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}
.verdict-VERIFIED          { background: var(--good-bg);  color: var(--good); }
.verdict-RETRACTED         { background: var(--bad-bg);   color: var(--bad); }
.verdict-NOT_FOUND         { background: var(--bad-bg);   color: var(--bad); }
.verdict-METADATA_MISMATCH { background: var(--warn-bg);  color: var(--warn); }
.verdict-INVALID_IDENTIFIER { background: var(--bad-bg);  color: var(--bad); }
.verdict-UNVERIFIABLE      { background: var(--gray-bg);  color: var(--gray); }
.verdict-ERROR             { background: var(--info-bg); color: var(--info); }
.verdict-PENDING           { background: var(--gray-bg);  color: var(--muted); }
.verdict-AI_GENERATED        { background: var(--bad-bg);   color: var(--bad); }
.verdict-SIGNATURE_INVALID   { background: var(--bad-bg);   color: var(--bad); }
.verdict-SIGNED_NO_AI_MARKER { background: var(--gray-bg);  color: var(--gray); }
.verdict-NO_CREDENTIALS      { background: var(--gray-bg);  color: var(--gray); }
.verdict-UNREADABLE          { background: var(--info-bg);  color: var(--info); }

/* ------------------------- Figures ------------------------- */

.figures {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.figures-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.figures-title span:last-child {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 500;
}
.figures-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.figure-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
}
.figure-card[data-verdict="AI_GENERATED"] { border-left: 3px solid var(--bad); }
.figure-card[data-verdict="SIGNATURE_INVALID"] { border-left: 3px solid var(--bad); }
.figure-card[data-verdict="UNREADABLE"] { border-left: 3px solid var(--info); }
.figure-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.figure-claim {
  flex: 1 1 auto;
  min-width: 0;
}
.figure-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-word;
}
.figure-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.figure-reason {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}

/* Report-level notices: extraction counts and structure warnings, shown above
 * the per-citation list. A warning is a problem; a note is something the run
 * did not check. The note style stays muted so it reads as secondary. */
.report-notices {
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-extraction {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.report-warnings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-warning {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 14px;
}
.report-warning.is-warning {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}
.report-warning.is-note {
  border-left-color: var(--border-2);
}
.report-warning-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.report-warning.is-note .report-warning-message {
  color: var(--muted);
}

.card-hint {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.reasons {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}
.reasons li {
  padding-left: 16px;
  position: relative;
  margin: 3px 0;
}
.reasons li::before {
  content: "›";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--muted);
}

details.attempts {
  margin-top: 10px;
  font-size: 12px;
}
details.attempts > summary {
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
details.attempts > summary::-webkit-details-marker { display: none; }
details.attempts > summary::before { content: "›"; transition: transform 100ms ease; display: inline-block; }
details.attempts[open] > summary::before { transform: rotate(90deg); }

.attempts-table {
  margin-top: 10px;
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
.attempts-table th,
.attempts-table td {
  text-align: left;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.attempts-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.attempt-method {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.attempt-method::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--border-2);
}
.attempt-method[data-source="pubmed"]::before   { background: var(--pubmed); }
.attempt-method[data-source="crossref"]::before { background: var(--crossref); }
.attempt-method[data-source="openalex"]::before { background: var(--openalex); }
.attempt-result-ok    { color: var(--good); }
.attempt-result-fail  { color: var(--muted); }
.attempt-result-err   { color: var(--info); }

.retry-btn {
  margin-top: 10px;
  font-size: 12px;
  padding: 4px 10px;
}

/* ------------------------- Reviewer state per card ------------------------- */

.review-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  align-items: start;
}
.review-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding: 4px 0;
}
.review-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--good);
  cursor: pointer;
}
.review-toggle.is-checked { color: var(--good); }
.note-field {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 8px;
  resize: vertical;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.note-field::placeholder { color: var(--muted); }
.note-field:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Source-pane mark for a reviewed citation (struck through, not removed). */
.source-text mark.is-reviewed-mark {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  opacity: 0.7;
}

/* ------------------------- VERIFIED match strength ------------------------- */

.match-strength {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--muted);
  font-feature-settings: "tnum";
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.match-strength::before {
  content: "·";
  color: var(--muted);
  opacity: 0.5;
}

/* ------------------------- Char-level diff tokens ------------------------- */

.diff-cell .diff-token-del,
.diff-cell .diff-token-add {
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 500;
}
.diff-cell .diff-token-del {
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  color: var(--bad);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--bad) 70%, transparent);
}
.diff-cell .diff-token-add {
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good);
}

/* Override the cell-level dotted underline once tokens carry the diff. */
.diff-cell.has-tokens.is-diff {
  text-decoration: none;
}

.external-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.external-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.external-link:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.external-link:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Claimed vs. resolved diff block for METADATA_MISMATCH cards. */
.diff-block {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
  font-size: 12.5px;
}
:root[data-effective="dark"] .diff-block {
  background: #191715;
  border-color: #39342e;
}
:root[data-effective="dark"] .diff-head {
  background: #211f1c;
}
.diff-head {
  display: grid;
  grid-template-columns: 88px 1fr 1fr;
  gap: 0 12px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.diff-head span:first-child { grid-column: 2; }
.diff-head span:last-child { grid-column: 3; }
.diff-row {
  display: grid;
  grid-template-columns: 88px 1fr 1fr;
  gap: 4px 12px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  align-items: baseline;
}
.diff-row:first-of-type { border-top: none; }
.diff-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.diff-cell {
  color: var(--ink-2);
  word-break: break-word;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.diff-cell.is-missing { color: var(--muted); font-style: italic; }
.diff-cell.is-diff {
  text-decoration: underline dotted var(--warn);
  text-underline-offset: 3px;
  color: var(--ink);
}
.diff-row-title .diff-cell {
  font-family: ui-serif, "Charter", "Iowan Old Style", Cambria, Georgia, serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
.diff-row-title .diff-cell.is-missing { font-family: inherit; font-size: 12.5px; }
@media (max-width: 540px) {
  .diff-head,
  .diff-row { grid-template-columns: 72px 1fr 1fr; gap: 4px 8px; }
}

/* ------------------------- Modal shell ------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 32%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  width: min(780px, 100%);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px) scale(0.99);
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal.is-open .modal-card { transform: translateY(0) scale(1); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: ui-serif, "Charter", "Iowan Old Style", "Source Serif Pro", Cambria, Georgia, serif;
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.modal-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal-close { color: var(--muted); }
.modal-close:hover { color: var(--ink); }

.modal-body {
  padding: 28px;
  overflow-y: auto;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.verdict-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  font-feature-settings: "tnum";
}

@media (max-width: 540px) {
  .modal { padding: 12px; }
  .modal-card { max-height: calc(100vh - 24px); }
  .modal-head { padding: 16px 18px 14px; }
  .modal-body { padding: 18px 18px 22px; font-size: 13.5px; }
  .modal-title { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal, .modal-card { transition: none; }
}

/* ------------------------- About page ------------------------- */

.about-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 36px var(--pad) 88px;
}
.about-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 28px;
}
.about-breadcrumb a {
  color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
}
.about-breadcrumb a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
  text-decoration: none;
}
.about-page-hero {
  max-width: 760px;
  margin-bottom: 32px;
}
.about-eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.about-page-hero h1 {
  margin: 0;
  font-family: ui-serif, "Charter", "Iowan Old Style", "Source Serif Pro", Cambria, Georgia, serif;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 500;
}
.about-page-hero p {
  margin: 22px 0 0;
  max-width: 680px;
  font-family: ui-serif, "Charter", "Iowan Old Style", Cambria, Georgia, serif;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.45;
  color: var(--ink-2);
}
.about-callout {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px 22px;
  margin-bottom: 34px;
}
.about-callout p {
  margin: 0 0 10px;
  font-family: ui-serif, "Charter", "Iowan Old Style", Cambria, Georgia, serif;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
}
.about-callout strong {
  color: var(--bad);
  font-weight: 650;
  font-feature-settings: "tnum";
}
.about-callout a {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
}
.about-callout a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
  text-decoration: none;
}
.about-section {
  padding-top: 28px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}
.about-section h2 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.about-section p {
  margin: 0 0 12px;
  color: var(--ink-2);
  line-height: 1.65;
}
.about-section p:last-child { margin-bottom: 0; }
.about-section strong { color: var(--ink); font-weight: 650; }
.about-section code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.about-steps {
  counter-reset: about-step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.about-steps li {
  position: relative;
  min-height: 132px;
  padding: 42px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.about-steps li::before {
  counter-increment: about-step;
  content: counter(about-step);
  position: absolute;
  top: 12px;
  left: 14px;
  width: 20px;
  height: 20px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-feature-settings: "tnum";
}
.about-steps strong {
  display: block;
  margin-bottom: 6px;
  font-family: ui-serif, "Charter", Cambria, Georgia, serif;
  font-size: 16px;
}
.about-steps span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.about-verdicts {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px 18px;
  align-items: baseline;
}
.about-verdicts dt,
.about-verdicts dd { margin: 0; }
.about-verdicts dd {
  color: var(--ink-2);
  line-height: 1.55;
}
.about-actions,
.about-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink-2);
  line-height: 1.6;
}
.about-actions li::marker,
.about-list li::marker {
  color: var(--muted);
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 34px;
}
.about-grid .about-section {
  margin-top: 28px;
}

@media (max-width: 760px) {
  .about-page { padding: 28px 18px 64px; }
  .about-steps { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 540px) {
  .about-page-hero h1 { font-size: 38px; }
  .about-steps { grid-template-columns: 1fr; }
  .about-verdicts {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .about-verdicts dd { padding-bottom: 10px; }
}

/* ------------------------- Multi-file chips ------------------------- */

.dropzone-filename {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.filename-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
}
.filename-remove {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.filename-remove:hover { color: var(--ink); }

/* ------------------------- Cancel button ------------------------- */

.btn-cancel { color: var(--bad); }
.btn-cancel:hover {
  background: var(--bad-bg);
  border-color: var(--border);
  color: var(--bad);
}

/* ------------------------- Reviewed-state + edit-citation ------------------------- */

.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  align-items: center;
}
.reviewed-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 3px 10px 3px 8px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
.reviewed-toggle:hover { border-color: var(--border-2); color: var(--ink-2); }
.reviewed-toggle::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 99px;
  border: 1.5px solid var(--border-2);
  background: transparent;
  transition: background 100ms ease, border-color 100ms ease;
}
.reviewed-toggle.is-reviewed {
  color: var(--good);
  background: var(--good-bg);
  border-color: color-mix(in srgb, var(--good) 35%, var(--border));
}
.reviewed-toggle.is-reviewed::before {
  background: var(--good);
  border-color: var(--good);
}
.result-card.is-reviewed { opacity: 0.7; }
.result-card.is-reviewed:hover { opacity: 1; }

.edit-citation {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  background: var(--surface-2);
}
.edit-citation.is-open { display: flex; }
.edit-citation label {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.edit-citation-row { display: flex; gap: 8px; }
.edit-citation input[type="search"] {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--ink);
  min-width: 0;
}
.edit-citation input[type="search"]:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.edit-citation-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 1em;
}

/* Citation context line — surrounding sentence the citation supports. */
.claim-context {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  font-family: ui-serif, "Charter", "Iowan Old Style", Cambria, Georgia, serif;
  border-left: 2px solid var(--border);
  padding-left: 10px;
}

.claim-meta .meta-page {
  color: var(--ink-2);
  font-feature-settings: "tnum";
  font-weight: 500;
}

/* ------------------------- Filter → source coherence ------------------------- */

.source-text mark[data-filtered="true"] {
  opacity: 0.28;
  border-bottom-style: dotted;
}
.source-text mark[data-filtered="true"]:hover { opacity: 0.6; }

/* ------------------------- Source pane: PDF / Text tabs + viewer ------------------------- */

.source-pane .pane-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.source-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.source-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
}
.source-tab:hover { background: var(--surface-2); color: var(--ink-2); }
.source-tab.is-active {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--border);
}
.source-pdf-select {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  max-width: 220px;
}
.source-pdf {
  height: calc(100vh - 220px);
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.source-pdf iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--surface-2);
}
.source-pane.pdf-mode .source-text { display: none; }
.source-pane.text-mode .source-pdf { display: none; }

/* Page-jump link on result cards (rendered inside .claim-meta). */
.meta-page-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink-2);
  font: inherit;
  font-feature-settings: "tnum";
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink-2) 25%, transparent);
  text-underline-offset: 2px;
}
.meta-page-link:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* ------------------------- History modal ------------------------- */

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.history-list:empty { display: none; }
.history-empty {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.history-empty[hidden] { display: none; }

.history-item {
  background: var(--surface);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px 14px;
  align-items: center;
  cursor: pointer;
  transition: background 100ms ease;
}
.history-item:hover { background: var(--surface-2); }
.history-item-title {
  font-weight: 500;
  color: var(--ink);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item-meta {
  color: var(--muted);
  font-size: 12px;
  font-feature-settings: "tnum";
}
.history-item-flagged {
  color: var(--bad);
  font-weight: 600;
  font-size: 12px;
}
.history-item-flagged.is-clean { color: var(--good); }
.history-foot {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

/* ------------------------- Toast ------------------------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 50;
}
.toast.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ------------------------- Responsive ------------------------- */

@media (max-width: 960px) {
  .working {
    grid-template-columns: 1fr;
  }
  .pane {
    max-height: none;
    position: static;
  }
  .source-pane { max-height: 50vh; }
  .triage-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar-actions .mode-badge { display: none; }
}

@media (max-width: 540px) {
  main { padding: 36px 16px 64px; }
  .topbar-inner { padding: 12px 16px; gap: 10px; }
  .landing { gap: 44px; }
  .hero { padding: 16px 0 0; }
  .hero-mark { font-size: clamp(40px, 10vw, 56px); margin-bottom: 18px; }
  .hero-lede { font-size: clamp(17px, 4.6vw, 22px); }
  .quick-lookup-row { grid-template-columns: 1fr; }
  .drag-overlay-inner { padding: 28px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-mark, .hero-lede, .hero-source, .verify, .working, .result-card {
    animation: none !important;
  }
  .result-card.is-inflight::after { animation: none; }
  .status .spinner { animation: none; }
}
