* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  background: #f8fafc;
}

body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Hero banner ─────────────────────────────────────────── */

.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #ecfeff 100%);
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.35s ease;
  max-height: 600px;
  flex-shrink: 0;
}

.hero.dismissed {
  max-height: 0;
  opacity: 0;
  border-bottom: none;
}

.hero-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 44px 24px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: #cffafe;
  color: #0891b2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 34px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}

.hero-sub {
  font-size: 15px;
  color: #64748b;
  line-height: 1.65;
  margin: 0 0 24px;
}

.hero-sub code {
  background: #e0f2fe;
  color: #0891b2;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.hero-cta {
  background: #0891b2;
  color: white;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.hero-cta:hover { background: #0e7490; }

/* ── Header ──────────────────────────────────────────────── */

header {
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  overflow: hidden;
  transition: padding 0.2s ease;
}

header.collapsed {
  padding-top: 8px;
  padding-bottom: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0891b2;
  letter-spacing: -0.3px;
}

.header-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #94a3b8;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s, transform 0.2s ease;
}
.header-toggle:hover { color: #0891b2; }
header.collapsed .header-toggle { transform: rotate(-90deg); }

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: hidden;
  max-width: 2000px;
  max-height: 60px;
  opacity: 1;
  transition: max-width 0.25s ease, max-height 0.25s ease, opacity 0.2s ease;
}

header.collapsed .controls {
  max-width: 0;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  gap: 0;
}

#apiKey {
  width: 280px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 0.15s, background 0.15s;
}

#apiKey:focus {
  border-color: #0891b2;
  outline: none;
  background: white;
}

#providerSelect, #styleSelect {
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: #f8fafc;
  cursor: pointer;
  color: #0f172a;
}

button {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  background: #0891b2;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover { background: #0e7490; }
button:disabled { background: #94a3b8; cursor: not-allowed; }

button.secondary { background: #f1f5f9; color: #0f172a; border: 1px solid #e2e8f0; }
button.secondary:hover { background: #e2e8f0; }

/* ── Main layout ─────────────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 0;
  background: #e2e8f0;
  overflow: hidden;
  min-height: 0;
}

/* Drag handle between panes */
.pane-divider {
  width: 4px;
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  position: relative;
  z-index: 10;
}
/* Pill that appears on hover */
.pane-divider::after {
  content: '';
  display: block;
  width: 3px;
  height: 28px;
  border-radius: 9999px;
  background: #94a3b8;
  opacity: 0;
  transform: scaleY(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s;
}
.pane-divider:hover::after,
.pane-divider.dragging::after {
  opacity: 1;
  transform: scaleY(1);
  background: #0891b2;
}

.editor-pane, .review-pane {
  background: #fff;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 180px;
}

.editor-pane { flex: 1 1 0; }
.review-pane { width: 420px; flex-shrink: 0; }

.editor-pane label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 8px;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.label-row label { margin-bottom: 0; flex: 1; }

.upload-btn { font-size: 11px; }

/* ── Mode selector ───────────────────────────────────────── */

.mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-option {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
  font-size: 13px;
  margin-bottom: 0;
  transition: border-color 0.15s, background 0.15s;
}

.mode-option:has(input:checked) {
  border-color: #0891b2;
  background: #ecfeff;
}

.mode-option input { margin-right: 6px; vertical-align: middle; }
.mode-option span { font-weight: 600; color: #0f172a; }
.mode-option small { color: #64748b; font-size: 11px; }

/* References pane: compact card above the draft, shown only when the user
   selects "References search" mode. Not a full page surface — it's a
   data-input area for the bibliography you want to match claims against. */
.ref-pane {
  margin-bottom: 14px;
}
.ref-pane.hidden { display: none; }
.ref-pane-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  max-height: 220px;
  overflow-y: auto;
  transition: max-height 180ms ease, padding 180ms ease, opacity 180ms ease;
}

/* Collapse / expand button — a small chevron at the start of the label row.
   `aria-expanded` reflects state and a CSS-based chevron rotation makes the
   intent obvious. */
.ref-pane-toggle {
  background: none !important;
  color: #64748b !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  width: 22px;
  height: 22px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.ref-pane-toggle:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  transform: none !important;
}
.ref-pane-chevron {
  display: inline-block;
  transition: transform 180ms ease;
  line-height: 1;
}
.ref-pane-toggle[aria-expanded="false"] .ref-pane-chevron {
  transform: rotate(-90deg);
}

/* When collapsed: hide the body card entirely and tighten the row spacing.
   We don't animate max-height to 0 (jumpy with variable content) — just
   display:none for a clean state. */
.ref-pane.collapsed .ref-pane-card { display: none; }
.ref-pane.collapsed { margin-bottom: 8px; }
#references {
  outline: none;
  min-height: 100px;
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 14px;
  line-height: 1.5;
  color: inherit;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
#references:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
  white-space: pre-wrap;
}

/* ── References panel (legacy class, kept for compat) ────── */

#referencesPanel {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
#referencesPanel.hidden { display: none; }

/* ── Editor "page" surface (Google Docs / Word feel) ─────── */
/* The editor and references both render inside a centered white "page"
   that resembles a Google Docs document. The page stays light even in
   dark mode — only the desk around it darkens. */

.editor-page-wrap {
  /* Scroll container that centers the writing column. Flat — no "desk":
     transparent so it inherits the editor pane's background. */
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 8px 8px 0;
  background: transparent;
  margin-bottom: 12px;
}

.editor-page {
  /* Single coherent "page" — one continuous white sheet (no page seams),
     centered with generous margins and a soft shadow, à la Google Docs. */
  width: 100%;
  max-width: 816px;          /* ~8.5in at 96dpi */
  padding: 72px 96px;        /* 1in top/bottom, ~1in left/right */
  margin: 8px 0 24px;
  box-sizing: border-box;
  color: #1a1a22;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08),
              0 4px 12px rgba(15, 23, 42, 0.06);
}

#editor, #references {
  /* Contenteditable styling. Default font is Times New Roman so directly-
     typed text reads like a standard academic paper. Pasted content
     carries its own font-family via inline styles which override this
     default — so a paste from Google Docs / Word keeps the source font. */
  outline: none;
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 16px;
  line-height: 1.5;
  color: inherit;
  min-height: 480px;
  /* Block-level so paragraphs flow naturally inside it. */
  display: block;
  /* Allow word wrapping for long URLs or unbroken strings. */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Placeholder text for empty contenteditable: shown via :empty pseudo
   plus data-placeholder. The :empty selector only matches when there are
   no children — pasting/typing removes the placeholder automatically. */
#editor:empty::before,
#references:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
  /* Display as block so it occupies the same line as the first paragraph
     the user would type. */
  display: block;
}

/* Browser-default contenteditable focus outlines are ugly; suppress them
   in favor of the page card already providing visual focus context. */
#editor:focus, #references:focus { outline: none; }

/* The auto-generated References block at the bottom of a draft. Visually
   delineated from the body but still inside the page (so it copies with
   the document). */
#autoReferencesBlock {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
#autoReferencesBlock h2 {
  font-size: 18px;
  margin: 0 0 12px;
  font-weight: 600;
}
#autoReferencesBlock p {
  margin: 0 0 10px;
  text-indent: -24px;
  padding-left: 24px;  /* hanging indent — APA / Chicago convention */
}
#autoReferencesBlock:empty { display: none; }

/* ── Editor ──────────────────────────────────────────────── */

.editor-pane label code,
.empty code {
  background: #e0f2fe;
  color: #0891b2;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* Legacy #editor textarea rules removed when the surface migrated to a
   contenteditable div. The new editor styling lives in the
   ".editor-page" / "#editor:empty::before" rules above. */

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
}

.editor-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.status {
  font-size: 12px;
  color: #64748b;
  flex: 1;
}

.count-display {
  font-size: 12px;
  color: #94a3b8;
}

/* ── Review pane ─────────────────────────────────────────── */

.review-pane h2 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
}

#results { display: flex; flex-direction: column; gap: 12px; }

.empty { color: #94a3b8; font-size: 13px; }

/* ── Cards ───────────────────────────────────────────────── */

.card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  font-size: 13px;
}

.card.approved { border-color: #6ee7b7; background: #ecfdf5; }

.card .approved-tag {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.card.active {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px #bae6fd;
}

.card.skipped { opacity: 0.45; }
.card.error { border-color: #fca5a5; background: #fef2f2; }

/* Highlight cards that Approve All couldn't auto-approve — user attention needed */
.card.needs-review {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px #fde68a;
}
.card.needs-review::before {
  content: "Needs review";
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}
body.dark .card.needs-review {
  border-color: #f59e0b;
  background: #422006;
  box-shadow: 0 0 0 2px #78350f;
}
body.dark .card.needs-review::before {
  color: #fbbf24;
  background: #422006;
}

/* ── Collapsible card header ─────────────────────────────── */

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.card-header-main { flex: 1; }

.card-header-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 11px;
  color: #94a3b8;
}

.card-header-summary .best-score {
  background: #0891b2;
  color: white;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
}

.chevron {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.card.collapsed .chevron { transform: rotate(-90deg); }

.card-body {
  overflow: hidden;
  max-height: 2000px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.card.collapsed .card-body {
  max-height: 0;
  opacity: 0;
}

/* ── Claim text ──────────────────────────────────────────── */

.card .claim {
  font-style: italic;
  color: #64748b;
  margin-bottom: 0;
  border-left: 2px solid #e2e8f0;
  padding-left: 8px;
  line-height: 1.5;
}

.card-body > *:first-child { margin-top: 10px; }

.card .title {
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.35;
  color: #0f172a;
}

.card .meta { color: #94a3b8; font-size: 12px; margin-bottom: 8px; }

.card .why {
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.card .actions { display: flex; gap: 6px; }

.card .actions button {
  padding: 5px 10px;
  font-size: 12px;
}

.card .actions .skip { background: #f1f5f9; color: #0f172a; border: 1px solid #e2e8f0; }
.card .actions .skip:hover { background: #e2e8f0; }

.card .source-line { margin-bottom: 4px; font-size: 11px; color: #94a3b8; }
.card .claim-fact-line { margin-bottom: 10px; font-size: 11px; color: #94a3b8; }

/* Diagnostic shown when no candidate scores well — explains WHY the claim
   can't be sourced (vague, value judgment, factual error, etc.) */
.claim-problem {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px 0 10px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.45;
}
body.dark .claim-problem {
  background: #422006;
  border-color: #78350f;
  color: #fbbf24;
}
.card .claim-fact-line em { color: #64748b; font-style: italic; }
.field-tag, .era-tag {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.era-tag { background: #fce7f3; color: #9d174d; }
body.dark .field-tag { background: #1e1b4b; color: #a5b4fc; }
body.dark .era-tag { background: #4a044e; color: #f0abfc; }

.card .options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

/* ── Option items ────────────────────────────────────────── */

/* Show only the .current option by default; the others are pre-rendered
   but hidden, swapped in by the re-roll button. */
.option {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  display: none;
}
.option.current { display: block; }

/* Re-roll button — sits next to the source/query meta line */
.reroll-btn {
  margin-left: 8px;
  color: #0891b2;
}
.reroll-btn:hover { color: #0e7490; text-decoration: underline; }
.reroll-counter {
  color: #94a3b8;
  font-weight: 500;
}
body.dark .reroll-btn { color: #38bdf8; }
body.dark .reroll-btn:hover { color: #67e8f9; }

.option-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 4px;
}

.option .title { margin-bottom: 0; }

.option .score {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  background: #0891b2;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

.option .summary {
  font-size: 12px;
  color: #475569;
  margin: 6px 0;
  line-height: 1.4;
}

.option .why { margin-bottom: 8px; padding: 6px 8px; }

.option .actions { display: flex; gap: 6px; }

.option .meta a { color: #0891b2; text-decoration: none; }
.option .meta a:hover { text-decoration: underline; }

.card-actions { justify-content: flex-end; }

/* ── Utilities ───────────────────────────────────────────── */

.hidden { display: none !important; }

.link-btn {
  background: none;
  color: #0891b2;
  padding: 0 0 0 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: underline;
}

.link-btn:hover { background: none; color: #0e7490; }

/* ── Refine box ──────────────────────────────────────────── */

.refine-box {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.refine-box input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 12px;
}

.refine-box select {
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 12px;
  background: white;
}

.refine-box button {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Spinner ─────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid #e2e8f0;
  border-top-color: #0891b2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* ── Settings panel ──────────────────────────────────────── */

header { position: relative; }

.settings-wrap { position: relative; }

.settings-btn { padding: 7px 10px; font-size: 14px; }

.settings-panel {
  position: fixed;
  top: 52px;
  right: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  min-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  z-index: 600;
}

.settings-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid #f1f5f9;
}

.setting-row:first-of-type { border-top: none; padding-top: 0; }

.setting-label { font-size: 13px; color: #0f172a; font-weight: 500; }

.setting-row--col { flex-direction: column; align-items: flex-start; gap: 6px; }

.setting-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  background: #f8fafc;
  color: #0f172a;
}
.setting-input:focus { border-color: #0891b2; outline: none; background: white; }

.setting-hint { font-size: 11px; color: #94a3b8; margin: 0; }

.settings-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 8px 0;
}

.setting-select {
  padding: 4px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  background: #f8fafc;
  color: #0f172a;
}

/* ── Toggle switch ───────────────────────────────────────── */

.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #e2e8f0;
  border-radius: 20px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: #0891b2; }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Document tabs ───────────────────────────────────────── */

.doc-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
  min-height: 32px;
}

.doc-tabs-list {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.doc-tabs-list::-webkit-scrollbar { display: none; }

.doc-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px 6px 0 0;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  font-size: 12px;
  cursor: pointer;
  color: #64748b;
  white-space: nowrap;
  transition: background 0.12s;
  user-select: none;
  max-width: 140px;
}
.doc-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-tab:hover { background: #e2e8f0; color: #0f172a; }
.doc-tab.active { background: #fff; color: #0f172a; border-color: #e2e8f0; font-weight: 600; position: relative; }
.doc-tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px; background: #fff; }

.doc-tab-close {
  background: none; border: none; padding: 0 0 0 2px; font-size: 13px;
  color: #94a3b8; cursor: pointer; line-height: 1; flex-shrink: 0;
  display: none;
}
.doc-tab:hover .doc-tab-close,
.doc-tab.active .doc-tab-close { display: block; }
.doc-tab-close:hover { color: #ef4444; background: none; }

.doc-tab-new {
  background: none;
  border: 1px dashed #e2e8f0;
  color: #94a3b8;
  font-size: 16px;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s;
}
.doc-tab-new:hover { color: #0891b2; border-color: #0891b2; background: none; }

/* ── DOI lookup row ──────────────────────────────────────── */

.doi-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.doi-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  background: #f8fafc;
  color: #0f172a;
}
.doi-row input:focus { border-color: #0891b2; outline: none; background: white; }
.doi-row button { padding: 6px 12px; font-size: 12px; flex-shrink: 0; }

/* ── Review header ───────────────────────────────────────── */

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.review-header h2 { margin: 0; }

.icon-btn { padding: 4px 8px; font-size: 12px; }

/* ── Age warning badge ───────────────────────────────────── */

.age-warn {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde68a;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.retracted-warn {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.quality-warn {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.quality-warn--preprint {
  background: #faf5ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}

/* ── Abstract toggle ─────────────────────────────────────── */

.abstract-toggle { margin: 6px 0 4px; }

.abstract-text {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
  margin-top: 4px;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}

/* ── Focus mode ──────────────────────────────────────────── */

body.focus-mode header { display: none; }
body.focus-mode .hero { display: none; }
body.focus-mode .review-pane,
body.focus-mode .pane-divider { display: none; }
body.focus-mode .editor-pane { border-radius: 0; }
/* In focus mode the floating .focus-bar pill (top:12px right:14px) sits over
   the right edge of the editor pane. Without extra right-padding here, the
   ＋ "new document" button at the end of the doc-tabs row gets covered by
   the pill's ⚙ / ✕ buttons. Reserve enough space for the pill (~64px) plus
   breathing room. */
body.focus-mode .doc-tabs { padding-right: 80px; }

/* Floating mini-pill — only visible in focus mode */
.focus-bar {
  display: none;
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 500;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 3px 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.focus-bar:hover { opacity: 1; }
body.focus-mode .focus-bar { display: flex; }

.focus-bar-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  width: 26px;
  height: 26px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: background 0.1s, color 0.1s;
  padding: 0;
}
.focus-bar-btn:hover { background: #f1f5f9; color: #0f172a; }
.focus-bar-exit:hover { background: #fee2e2; color: #dc2626; }

body.dark .focus-bar {
  background: rgba(30,41,59,0.88);
  border-color: #334155;
}
body.dark .focus-bar-btn { color: #94a3b8; }
body.dark .focus-bar-btn:hover { background: #334155; color: #e2e8f0; }
body.dark .focus-bar-exit:hover { background: #450a0a; color: #f87171; }

/* ══════════════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════════════ */

body.dark { background: #0f172a; color: #e2e8f0; }

body.dark header { background: #1e293b; border-bottom-color: #334155; }
body.dark .header-toggle { color: #475569; }
body.dark .header-toggle:hover { color: #38bdf8; }
body.dark header h1 a { color: #38bdf8; }

body.dark main { background: #0f172a; }
body.dark .pane-divider:hover::after,
body.dark .pane-divider.dragging::after { background: #38bdf8; }
body.dark .editor-pane,
body.dark .review-pane { background: #1e293b; }

/* Dark-mode editor: legacy textarea rules — kept inert because the new
   contenteditable surface is styled via .editor-page (always-light paper). */

body.dark #claudeKey,
body.dark #geminiKey {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark #providerSelect,
body.dark #styleSelect {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark button.secondary {
  background: #334155;
  color: #e2e8f0;
  border-color: #475569;
}
body.dark button.secondary:hover { background: #475569; }

body.dark .mode-option { background: #0f172a; border-color: #334155; }
body.dark .mode-option:has(input:checked) { background: #0c4a6e; border-color: #38bdf8; }
body.dark .mode-option span { color: #e2e8f0; }
body.dark .mode-option small { color: #64748b; }

body.dark .card { background: #1e293b; border-color: #334155; }
body.dark .card.approved { background: #052e16; border-color: #166534; }
body.dark .card.error { background: #450a0a; border-color: #991b1b; }
body.dark .card.active { border-color: #38bdf8; box-shadow: 0 0 0 3px #0c4a6e; }
body.dark .card .claim { color: #94a3b8; border-left-color: #334155; }
body.dark .card .title { color: #e2e8f0; }
body.dark .card .meta { color: #64748b; }
body.dark .card .why { background: #0f172a; color: #94a3b8; }
body.dark .card .approved-tag { color: #4ade80; }

body.dark .option { background: #0f172a; border-color: #334155; }
body.dark .option .title { color: #e2e8f0; }
body.dark .option .summary { color: #94a3b8; }

body.dark .review-pane h2 { color: #64748b; }
body.dark .empty { color: #64748b; }
body.dark .status { color: #64748b; }
body.dark .count-display { color: #475569; }
body.dark .editor-pane label { color: #94a3b8; }
body.dark .card-header-summary { color: #64748b; }
body.dark .chevron { color: #64748b; }
body.dark .link-btn { color: #38bdf8; }
body.dark .link-btn:hover { color: #7dd3fc; }

body.dark .refine-box input,
body.dark .refine-box select {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark .editor-pane label code,
body.dark .empty code { background: #0c4a6e; color: #38bdf8; }

body.dark .settings-panel {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
body.dark .settings-title { color: #64748b; }
body.dark .setting-label { color: #e2e8f0; }
body.dark .setting-row { border-top-color: #334155; }
body.dark .setting-select,
body.dark .setting-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
body.dark .settings-divider { background: #334155; }

body.dark .hero { background: linear-gradient(135deg, #0c4a6e 0%, #083344 100%); }
body.dark .hero-badge { background: #0c4a6e; color: #38bdf8; }
body.dark .hero-title { color: #e2e8f0; }
body.dark .hero-sub { color: #94a3b8; }
body.dark .hero-sub code { background: #0c4a6e; color: #38bdf8; }

body.dark .spinner { border-color: #334155; border-top-color: #38bdf8; }

body.dark .doc-tabs { border-bottom-color: #334155; }
body.dark .doc-tab { background: #0f172a; border-color: #334155; color: #64748b; }
body.dark .doc-tab:hover { background: #334155; color: #e2e8f0; }
body.dark .doc-tab.active { background: #1e293b; color: #e2e8f0; }
body.dark .doc-tab.active::after { background: #1e293b; }
body.dark .doc-tab-new { border-color: #334155; color: #475569; }
body.dark .doc-tab-new:hover { color: #38bdf8; border-color: #38bdf8; }

body.dark .doi-row input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark .doi-row input:focus { border-color: #38bdf8; background: #0f172a; }

body.dark .abstract-text { background: #0f172a; border-color: #334155; color: #94a3b8; }

/* ── Paywall modal ───────────────────────────────────────── */

.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: paywall-fade 0.2s ease;
}
.paywall-overlay.hidden { display: none; }

@keyframes paywall-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.paywall-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px 24px;
  max-width: 560px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: paywall-slide 0.25s ease;
}

@keyframes paywall-slide {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.paywall-icon {
  font-size: 36px;
  text-align: center;
  margin-bottom: 8px;
}

.paywall-title {
  margin: 0 0 6px;
  font-size: 22px;
  text-align: center;
  color: #0f172a;
}

.paywall-sub {
  margin: 0 0 24px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.paywall-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.paywall-option {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 16px;
  background: #f8fafc;
  position: relative;
}

.paywall-option--featured {
  background: linear-gradient(135deg, #eff6ff 0%, #ecfeff 100%);
  border-color: #0891b2;
}

.paywall-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: #0891b2;
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 10px;
}

.paywall-option-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.paywall-option h3 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.paywall-price {
  font-size: 18px;
  font-weight: 700;
  color: #0891b2;
}
.paywall-price small {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.paywall-option p {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

.paywall-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
}
.paywall-btn:hover { opacity: 0.9; }
.paywall-btn:active { transform: translateY(1px); }

.paywall-btn--primary { background: #0891b2; color: white; }
.paywall-btn--secondary {
  background: white;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.paywall-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  color: #94a3b8;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.paywall-close:hover { background: #f1f5f9; color: #0f172a; }

@media (max-width: 520px) {
  .paywall-options { grid-template-columns: 1fr; }
}

/* Dark mode */
body.dark .paywall-modal { background: #1e293b; }
body.dark .paywall-title { color: #e2e8f0; }
body.dark .paywall-sub { color: #94a3b8; }
body.dark .paywall-option { background: #0f172a; border-color: #334155; }
body.dark .paywall-option--featured {
  background: linear-gradient(135deg, #0c4a6e 0%, #083344 100%);
  border-color: #0891b2;
}
body.dark .paywall-option h3 { color: #e2e8f0; }
body.dark .paywall-option p { color: #94a3b8; }
body.dark .paywall-btn--secondary {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
body.dark .paywall-close:hover { background: #334155; color: #e2e8f0; }

/* ════════════════════════════════════════════════════════════
   Responsive — tablets, phones, narrow windows
════════════════════════════════════════════════════════════ */

/* Tablet & narrow desktop: stack editor above review (≤ 820px) */
@media (max-width: 820px) {
  main {
    flex-direction: column;
  }

  .editor-pane {
    flex: 1 1 60%;
    min-height: 320px;
    border-bottom: 1px solid #e2e8f0;
  }

  .review-pane {
    width: auto;          /* override fixed 420px */
    flex: 1 1 40%;
    min-height: 240px;
  }

  /* Pane divider becomes a horizontal bar (or hide on touch devices) */
  .pane-divider {
    display: none;        /* drag-resize doesn't translate well to touch */
  }

  /* Header controls wrap if they overflow */
  .controls {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  /* Settings panel: cap at 90vw so it never overflows viewport */
  .settings-panel {
    max-width: calc(100vw - 32px);
    right: 16px;
  }

  /* Hero: less vertical padding so app shows above the fold */
  .hero-inner {
    padding: 28px 20px;
  }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 14px; }

  /* Document tabs scroll horizontally instead of wrapping */
  .doc-tabs-list {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }
  .doc-tab { flex-shrink: 0; }
}

/* Phone: even tighter (≤ 560px) */
@media (max-width: 560px) {
  body {
    /* Allow vertical scroll on phones — full-height flex with overflow:hidden
       traps users below the keyboard when the editor is focused. */
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  main {
    min-height: calc(100vh - 60px);
  }

  /* Header: shrink to essentials */
  header {
    padding: 8px 12px;
    gap: 8px;
  }
  header h1 { font-size: 16px; }

  /* Hide the secondary text on mode option labels to save vertical space */
  .mode-option small { display: none; }

  /* Editor + review panes: smaller padding */
  .editor-pane, .review-pane {
    padding: 12px;
  }

  /* Editor textarea: smaller font + line-height for thumb-typing */
  #editor {
    font-size: 13px;
    line-height: 1.55;
    padding: 10px;
  }

  /* Editor footer wraps */
  .editor-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
  .editor-footer-right {
    width: 100%;
    justify-content: space-between;
  }
  #findBtn {
    width: 100%;
  }

  /* Card body padding */
  .card { padding: 10px; }
  .card .claim { font-size: 13px; }

  /* Focus bar: stays in corner but tighter */
  .focus-bar {
    top: 8px;
    right: 8px;
  }

  /* Hero CTA can be full width on phone */
  .hero-cta {
    width: 100%;
    max-width: 280px;
  }
  .hero-title { font-size: 22px; }
  .hero-sub { font-size: 13px; line-height: 1.5; }
  .hero-inner { padding: 20px 16px; }

  /* DOI lookup row stacks instead of overflowing */
  .doi-row {
    flex-direction: column;
    align-items: stretch;
  }
  .doi-row input { width: 100%; }

  /* Settings panel: full width minus margins */
  .settings-panel {
    left: 8px;
    right: 8px;
    max-width: none;
    min-width: 0;
    top: 48px;
  }
}

/* Disable the resizable-pane drag on touch devices regardless of width */
@media (pointer: coarse) {
  .pane-divider { display: none; }
}

/* ============================================================
   v2 overrides — merged from styles.v2.css
   ============================================================ */
/* ============================================================
   ZeroCite app — styles.v2.css
   Overrides styles.css to apply the landing v2 design system:
   light gray bg, white surfaces, sky-blue accents, animated grid,
   smooth hover transitions.

   This file @imports the original styles.css then overrides via
   the cascade. Originals stay untouched.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --v2-bg:           #f1f3f5;     /* light cool gray page bg */
  --v2-surface:      #ffffff;
  --v2-surface-alt:  #f5f5f7;
  --v2-border:       #e5e7eb;
  --v2-border-strong:#d1d5db;
  --v2-text:         #0a0a0a;
  --v2-text-2:       #374151;
  --v2-muted:        #6b7280;

  --v2-accent:       #0ea5e9;     /* sky-500 */
  --v2-accent-hover: #0284c7;     /* sky-600 */
  --v2-accent-soft:  #e0f2fe;     /* sky-100 */
  --v2-accent-wash:  #f0f9ff;     /* sky-50 */
  --v2-accent-light: #7dd3fc;     /* sky-300 */
  --v2-accent-line:  rgba(14, 165, 233, 0.10);

  --v2-radius: 8px;
}

/* ---------- Global font + bg ---------- */

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  background: var(--v2-bg) !important;
  color: var(--v2-text) !important;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Hero with animated grid ---------- */

.hero {
  background: var(--v2-surface) !important;
  border-bottom: 1px solid var(--v2-border) !important;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--v2-accent-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--v2-accent-line) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: v2-grid-drift 28s linear infinite;
  mask-image: radial-gradient(ellipse 80% 70% at center, black 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at center, black 0%, transparent 100%);
  z-index: 0;
}

@keyframes v2-grid-drift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 48px 48px, 48px 48px; }
}

.hero-inner { position: relative; z-index: 1; }

.hero-badge {
  background: var(--v2-accent-soft) !important;
  color: var(--v2-accent-hover) !important;
  border: 1px solid color-mix(in srgb, var(--v2-accent) 20%, transparent);
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  border-radius: var(--v2-radius) !important;
}

.hero-title {
  color: var(--v2-text) !important;
  letter-spacing: -0.03em !important;
  font-weight: 600 !important;
}

.hero-sub { color: var(--v2-text-2) !important; line-height: 1.6 !important; }

.hero-sub code {
  background: var(--v2-accent-soft) !important;
  color: var(--v2-accent-hover) !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  border: 1px solid color-mix(in srgb, var(--v2-accent) 20%, transparent);
  border-radius: 4px !important;
  padding: 2px 6px !important;
}

.hero-cta {
  background: var(--v2-accent) !important;
  color: #ffffff !important;
  border-radius: var(--v2-radius) !important;
  font-weight: 500 !important;
  transition: background 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.hero-cta:hover {
  background: var(--v2-accent-hover) !important;
  transform: translateY(-1px);
}

/* ---------- Header ---------- */

header {
  background: var(--v2-surface) !important;
  border-bottom: 1px solid var(--v2-border) !important;
}

header h1 {
  color: var(--v2-text) !important;
  letter-spacing: -0.015em !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
header h1 a { color: inherit !important; }
header h1::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--v2-accent);
  transform: rotate(45deg);
}

.header-toggle { color: var(--v2-muted) !important; }
.header-toggle:hover { color: var(--v2-accent) !important; }

/* Sign in link in header — make it primary blue like Find Citations */
#headerSignInLink, a#headerSignInLink.secondary {
  background: var(--v2-accent) !important;
  color: #ffffff !important;
  border: 1px solid var(--v2-accent) !important;
  border-radius: var(--v2-radius) !important;
  font-weight: 600 !important;
  padding: 7px 14px !important;
  font-size: 13px !important;
  transition: background 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}
#headerSignInLink:hover, a#headerSignInLink.secondary:hover {
  background: var(--v2-accent-hover) !important;
  border-color: var(--v2-accent-hover) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* ---------- Buttons (global) ---------- */

button {
  background: var(--v2-accent) !important;
  color: #ffffff !important;
  border-radius: var(--v2-radius) !important;
  font-weight: 500 !important;
  transition: background 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 180ms ease, color 180ms ease !important;
  font-family: 'Inter', sans-serif !important;
}
button:hover {
  background: var(--v2-accent-hover) !important;
  transform: translateY(-1px);
}
button:disabled {
  background: var(--v2-muted) !important;
  transform: none;
  cursor: not-allowed;
}

button.secondary {
  background: var(--v2-surface) !important;
  color: var(--v2-text) !important;
  border: 1px solid var(--v2-border) !important;
}
button.secondary:hover {
  background: var(--v2-accent-wash) !important;
  border-color: var(--v2-accent) !important;
  color: var(--v2-accent) !important;
}

button.secondary:disabled {
  background: var(--v2-surface-alt) !important;
  color: var(--v2-muted) !important;
  border-color: var(--v2-border) !important;
}

/* ---------- Inputs / selects ---------- */

#apiKey, #styleSelect, #providerSelect, .setting-input, .setting-select,
input[type="text"], input[type="email"], input[type="password"], select {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
  color: var(--v2-text) !important;
  font-family: 'Inter', sans-serif !important;
  transition: border-color 180ms ease, background 180ms ease !important;
}
#apiKey:focus, .setting-input:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus {
  border-color: var(--v2-accent) !important;
  outline: none;
  background: var(--v2-surface) !important;
  box-shadow: 0 0 0 3px var(--v2-accent-soft);
}

/* Radio/checkbox: no glowing focus ring */
input[type="radio"], input[type="checkbox"] {
  accent-color: var(--v2-accent);
}
input[type="radio"]:focus, input[type="checkbox"]:focus {
  box-shadow: none !important;
  outline: 2px solid var(--v2-accent-soft);
  outline-offset: 2px;
}

/* ---------- Main panes ---------- */

main {
  background: var(--v2-border) !important;
}

/* ---------- Editor "page" surface (contenteditable) ---------- */
/* Legacy textarea-targeted rules removed when the editor migrated to a
   contenteditable div sitting inside a styled "page" container. The new
   rules at the top of this file (see ".editor-page" / "#editor") handle
   layout. Below we keep dark-mode-friendly chrome for the desk surrounding
   the page, while the page itself stays light in both modes (matches
   Google Docs / Word — paper is always white). */
.editor-page-wrap { background: transparent; }
/* The editor is a flat centered column now (no "desk"/"paper"); see the
   primary ".editor-page" rule near the top of this file. */
#editor, #editor *,
#references, #references * {
  /* Inherit font from inline styles (so pasted content keeps its font)
     while ensuring the default look stays document-like. */
  background: transparent;
}

#editor code, #references code, textarea code, .editor-pane code, .review-pane code {
  background: var(--v2-accent-soft) !important;
  color: var(--v2-accent-hover) !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}

label code, .label-row code {
  background: var(--v2-accent-soft) !important;
  color: var(--v2-accent-hover) !important;
  border: 1px solid color-mix(in srgb, var(--v2-accent) 20%, transparent);
  border-radius: 4px !important;
  padding: 1px 6px !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-size: 0.88em !important;
}

/* ---------- Mode toggle (segmented pill) ---------- */

.mode-row {
  display: inline-flex !important;
  gap: 0 !important;
  padding: 4px !important;
  background: var(--v2-surface-alt) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
  margin-bottom: 12px !important;
  width: auto !important;
  align-self: flex-start !important;
}

.mode-option {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 6px 14px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--v2-muted) !important;
  transition: background 220ms cubic-bezier(0.22, 1, 0.36, 1),
              color 220ms ease,
              transform 220ms cubic-bezier(0.22, 1, 0.36, 1) !important;
  position: relative;
  white-space: nowrap;
}

/* Hide the radio circle and the descriptive small text — keep tab clean */
.mode-option input[type="radio"] { display: none !important; }
.mode-option small { display: none !important; }

.mode-option span {
  color: inherit !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

.mode-option:hover { color: var(--v2-text) !important; }

.mode-option:has(input:checked) {
  background: var(--v2-surface) !important;
  color: var(--v2-accent) !important;
  border: 1px solid var(--v2-border) !important;
  padding: 5px 13px !important; /* compensate for border */
  font-weight: 600 !important;
}

/* ---------- DOI row ---------- */

.doi-row input {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
}
.doi-row input:focus {
  border-color: var(--v2-accent) !important;
  box-shadow: 0 0 0 3px var(--v2-accent-soft);
}

/* ---------- Find Citations button — make it pop ---------- */

#findBtn {
  background: var(--v2-accent) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  padding: 10px 20px !important;
  border-radius: var(--v2-radius) !important;
}
#findBtn:hover {
  background: var(--v2-accent-hover) !important;
  transform: translateY(-1px);
}

/* ---------- Link buttons (Auto-detect / [src] / Upload PDF / Zotero) ---------- */

.link-btn {
  color: var(--v2-accent) !important;
  background: transparent !important;
  border: none !important;
  padding: 4px 6px !important;
  border-radius: 4px !important;
}
.link-btn:hover {
  background: var(--v2-accent-wash) !important;
  color: var(--v2-accent-hover) !important;
  transform: none;
}

/* ---------- Cards (claim cards in review pane) ---------- */

.card {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
  transition: border-color 200ms ease, transform 200ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.card:hover {
  border-color: var(--v2-accent-light) !important;
  transform: translateY(-1px);
}
.card.approved {
  border-color: #6ee7b7 !important;
  background: #ecfdf5 !important;
}
.card.error {
  border-color: #fca5a5 !important;
  background: #fef2f2 !important;
}

/* ---------- Settings panel ---------- */

.settings-panel {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
}
.settings-title { color: var(--v2-text) !important; font-weight: 600 !important; }
.setting-label { color: var(--v2-text-2) !important; }
.setting-hint { color: var(--v2-muted) !important; }
.settings-divider { background: var(--v2-border) !important; }

/* ---------- Toggle (dark mode) ---------- */

.toggle-slider { background: var(--v2-border) !important; }
.toggle input:checked + .toggle-slider { background: var(--v2-accent) !important; }

/* ---------- Pane divider ---------- */

.pane-divider { background: transparent !important; }
.pane-divider:hover { background: var(--v2-accent-light) !important; }

/* ---------- Review pane header ---------- */

.review-pane { background: var(--v2-bg) !important; }
.review-header h2 {
  color: var(--v2-text) !important;
  font-weight: 600 !important;
  letter-spacing: -0.015em !important;
}

.editor-pane { background: var(--v2-bg) !important; }

.empty {
  color: var(--v2-muted) !important;
  background: var(--v2-surface) !important;
  border: 1px dashed var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
  padding: 16px !important;
}
.empty code {
  background: var(--v2-accent-soft) !important;
  color: var(--v2-accent-hover) !important;
}

/* ---------- Doc tabs ---------- */

.doc-tabs {
  border-bottom: 1px solid var(--v2-border) !important;
  background: var(--v2-bg) !important;
  padding-bottom: 0 !important;
  min-height: 36px !important;
  gap: 6px !important;
}

.doc-tab {
  background: var(--v2-surface-alt) !important;
  border: 1px solid var(--v2-border) !important;
  border-bottom: none !important;
  border-radius: var(--v2-radius) var(--v2-radius) 0 0 !important;
  color: var(--v2-text-2) !important;
  padding: 7px 12px 7px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  max-width: 200px !important;
  gap: 8px !important;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease !important;
}
.doc-tab:hover {
  background: var(--v2-surface) !important;
  color: var(--v2-accent) !important;
}
.doc-tab.active {
  background: var(--v2-surface) !important;
  color: var(--v2-text) !important;
  border-color: var(--v2-border) !important;
  border-bottom-color: var(--v2-surface) !important;
  font-weight: 600 !important;
  position: relative;
}
.doc-tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--v2-accent);
  border-radius: 2px 2px 0 0;
}
.doc-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--v2-surface);
}

/* Close X — plain text, no sky-blue fill from global button override */
.doc-tab-close {
  background: transparent !important;
  color: var(--v2-muted) !important;
  border: none !important;
  padding: 0 2px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  display: none;
  width: auto !important;
  height: auto !important;
  border-radius: 4px !important;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease !important;
}
.doc-tab:hover .doc-tab-close,
.doc-tab.active .doc-tab-close { display: inline-flex; align-items: center; justify-content: center; }
.doc-tab-close:hover {
  color: #ef4444 !important;
  background: transparent !important;
  transform: none;
}

.doc-tab-new {
  background: transparent !important;
  color: var(--v2-muted) !important;
  border: 1px dashed var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
  padding: 4px 10px !important;
  font-size: 15px !important;
  line-height: 1 !important;
}
.doc-tab-new:hover {
  background: var(--v2-accent-wash) !important;
  color: var(--v2-accent) !important;
  border-color: var(--v2-accent) !important;
  border-style: solid !important;
  transform: none;
}

/* ---------- Paywall modal ---------- */

.paywall-overlay { background: rgba(10, 10, 10, 0.5) !important; backdrop-filter: blur(4px); }
.paywall-modal {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
}
.paywall-title { color: var(--v2-text) !important; font-weight: 600 !important; }
.paywall-sub { color: var(--v2-text-2) !important; }
.paywall-option {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
}
.paywall-option--featured {
  border-color: var(--v2-accent) !important;
  border-width: 2px !important;
}
.paywall-badge {
  background: var(--v2-accent) !important;
  color: #ffffff !important;
  border-radius: var(--v2-radius) !important;
  font-weight: 600 !important;
}
.paywall-btn--primary {
  background: var(--v2-accent) !important;
  color: #ffffff !important;
  border-radius: var(--v2-radius) !important;
}
.paywall-btn--primary:hover { background: var(--v2-accent-hover) !important; }
.paywall-btn--secondary {
  background: var(--v2-surface) !important;
  color: var(--v2-text) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
}
.paywall-btn--secondary:hover {
  border-color: var(--v2-accent) !important;
  color: var(--v2-accent) !important;
  background: var(--v2-accent-wash) !important;
}

/* ---------- Focus bar ---------- */

.focus-bar {
  background: var(--v2-surface) !important;
  border: 1px solid var(--v2-border) !important;
  border-radius: var(--v2-radius) !important;
}
.focus-bar-btn {
  background: transparent !important;
  color: var(--v2-muted) !important;
  border-radius: 4px !important;
}
.focus-bar-btn:hover { background: var(--v2-accent-wash) !important; color: var(--v2-accent) !important; transform: none; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero::before { animation: none !important; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============================================================
   v2 DARK MODE — overrides to flip the v2 sky-blue/light system
   back to a dark surface when body.dark is set.
   ============================================================ */

body.dark {
  background: #0b1220 !important;
  color: #e2e8f0 !important;
}

/* Hero banner */
body.dark .hero {
  background: #1e293b !important;
  border-bottom-color: #334155 !important;
}
body.dark .hero::before {
  background-image:
    linear-gradient(to right, rgba(56, 189, 248, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.10) 1px, transparent 1px) !important;
}
body.dark .hero-badge {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.30) !important;
}
body.dark .hero-title { color: #e2e8f0 !important; }
body.dark .hero-sub { color: #cbd5e1 !important; }
body.dark .hero-sub code {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.30) !important;
}
body.dark .hero-cta {
  background: #38bdf8 !important;
  color: #0b1220 !important;
}
body.dark .hero-cta:hover { background: #7dd3fc !important; }

/* Header */
body.dark header {
  background: #1e293b !important;
  border-bottom-color: #334155 !important;
}
body.dark header h1 { color: #e2e8f0 !important; }
body.dark header h1::before { background: #38bdf8 !important; }
body.dark .header-toggle { color: #94a3b8 !important; }
body.dark .header-toggle:hover { color: #38bdf8 !important; }

/* Buttons */
body.dark button {
  background: #38bdf8 !important;
  color: #0b1220 !important;
}
body.dark button:hover { background: #7dd3fc !important; }
body.dark button:disabled {
  background: #475569 !important;
  color: #94a3b8 !important;
}
body.dark button.secondary {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body.dark button.secondary:hover {
  background: #082f49 !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}
body.dark button.secondary:disabled {
  background: #0f172a !important;
  color: #475569 !important;
  border-color: #334155 !important;
}

/* Sign in link in header */
body.dark #headerSignInLink,
body.dark a#headerSignInLink.secondary {
  background: #38bdf8 !important;
  color: #0b1220 !important;
  border-color: #38bdf8 !important;
}
body.dark #headerSignInLink:hover {
  background: #7dd3fc !important;
  border-color: #7dd3fc !important;
  color: #0b1220 !important;
}

/* Find Citations primary action */
body.dark #findBtn {
  background: #38bdf8 !important;
  color: #0b1220 !important;
}
body.dark #findBtn:hover { background: #7dd3fc !important; }

/* Inputs / selects */
body.dark #apiKey, body.dark #styleSelect, body.dark #providerSelect,
body.dark .setting-input, body.dark .setting-select,
body.dark input[type="text"], body.dark input[type="email"],
body.dark input[type="password"], body.dark select {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
body.dark #apiKey:focus, body.dark .setting-input:focus,
body.dark input[type="text"]:focus, body.dark input[type="email"]:focus,
body.dark input[type="password"]:focus, body.dark select:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px #0c4a6e !important;
}

/* Dark mode editor: flat dark writing column. The editor pane behind it is
   already dark and the column is transparent, so we only fix the text colour. */
body.dark .editor-page-wrap { background: transparent !important; }
body.dark .editor-page {
  color: #e6ebf3 !important;
}
body.dark #editor, body.dark #references {
  background: transparent !important;
  color: #e2e8f0 !important;
  border: 0 !important;
}
body.dark .ref-pane-card {
  background: #1a1f2e !important;
  border-color: #334155 !important;
}
body.dark .ref-pane-toggle {
  color: #94a3b8 !important;
}
body.dark .ref-pane-toggle:hover {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}
body.dark #editor:empty::before,
body.dark #references:empty::before {
  color: #64748b !important;
}
body.dark #autoReferencesBlock {
  border-top-color: #334155 !important;
}
body.dark #autoReferencesBlock h2 {
  color: #f1f5f9 !important;
}

/* Inline code chips */
body.dark code,
body.dark .label-row code,
body.dark #editor code, body.dark #references code, body.dark textarea code,
body.dark .editor-pane code, body.dark .review-pane code,
body.dark label code {
  background: #0c4a6e !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.30) !important;
}

/* Mode toggle pill */
body.dark .mode-row {
  background: #0f172a !important;
  border-color: #334155 !important;
}
body.dark .mode-option { color: #94a3b8 !important; }
body.dark .mode-option:hover { color: #e2e8f0 !important; }
body.dark .mode-option:has(input:checked) {
  background: #1e293b !important;
  color: #38bdf8 !important;
  border-color: #334155 !important;
}

/* Link buttons */
body.dark .link-btn { color: #38bdf8 !important; }
body.dark .link-btn:hover {
  background: #082f49 !important;
  color: #7dd3fc !important;
}

/* Cards */
body.dark .card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
body.dark .card:hover { border-color: #38bdf8 !important; }

/* Settings panel */
body.dark .settings-panel {
  background: #1e293b !important;
  border-color: #334155 !important;
}
body.dark .settings-title { color: #e2e8f0 !important; }
body.dark .setting-label { color: #cbd5e1 !important; }
body.dark .setting-hint { color: #94a3b8 !important; }
body.dark .settings-divider { background: #334155 !important; }

/* Toggle */
body.dark .toggle-slider { background: #334155 !important; }
body.dark .toggle input:checked + .toggle-slider { background: #38bdf8 !important; }

/* Pane divider */
body.dark .pane-divider:hover { background: #38bdf8 !important; }

/* Review / editor panes */
body.dark .review-pane { background: #0b1220 !important; }
body.dark .editor-pane { background: #0b1220 !important; }
body.dark .review-header h2 { color: #e2e8f0 !important; }
body.dark .empty {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* Doc tabs */
body.dark .doc-tabs {
  background: #0b1220 !important;
  border-bottom-color: #334155 !important;
}
body.dark .doc-tab {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
body.dark .doc-tab:hover {
  background: #1e293b !important;
  color: #38bdf8 !important;
}
body.dark .doc-tab.active {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-bottom-color: #1e293b !important;
}
body.dark .doc-tab.active::before { background: #38bdf8 !important; }
body.dark .doc-tab.active::after { background: #1e293b !important; }
body.dark .doc-tab-close { color: #94a3b8 !important; }
body.dark .doc-tab-close:hover { color: #f87171 !important; }
body.dark .doc-tab-new {
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
body.dark .doc-tab-new:hover {
  background: #082f49 !important;
  color: #38bdf8 !important;
  border-color: #38bdf8 !important;
}

/* Paywall */
body.dark .paywall-modal {
  background: #1e293b !important;
  border-color: #334155 !important;
}
body.dark .paywall-title { color: #e2e8f0 !important; }
body.dark .paywall-sub { color: #cbd5e1 !important; }
body.dark .paywall-option {
  background: #0f172a !important;
  border-color: #334155 !important;
}
body.dark .paywall-option--featured { border-color: #38bdf8 !important; }
body.dark .paywall-badge {
  background: #38bdf8 !important;
  color: #0b1220 !important;
}
body.dark .paywall-btn--primary {
  background: #38bdf8 !important;
  color: #0b1220 !important;
}
body.dark .paywall-btn--primary:hover { background: #7dd3fc !important; }
body.dark .paywall-btn--secondary {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body.dark .paywall-btn--secondary:hover {
  background: #082f49 !important;
  color: #38bdf8 !important;
  border-color: #38bdf8 !important;
}

/* Focus bar */
body.dark .focus-bar {
  background: #1e293b !important;
  border-color: #334155 !important;
}
body.dark .focus-bar-btn:hover {
  background: #082f49 !important;
  color: #38bdf8 !important;
}

/* Main panes container — covers the divider gap */
body.dark main { background: #334155 !important; }

/* Mode toggle radio focus outline */
body.dark input[type="radio"]:focus,
body.dark input[type="checkbox"]:focus {
  outline-color: #0c4a6e !important;
}

/* ============================================================
   v2 DARK MODE — fix link/icon buttons that inherited the solid
   sky-blue fill from the global `body.dark button` rule.
   Override them back to transparent so their icons/text show.
   ============================================================ */

/* Inline link buttons inside label rows (Auto-detect / [src] / Upload PDF / Zotero) */
body.dark .link-btn {
  background: transparent !important;
  color: #38bdf8 !important;
  border: none !important;
  padding: 4px 6px !important;
}
body.dark .link-btn:hover {
  background: #082f49 !important;
  color: #7dd3fc !important;
}

/* Doc tab close X — transparent, muted, red on hover */
body.dark .doc-tab-close {
  background: transparent !important;
  color: #94a3b8 !important;
  border: none !important;
  padding: 0 2px !important;
  width: auto !important;
  height: auto !important;
}
body.dark .doc-tab-close:hover {
  background: transparent !important;
  color: #f87171 !important;
}

/* Doc tab "new" + button — transparent with dashed sky border */
body.dark .doc-tab-new {
  background: transparent !important;
  color: #94a3b8 !important;
  border: 1px dashed #334155 !important;
}
body.dark .doc-tab-new:hover {
  background: #082f49 !important;
  color: #38bdf8 !important;
  border-color: #38bdf8 !important;
  border-style: solid !important;
}

/* Header collapse arrow */
body.dark .header-toggle {
  background: transparent !important;
  color: #94a3b8 !important;
  border: none !important;
  padding: 2px 4px !important;
}
body.dark .header-toggle:hover {
  background: transparent !important;
  color: #38bdf8 !important;
}

/* Focus mode floating bar buttons */
body.dark .focus-bar-btn {
  background: transparent !important;
  color: #94a3b8 !important;
  border: none !important;
}
body.dark .focus-bar-btn:hover {
  background: #082f49 !important;
  color: #38bdf8 !important;
}
body.dark .focus-bar-exit:hover {
  background: #450a0a !important;
  color: #f87171 !important;
}

/* Mode toggle pill — option buttons should be transparent except the active one */
body.dark .mode-option {
  background: transparent !important;
  border: 1px solid transparent !important;
}

/* Paywall close X */
body.dark .paywall-close {
  background: transparent !important;
  color: #94a3b8 !important;
  border: none !important;
}
body.dark .paywall-close:hover {
  background: transparent !important;
  color: #e2e8f0 !important;
}

/* ============================================================
   v2 DARK MODE — DEEP NAVY OVERHAUL (third tier)
   Re-shades the dark palette toward a saturated almost-black blue
   and gives the top header a slight lift above the work panes so
   it no longer feels disconnected.
   ============================================================ */

/* Page bg — deep midnight navy, almost black with blue saturation */
body.dark {
  background: #030b1f !important;
  color: #e2e8f0 !important;
}

/* Header lifts slightly above the page bg with its own surface tone */
body.dark header {
  background: #0c172e !important;
  border-bottom-color: #1c2a4f !important;
}

/* Pane container — the thin gap between editor and review panes.
   Was a too-light slate; now barely visible against the deep bg. */
body.dark main {
  background: #050e26 !important;
}

/* Editor + review panes match the page bg, so they feel like
   one continuous deep workspace */
body.dark .editor-pane,
body.dark .review-pane {
  background: #030b1f !important;
}

/* All "card" surfaces (claim cards, settings panel, paywall modal,
   focus bar, hero banner inside app) get the lifted surface tone */
body.dark .card,
body.dark .settings-panel,
body.dark .paywall-modal,
body.dark .focus-bar,
body.dark .empty,
body.dark .hero {
  background: #0c172e !important;
  border-color: #1c2a4f !important;
}

body.dark .paywall-option {
  background: #060e24 !important;
  border-color: #1c2a4f !important;
}

/* Inputs / textareas / selects — slightly inset feel */
body.dark #apiKey,
body.dark #styleSelect,
body.dark #providerSelect,
body.dark .setting-input,
body.dark .setting-select,
body.dark input[type="text"],
body.dark input[type="email"],
body.dark input[type="password"],
body.dark select {
  background: #060e24 !important;
  border-color: #1c2a4f !important;
}
/* #editor / #references intentionally excluded: they must stay transparent
   so the .editor-page stacked-sheet surface shows through behind the text. */
body.dark #editor, body.dark #references { background: transparent !important; }

/* Mode toggle pill — outer pill is dark inset, active segment is lifted */
body.dark .mode-row {
  background: #060e24 !important;
  border-color: #1c2a4f !important;
}
body.dark .mode-option:has(input:checked) {
  background: #0c172e !important;
  border-color: #1c2a4f !important;
}

/* Doc tabs — inactive on dark inset, active on the surface lift */
body.dark .doc-tabs {
  background: #030b1f !important;
  border-bottom-color: #1c2a4f !important;
}
body.dark .doc-tab {
  background: #060e24 !important;
  border-color: #1c2a4f !important;
}
body.dark .doc-tab:hover {
  background: #0c172e !important;
}
body.dark .doc-tab.active {
  background: #0c172e !important;
  border-bottom-color: #0c172e !important;
}
body.dark .doc-tab.active::after { background: #0c172e !important; }
body.dark .doc-tab-new {
  border-color: #1c2a4f !important;
}

/* Borders elsewhere — replace the gray slate with deep blue border */
body.dark .settings-divider {
  background: #1c2a4f !important;
}

/* Hero banner inside the app (Start citing →) — text/code chips */
body.dark .hero-badge {
  background: #082f49 !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.30) !important;
}
body.dark .hero-sub code {
  background: #082f49 !important;
  color: #7dd3fc !important;
}

/* Buttons.secondary need to match the new surface tones */
body.dark button.secondary {
  background: #060e24 !important;
  color: #e2e8f0 !important;
  border-color: #1c2a4f !important;
}
body.dark button.secondary:hover {
  background: #082f49 !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}
body.dark button.secondary:disabled {
  background: #060e24 !important;
  color: #475569 !important;
  border-color: #1c2a4f !important;
}

/* Step number chips (if used inside app hero or anywhere) */
body.dark .step-num,
body.dark .eyebrow {
  background: #082f49 !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.25) !important;
}

/* ============================================================
   Settings panel "Sign in or create account" link — match the
   primary sky-blue button look in both light and dark mode.
   ============================================================ */

#authSignInLink,
a#authSignInLink.secondary {
  background: #0ea5e9 !important;
  color: #ffffff !important;
  border: 1px solid #0ea5e9 !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  transition: background 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1), border-color 180ms ease !important;
}
#authSignInLink:hover,
a#authSignInLink.secondary:hover {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

body.dark #authSignInLink,
body.dark a#authSignInLink.secondary {
  background: #38bdf8 !important;
  color: #030b1f !important;
  border-color: #38bdf8 !important;
}
body.dark #authSignInLink:hover,
body.dark a#authSignInLink.secondary:hover {
  background: #7dd3fc !important;
  border-color: #7dd3fc !important;
  color: #030b1f !important;
}
