/* v9: fonts self-hosted (SIL Open Font License, see assets/fonts/OFL-*.txt), Latin subset only */
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/literata-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/literata-latin-600-normal.woff2") format("woff2"); }

/* AcaTel — "annotated journal" theme
   Ink-blue structure, cool paper surface, one highlighter accent used only for
   things a researcher would mark: interests, open deadlines, AI summaries. */

:root {
  --ink: #1b2a4a;
  --ink-2: #33456b;
  --muted: #5d6a82;
  --paper: #f7f8fa;
  --surface: #ffffff;
  --rule: #d9dee7;
  --rule-soft: #eaedf2;
  --link: #0f6e6e;
  --mark: #ffe066;
  --mark-soft: rgba(255, 224, 102, .45);
  --danger: #b4413c;
  --ok: #2f7d4f;
  --nav-bg: #1b2a4a;
  --nav-text: #c9d3e6;
  --nav-active: #ffffff;
  --shadow: 0 1px 2px rgba(27, 42, 74, .06), 0 4px 16px rgba(27, 42, 74, .05);
  --radius-s: 4px;
  --radius-m: 8px;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Literata", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6eaf2; --ink-2: #c3cbdb; --muted: #95a1b8; --paper: #0f1626; --surface: #17213a;
    --rule: #2a3653; --rule-soft: #212c46; --link: #6cc7c0; --mark: #e8c547; --mark-soft: rgba(232, 197, 71, .25);
    --danger: #e07a73; --ok: #6fc391; --nav-bg: #0b1120; --nav-text: #9aa7c2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e6eaf2; --ink-2: #c3cbdb; --muted: #95a1b8; --paper: #0f1626; --surface: #17213a;
  --rule: #2a3653; --rule-soft: #212c46; --link: #6cc7c0; --mark: #e8c547; --mark-soft: rgba(232, 197, 71, .25);
  --danger: #e07a73; --ok: #6fc391; --nav-bg: #0b1120; --nav-text: #9aa7c2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 var(--font-body);
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Highlighter mark — the one bold element */
.mark {
  background: linear-gradient(transparent 38%, var(--mark-soft) 38%, var(--mark-soft) 92%, transparent 92%);
  padding: 0 .15em; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--nav-bg); color: var(--nav-text); padding: 22px 14px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 8px; }
.brand svg { flex: none; }
.brand b { font-family: var(--font-head); font-size: 1.35rem; font-weight: 600; letter-spacing: .01em; }
.brand small { display: block; font-size: .72rem; color: var(--nav-text); font-weight: 400; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: .75rem; color: var(--nav-text); opacity: .7; padding: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s);
  color: var(--nav-text); text-decoration: none; font-size: .93rem;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: var(--nav-active); box-shadow: inset 3px 0 0 var(--mark); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-foot { margin-top: auto; font-size: .8rem; padding: 0 8px; display: grid; gap: 6px; }
.sidebar-foot a { color: var(--nav-text); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 32px; border-bottom: 1px solid var(--rule); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: .85rem;
}
.topbar .menu-btn { display: none; }
.content { padding: 28px 32px 64px; max-width: 1180px; }
.page-head { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }
.badge-demo {
  display: inline-block; font-size: .78rem; padding: 3px 10px; border-radius: 999px;
  border: 1px dashed var(--muted); color: var(--muted);
}

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .9rem; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius-s); border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost { border-color: transparent; background: transparent; padding: 6px 8px; color: var(--link); }
.btn-ghost:hover { border-color: transparent; text-decoration: underline; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.is-saved { color: var(--ok); }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-s); padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: transparent; }
label { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); }
label > span { font-weight: 500; }

.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 16px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius-m); margin-bottom: 20px;
}
.filters > label { flex: 1 1 130px; }
.filters > label:first-child { flex: 2.4 1 240px; }
.filters .btn { height: 39px; flex: 0 0 auto; }

/* ---------- Panels / sections ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }

/* Dashboard briefing — sentences, not stat tiles */
.briefing { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); overflow: hidden; margin-bottom: 20px; }
.briefing a { padding: 16px 18px; text-decoration: none; color: var(--ink); border-right: 1px solid var(--rule); display: grid; gap: 2px; }
.briefing a:last-child { border-right: 0; }
.briefing a:hover { background: var(--rule-soft); }
.briefing strong { font-family: var(--font-head); font-size: 1.6rem; font-weight: 600; }
.briefing span { color: var(--muted); font-size: .88rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.chip { font-size: .9rem; }
.chip.mark { font-weight: 500; }

/* ---------- Result lists ---------- */
.results { display: grid; gap: 0; }
.results-empty, .results-loading, .results-error {
  padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--rule); border-radius: var(--radius-m);
}
.results-error { color: var(--danger); border-color: var(--danger); }
.skeleton { height: 76px; border-radius: var(--radius-s); background: linear-gradient(90deg, var(--rule-soft), var(--surface), var(--rule-soft)); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Bibliography-style paper entry with hanging indent */
.entry {
  padding: 16px 0 16px 0; border-bottom: 1px solid var(--rule-soft);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 20px;
}
.entry:first-child { padding-top: 4px; }
.entry-title { font-family: var(--font-head); font-size: 1.08rem; font-weight: 600; line-height: 1.3; }
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { color: var(--link); text-decoration: underline; }
.entry-meta { color: var(--muted); font-size: .88rem; padding-left: 1.4em; text-indent: -1.4em; }
.entry-meta em { font-style: italic; color: var(--ink-2); }
.entry-summary { grid-column: 1 / -1; font-size: .93rem; max-width: 78ch; }
.entry-summary .label { color: var(--muted); font-size: .82rem; margin-right: 4px; }
.entry-side { text-align: right; font-size: .85rem; color: var(--muted); grid-row: span 2; }
.entry-side b { display: block; font-family: var(--font-head); font-size: 1.3rem; color: var(--ink); }
.entry-actions { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; margin-left: -8px; }
.tag { font-size: .78rem; border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; color: var(--ink-2); white-space: nowrap; }
.tag-tier { border-color: var(--ink-2); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .82rem; background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td.when { white-space: nowrap; }
.closed { color: var(--muted); text-decoration: line-through; }
.countdown { display: block; font-size: .8rem; color: var(--muted); }

/* Programme / funding rows */
.row-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.row-item h3 a { color: var(--ink); text-decoration: none; }
.row-item h3 a:hover { color: var(--link); text-decoration: underline; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 500; }

/* News */
.news-item { display: grid; grid-template-columns: 1fr 96px; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.news-item img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-s); background: var(--rule-soft); }
.news-item h3 a { color: var(--ink); text-decoration: none; }
.news-item h3 a:hover { text-decoration: underline; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { font: inherit; font-size: .9rem; border: 0; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Rankings */
.rank-table td:first-child { font-weight: 500; }
.rank-val { display: block; }
.rank-src { font-size: .78rem; }
.na { color: var(--muted); font-style: italic; }

/* Interest strength bars */
.strength { display: grid; gap: 12px; }
.strength-row { display: grid; grid-template-columns: 160px 1fr 44px; gap: 12px; align-items: center; font-size: .92rem; }
.bar { height: 8px; background: var(--rule-soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 999px; }
.interest-edit { display: grid; grid-template-columns: 1fr 120px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.interest-edit input[type=range] { padding: 0; border: 0; background: none; }

/* Graph */
#graph { width: 100%; height: 560px; display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); touch-action: none; }
.graph-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.graph-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Copilot */
.copilot { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.mode-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mode-pick input { position: absolute; opacity: 0; width: 1px; }
.mode-pick label { display: inline-block; cursor: pointer; font-size: .9rem; color: var(--ink); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 12px; }
.mode-pick input:checked + label { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mode-pick input:focus-visible + label { outline: 2px solid var(--link); outline-offset: 2px; }
.answer { font-size: .97rem; line-height: 1.65; }
.answer h2 { font-size: 1.15rem; margin: 1.2em 0 .4em; }
.answer h2:first-child { margin-top: 0; }
.answer ul, .answer ol { padding-left: 1.3em; }
.answer li { margin-bottom: .3em; }
.answer blockquote { margin: 1em 0; padding: 6px 12px; border-left: 3px solid var(--mark); color: var(--muted); }
.answer sup a { text-decoration: none; font-size: .78em; padding: 0 1px; }
.sources ol { padding-left: 1.3em; font-size: .88rem; }
.sources li { margin-bottom: 6px; }
.history-item { display: block; width: 100%; text-align: left; font: inherit; border: 0; border-bottom: 1px solid var(--rule-soft); background: none; padding: 10px 0; cursor: pointer; color: var(--ink); }
.history-item small { display: block; color: var(--muted); }

/* Roadmap */
.roadmap { list-style: none; margin: 0; padding: 0; position: relative; }
.roadmap::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--rule); }
.step { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; }
.step button.tick {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink-2); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; z-index: 1; padding: 0; color: var(--paper);
}
.step.done button.tick { background: var(--ok); border-color: var(--ok); }
.step.done .step-title { color: var(--muted); }
.step.next .step-title { font-weight: 600; }
.step.next .step-title span { background: linear-gradient(transparent 40%, var(--mark-soft) 40%); }
.step-tools { display: flex; gap: 2px; }
.progress-line { font-size: .92rem; color: var(--muted); margin-bottom: 12px; }
.suggestion { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }

/* Saved */
.status-select { width: auto; padding: 4px 8px; font-size: .85rem; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--radius-s); font-size: .9rem; box-shadow: var(--shadow); z-index: 50;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--nav-bg); color: #e6eaf2; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h1 { font-size: 2.6rem; max-width: 14ch; color: #fff; }
.auth-art p { max-width: 44ch; color: #c9d3e6; font-size: 1.05rem; }
.auth-art .ref { font-size: .88rem; color: #9aa7c2; border-left: 3px solid #ffe066; padding-left: 12px; max-width: 46ch; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form form { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.alert { padding: 10px 12px; border-radius: var(--radius-s); background: rgba(180, 65, 60, .1); color: var(--danger); font-size: .9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-3, .copilot { grid-template-columns: 1fr; }
  .briefing { grid-template-columns: repeat(2, 1fr); }
  .briefing a:nth-child(2) { border-right: 0; }
  .briefing a:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .topbar .who > .muted { display: none; }
  .badge-demo { white-space: nowrap; font-size: .72rem; padding: 2px 8px; }
  .content { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters > label { flex-basis: 40%; }
  .filters > label:first-child { flex-basis: 100%; }
  .filters .btn { flex: 1 1 100%; justify-content: center; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 24px; gap: 20px; }
  .auth-art h1 { font-size: 1.9rem; }
  .entry { grid-template-columns: 1fr; }
  .entry-side { text-align: left; grid-row: auto; }
  .entry-side b { display: inline; font-size: 1rem; margin-right: 4px; }
  .strength-row { grid-template-columns: 110px 1fr 40px; }
  h1 { font-size: 1.5rem; }
  #graph { height: 420px; }
}
@media (max-width: 480px) {
  .briefing { grid-template-columns: 1fr 1fr; }
  .briefing strong { font-size: 1.3rem; }
  .news-item { grid-template-columns: 1fr; }
  .news-item img { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Prevent long titles from forcing horizontal scroll on narrow screens */
.grid-2 > *, .grid-3 > *, .copilot > * { min-width: 0; }
.entry-title, .entry-meta, .row-item h3, .news-item h3 { overflow-wrap: anywhere; }

/* ======================================================================
   Admin panel — same ink/paper language; the highlighter stays reserved
   for things worth noticing (rising searches, pending work).
   ====================================================================== */
.nav-count { margin-left: auto; background: var(--mark); color: #1b2a4a; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 1.5; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { margin: 0 0 4px !important; font-size: .85rem; }
.crumb a { text-decoration: none; }
.crumb a::before { content: "← "; }
.block { display: block; }
.strong { font-weight: 600; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.section-title { margin: 28px 0 12px; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }

/* State chips in page heads */
.state { font-size: .85rem; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; background: var(--surface); }
.state b { font-weight: 600; }
.state-open b { color: var(--ok); }
.state-approval b { color: var(--ink); background: var(--mark-soft); padding: 0 4px; border-radius: 2px; }
.state-closed b { color: var(--danger); }

/* KPI row (sentences, like the dashboard briefing) */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); overflow: hidden; margin-bottom: 18px; }
.kpis a { padding: 16px 18px; text-decoration: none; color: var(--ink); border-right: 1px solid var(--rule); display: grid; gap: 2px; align-content: start; }
.kpis a:last-child { border-right: 0; }
.kpis a:hover { background: var(--rule-soft); }
.kpis strong { font-family: var(--font-head); font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpis span { color: var(--ink-2); font-size: .9rem; }
.kpis small { color: var(--muted); font-size: .8rem; }
.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); margin-bottom: 18px; }
.stat-row > div { padding: 14px 16px; border-right: 1px solid var(--rule); display: grid; gap: 1px; align-content: start; }
.stat-row > div:last-child { border-right: 0; }
.stat-row strong { font-family: var(--font-head); font-size: 1.35rem; }
.stat-row span { font-size: .85rem; color: var(--ink-2); }
.stat-row small { font-size: .78rem; color: var(--muted); }

/* Pills */
.pill { display: inline-block; font-family: var(--font-body); font-size: .74rem; font-weight: 500; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
.pill-active { color: var(--ok); border-color: currentColor; }
.pill-pending { background: var(--mark-soft); border-color: transparent; color: var(--ink); }
.pill-suspended { color: var(--danger); border-color: currentColor; }
.pill-admin { background: var(--ink); color: var(--paper); border-color: var(--ink); }
h1 .pill { font-size: .8rem; position: relative; top: -3px; }

.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }

/* Flash */
.flash { border: 1px solid var(--rule); border-left: 4px solid var(--ok); background: var(--surface); padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 18px; }
.flash p { margin: 0; }
.flash-error { border-left-color: var(--danger); }
.flash-error p { color: var(--danger); }
.secret { display: flex; gap: 10px; align-items: center; margin: 10px 0 6px; flex-wrap: wrap; }
.secret code { font-size: 1.15rem; letter-spacing: .04em; background: var(--mark-soft); padding: 6px 10px; border-radius: var(--radius-s); user-select: all; }
.notice { padding: 10px 12px; border-radius: var(--radius-s); background: var(--mark-soft); color: var(--ink); font-size: .9rem; }

/* Tables inside panels */
.table-wrap.flat { border: 0; border-radius: 0; margin: 0 -20px; }
.table-wrap.flat th:first-child, .table-wrap.flat td:first-child { padding-left: 20px; }
.table-wrap.flat th:last-child, .table-wrap.flat td:last-child { padding-right: 20px; }
.users-table td { vertical-align: middle; }
.audit-table td.details { font-size: .85rem; max-width: 420px; overflow-wrap: anywhere; }
.audit-table td.details b { font-weight: 500; color: var(--muted); }
.act { font-weight: 500; white-space: nowrap; }
.act.warn { color: var(--danger); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* Charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--rule-soft); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font-body); }
.chart .hit { fill: transparent; }
.chart g:hover .hit { fill: var(--rule-soft); fill-opacity: .5; }
.c-user, .sw-user { fill: var(--ink-2); background: var(--ink-2); }
.c-auto, .sw-auto { fill: var(--rule); background: var(--rule); }
.c-signup, .sw-signup { fill: var(--link); background: var(--link); }
.c-api, .sw-api { fill: var(--muted); background: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.grid-2.tight { gap: 24px; }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; align-items: baseline; font-size: .9rem; }
.hbar-label { overflow-wrap: anywhere; }
.hbar b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar .bar { grid-column: 1 / -1; grid-row: 2; height: 6px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 90px; align-items: end; }
.hours span { height: 100%; display: flex; align-items: flex-end; background: var(--rule-soft); border-radius: 2px; }
.hours i { display: block; width: 100%; background: var(--ink-2); border-radius: 2px; min-height: 1px; }
.hours-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* Lists */
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list small { display: block; }
.saved-top { margin: 0; padding-left: 1.3em; font-size: .9rem; }
.saved-top li { margin-bottom: 8px; }
.saved-top small { display: block; }

/* Forms */
.stack { display: grid; gap: 14px; }
.narrow { max-width: 560px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid .span-2 { grid-column: 1 / -1; }
label small { font-size: .78rem; color: var(--muted); font-weight: 400; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--ink); }
label.check input { width: auto; margin-top: 4px; flex: none; }
label.check span { font-weight: 400; }
.filters label.check.inline { flex: 3 1 320px; align-self: center; font-size: .85rem; color: var(--muted); }
.row-actions { display: flex; gap: 8px; align-items: center; }
.radios { border: 0; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 12px; cursor: pointer; color: var(--ink); font-size: .92rem; }
.radio-card input { width: auto; margin-top: 3px; flex: none; }
.radio-card b { display: block; font-weight: 600; }
.radio-card small { color: var(--muted); font-size: .82rem; }
.radio-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.settings .panel + .panel { margin-top: 18px; }
.sticky-save { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--paper) 35%); display: flex; justify-content: flex-end; }
.task { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.task:last-child { border-bottom: 0; }
.task p { margin: 2px 0 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Account actions */
.actions-panel form { padding: 12px 0; border-bottom: 1px solid var(--rule-soft); display: grid; gap: 8px; justify-items: start; }
.actions-panel form:first-of-type { padding-top: 0; }
.actions-panel form label { width: 100%; }
.actions-panel form p { margin: 0; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); border-color: var(--danger); }
.danger-zone { padding-top: 12px; }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 500; font-size: .92rem; }
.danger-zone form { border: 1px solid var(--danger); border-radius: var(--radius-m); padding: 12px !important; margin-top: 10px; }

@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis a:nth-child(2) { border-right: 0; }
  .kpis a:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .stat-row > div { border-bottom: 1px solid var(--rule); }
  .radios, .form-grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .task { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .kpis a { border-right: 0; border-bottom: 1px solid var(--rule); }
}
.grid-2 > .panel + .panel, .grid-3 > .panel + .panel { margin-top: 0; }

/* Email code step */
.auth-form { align-content: center; }
.auth-form .otp-actions { width: 100%; max-width: 380px; display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.auth-form .otp-actions form { width: auto; display: block; }
.otp-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; padding: 10px; }

/* Notifications */
.compose .grid-3 { align-items: start; }
.compose-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin: 14px 0 18px; }
.audience .sub { display: grid; gap: 10px; margin: -4px 0 4px 26px; padding: 12px; border-left: 2px solid var(--rule); }
.audience .sub[hidden] { display: none; }
.radios.two { grid-template-columns: 1fr 1fr; margin: 0; }
.email-preview { border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; }
.email-subject { background: var(--paper); padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--rule); }
.email-body { padding: 14px; font-size: .95rem; }
.email-body p { overflow-wrap: anywhere; }
.preview { margin-top: 0; }
.stat-row.four { grid-template-columns: repeat(4, 1fr); }
.progress { height: 6px; background: var(--rule-soft); border-radius: 999px; overflow: hidden; margin: -8px 0 18px; }
.progress i { display: block; height: 100%; background: var(--ok); }
.pill-mail-sent { color: var(--ok); border-color: currentColor; }
.pill-mail-queued { background: var(--mark-soft); border-color: transparent; color: var(--ink); }
.pill-mail-failed { color: var(--danger); border-color: currentColor; }
.pill-mail-skipped { color: var(--muted); }
.plain-list.small li { display: grid; gap: 2px; justify-content: stretch; }
@media (max-width: 860px) { .radios.two, .stat-row.four { grid-template-columns: 1fr 1fr; } }

/* ======================================================================
   Master plan release (Nov 2026): rate-limit notices, feature nav,
   plan / feature pages, research tools
   ====================================================================== */

/* Rate limits: calm notice, not an error */
.results-limit {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius-m);
  border: 1px solid var(--rule); border-left: 4px solid var(--mark); background: var(--surface); color: var(--ink); margin-bottom: 12px;
}
.results-limit svg { flex: none; color: var(--muted); margin-top: 2px; }
.results-limit b { font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; }
.results-limit p { margin: 4px 0 0; max-width: 70ch; }
.results-notice {
  font-size: .9rem; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius-s);
  background: var(--mark-soft); color: var(--ink);
}

/* Sidebar: collapsible master-plan modules */
.nav-module summary {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer;
  color: var(--nav-text); font-size: .93rem; list-style: none;
}
.nav-module summary::-webkit-details-marker { display: none; }
.nav-module summary::after { content: "▸"; margin-left: auto; font-size: .7rem; opacity: .6; transition: transform .15s; }
.nav-module[open] summary::after { transform: rotate(90deg); }
.nav-module summary:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-module summary svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a.nav-feature { padding: 5px 10px 5px 38px; font-size: .84rem; justify-content: space-between; gap: 8px; }
.nav a.nav-feature span:first-child { line-height: 1.3; }
.nav a.nav-feature { align-items: flex-start; }
.nav a.nav-feature .nav-pill { margin-top: 2px; }
.count-tiles + p { margin-top: 8px; }
.nav-pill { flex: none; font-size: .64rem; letter-spacing: .02em; padding: 0 6px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22); color: var(--nav-text); opacity: .8; }
.nav-pill-live { border-color: var(--mark); color: var(--mark); opacity: 1; }
.nav-pill-part { border-style: dashed; }
.topbar-support { white-space: nowrap; }

/* Status pills */
.status-pill { display: inline-block; font-size: .76rem; font-weight: 500; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--rule); white-space: nowrap; vertical-align: middle; }
.status-pill.big { font-size: .9rem; padding: 4px 14px; }
.status-live { background: var(--ok); border-color: var(--ok); color: #fff; }
.status-partial { border-color: var(--ok); color: var(--ok); }
.status-soon { background: var(--mark-soft); border-color: transparent; color: var(--ink); }

/* Plan page */
.plan-counts a { cursor: pointer; }
.principles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.principles p { margin: 4px 0 0; }
.plan-module + .plan-module, .plan-module + .panel { margin-top: 18px; }
.plan-module td:first-child { min-width: 260px; }
.phases h3 { font-size: 1rem; margin-bottom: 8px; }
.phase-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-size: .92rem; }
.phase-list span { display: block; }
.plain-bullets { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.crumbs { margin: 0 0 6px; color: var(--muted); }
.soon-panel { border-left: 4px solid var(--mark); }
.today { border-left: 4px solid var(--ok); }
.related li { font-size: .9rem; padding: 7px 0; }
.row-actions.wrap { flex-wrap: wrap; }
.export-actions .btn { padding: 6px 12px; }
.scan-panel { margin-bottom: 18px; }

/* Research tools */
.source-credits { margin-top: 18px; }
.work { margin-top: 0; }
.work-kicker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag-verified { border-color: var(--ok); color: var(--ok); }
.work-title { font-size: 1.45rem; line-height: 1.25; margin-bottom: 6px; }
.work-title small { display: block; font-size: 1rem; color: var(--muted); font-weight: 500; margin-top: 4px; }
.work-h { font-size: .95rem; margin: 18px 0 8px; color: var(--ink-2); }
.work-actions { margin: 12px 0 4px; gap: 12px; }
.tldr { margin-top: 12px; padding: 10px 12px; background: var(--paper); border-radius: var(--radius-s); }
.count-tiles { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; }
.count-tiles > div { padding: 12px 14px; border-right: 1px solid var(--rule); display: grid; gap: 1px; }
.count-tiles > div:last-child { border-right: 0; }
.count-tiles strong { font-family: var(--font-head); font-size: 1.4rem; font-weight: 600; }
.count-tiles span { font-size: .88rem; }
.count-tiles small { font-size: .76rem; color: var(--muted); }
.authors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 18px; font-size: .92rem; }
.authors .aff { display: block; font-size: .8rem; color: var(--muted); }
.orcid { font-size: .7rem; font-weight: 600; text-decoration: none; background: #a6ce39; color: #fff; border-radius: 50%; padding: 1px 4px; vertical-align: 1px; }
.abstract { margin-top: 14px; }
.abstract summary { cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--ink-2); }
.abstract p { max-width: 80ch; font-size: .93rem; }
.banner { padding: 12px 16px; border-radius: var(--radius-m); margin-bottom: 14px; border: 1px solid; }
.banner ul { margin: 6px 0 0; padding-left: 1.2em; font-size: .9rem; }
.banner-danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--ink); }
.banner-danger b { color: var(--danger); }
.banner-warn { border-color: var(--mark); background: var(--mark-soft); }
.candidates { list-style: none; margin: 0; padding: 0; }
.candidates li { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.candidates li > div:first-child { display: grid; gap: 2px; }
.pill-ok { color: var(--ok); border-color: currentColor; }
.pill-mid { background: var(--mark-soft); border-color: transparent; color: var(--ink); }
.pill-low { color: var(--muted); }
.pill-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.signals li { padding-left: 26px; position: relative; font-size: .93rem; }
.signals li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.signals .sig-ok::before { content: "✓"; color: var(--ok); }
.signals .sig-check::before { content: "!"; color: var(--ink); background: var(--mark-soft); border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; font-size: .78rem; }
.ref-summary { margin-bottom: 12px; font-size: .95rem; }
.ref-summary .danger b { color: var(--danger); }
.ref-input { max-width: 340px; font-size: .84rem; color: var(--muted); }
tr.row-danger td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.soon-strip { margin-top: 18px; }

@media (max-width: 1024px) {
  .principles { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .count-tiles { grid-template-columns: 1fr; }
  .count-tiles > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .topbar-support { display: none; }
  .principles { grid-template-columns: 1fr; }
}

/* ======================================================================
   Legal pages, free / no-warranty notices, footer, feedback dialog
   ====================================================================== */
.free-badge { font-size: .74rem; padding: 2px 10px; border-radius: 999px; background: var(--mark-soft); color: var(--ink); white-space: nowrap; }
.free-line { margin-top: 6px !important; }
.sidebar-legal { color: var(--nav-text); opacity: .65; font-size: .74rem; line-height: 1.4; margin-top: 4px; }
.app-foot { border-top: 1px solid var(--rule); padding: 18px 32px 28px; font-size: .82rem; color: var(--muted); max-width: 1180px; }
.app-foot p { margin: 0 0 4px; max-width: none; }
.app-foot-links { margin-left: 6px; white-space: nowrap; }
.auth-form .app-foot { border-top: 0; padding: 18px 0 0; max-width: 380px; text-align: center; }
.auth-form .app-foot-links { display: block; margin: 4px 0 0; }
.auth-free { font-size: .88rem !important; color: #c9d3e6; margin-top: 12px; }
.agree { margin: 0; }
.linklike { font: inherit; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

dialog.feedback { border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.feedback::backdrop { background: rgba(15, 22, 38, .45); }
dialog.feedback form { display: grid; gap: 12px; padding: 20px; }
dialog.feedback .panel-head { margin-bottom: 0; }

/* Public legal pages (static HTML in /public/legal) */
.legal-page { background: var(--paper); }
.legal-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 32px; background: var(--nav-bg); }
.legal-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--font-head); font-size: 1.25rem; }
.legal-top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.legal-top nav a { color: var(--nav-text); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .9rem; }
.legal-top nav a[aria-current="page"], .legal-top nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.legal { max-width: 780px; margin: 0 auto; padding: 36px 24px 24px; line-height: 1.65; }
.legal h1 { font-size: 2.2rem; margin-bottom: 8px; }
.legal h2 { font-size: 1.2rem; margin: 30px 0 8px; }
.legal ul { padding-left: 1.3em; }
.legal li { margin-bottom: 6px; }
.legal-kicker { color: var(--muted); font-size: .85rem; margin: 0 0 6px; }
.legal-intro { font-size: 1.08rem; color: var(--muted); }
.free-note { border-left: 4px solid var(--mark); background: var(--surface); padding: 12px 16px; border-radius: var(--radius-s); margin: 18px 0 8px; }
.legal-contact { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule); }
.legal-foot { max-width: 780px; margin: 0 auto; padding: 0 24px 40px; font-size: .85rem; color: var(--muted); }
.legal-foot p { margin: 0 0 4px; }
@media (max-width: 720px) { .free-badge { display: none; } .app-foot { padding: 16px 18px 24px; } }

/* =====================================================================
   v5 release (17 Nov 2026): Master Plan v11 Phases 0–2
   ===================================================================== */
.field-tip { font-size: .8rem; color: var(--muted); margin: -6px 0 4px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 0 1 220px; }
.help-link { font-weight: 600; min-width: 34px; justify-content: center; border: 1px solid var(--rule); border-radius: 999px; }
.help-q { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--rule); font-size: .72rem; font-weight: 600; text-decoration: none; }
.row-unread td { background: var(--mark-soft); }
.row-current td { font-weight: 500; }
.codes { columns: 2; font-size: 1.05rem; padding-left: 1.4em; }
.codes code { letter-spacing: .05em; background: var(--mark-soft); padding: 1px 6px; border-radius: var(--radius-s); }
.steps-list { padding-left: 1.3em; display: grid; gap: 8px; }
.recovery { border: 2px solid var(--mark); }

/* Public layout (help and security for signed-out visitors) */
.public-page { background: var(--paper); }
.public-main { max-width: 1180px; margin: 0 auto; padding: 24px; }

/* Help manual (wiki) */
.help-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding-right: 6px; }
.help-side nav ul { list-style: none; margin: 4px 0 10px; padding: 0 0 0 10px; border-left: 1px solid var(--rule); }
.help-side nav li { margin: 3px 0; font-size: .88rem; }
.help-side nav a { text-decoration: none; color: var(--ink-2); }
.help-side nav a[aria-current="page"] { color: var(--link); font-weight: 600; }
.help-sec summary { cursor: pointer; font-weight: 600; font-size: .9rem; padding: 4px 0; }
.help-sec summary a { color: var(--ink); text-decoration: none; }
.help-search input { width: 100%; margin-bottom: 10px; }
.help-main { min-width: 0; }
.help-main h1 { font-size: 1.9rem; margin: 6px 0; }
.help-summary { font-size: 1.05rem; color: var(--ink-2); margin: 4px 0; }
.help-meta { margin: 0 0 14px; }
.help-toc { float: right; width: 240px; margin: 0 0 12px 18px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); font-size: .86rem; }
.help-toc ol { margin: 6px 0 0; padding-left: 1.1em; }
.help-toc .toc-3 { margin-left: 12px; list-style: circle; }
.help-body { line-height: 1.7; }
.help-body h2 { font-size: 1.35rem; margin: 26px 0 8px; }
.help-body h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.help-body .anchor { opacity: 0; text-decoration: none; font-size: .8em; margin-left: 4px; }
.help-body h2:hover .anchor, .help-body h3:hover .anchor { opacity: .6; }
.help-body pre { background: var(--rule-soft); padding: 10px 12px; border-radius: var(--radius-s); overflow: auto; }
.help-body blockquote { margin: 14px 0; padding: 8px 14px; border-left: 4px solid var(--rule); background: var(--surface); }
.help-body .callout-note, .help-body .callout-tip { border-left-color: var(--link); }
.help-body .callout-important, .help-body .callout-warning { border-left-color: var(--mark); background: var(--mark-soft); }
.help-body img { max-width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-s); }
.help-body table { margin: 8px 0; }
.help-body .ext::after { content: " ↗"; font-size: .8em; }
.help-body .redlink { color: var(--danger); }
.help-body .missing-link { border-bottom: 1px dotted var(--muted); }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.help-card { text-decoration: none; color: var(--ink); display: block; }
.help-card h2 { font-size: 1.05rem; margin-bottom: 4px; }
.help-card:hover { border-color: var(--link); }
.help-hero input { min-width: 320px; }
.help-feedback { margin-top: 28px; clear: both; }
.help-feedback .grow { flex: 1 1 240px; }
.help-rel { margin-top: 24px; clear: both; }
.help-results li { margin-bottom: 12px; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.link-list li { display: grid; gap: 2px; }
.label-like { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.editor-panes textarea { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .88rem; min-height: 480px; }
.editor-panes .help-body { min-height: 480px; max-height: 70vh; overflow: auto; }
.diff { font-size: .84rem; line-height: 1.45; white-space: pre-wrap; }
.diff span { display: block; }
.diff-add { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.diff-del { background: color-mix(in srgb, var(--danger) 15%, transparent); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.diff-gap { color: var(--muted); }
.crumb { font-size: .85rem; color: var(--muted); }
@media (max-width: 860px) {
  .help-shell { grid-template-columns: 1fr; }
  .help-side { position: static; max-height: none; }
  .help-toc { float: none; width: auto; margin: 0 0 12px; }
}
@media print {
  .sidebar, .topbar, .app-foot, .no-print, .help-side, .help-feedback { display: none !important; }
  .print-article { break-inside: avoid-page; }
}

/* Unified search (Phase 2) */
.search-form .grow { flex: 4 1 320px; }
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.search-entry .entry-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.src-badge { font-size: .7rem; font-weight: 600; letter-spacing: .02em; padding: 1px 7px; border-radius: 4px; background: var(--rule-soft); color: var(--ink-2); }
.src-openalex { background: color-mix(in srgb, #e86f2c 18%, var(--surface)); }
.src-crossref { background: color-mix(in srgb, #3eb1c8 18%, var(--surface)); }
.src-europepmc, .src-pubmed { background: color-mix(in srgb, #4a9b5a 18%, var(--surface)); }
.src-arxiv { background: color-mix(in srgb, #b31b1b 15%, var(--surface)); }
.src-dblp { background: color-mix(in srgb, #004f9f 15%, var(--surface)); }
.src-scholar { background: color-mix(in srgb, #4285f4 15%, var(--surface)); }
.tag-oa { border-color: var(--ok); color: var(--ok); text-decoration: none; }
.tag-unverified { border-color: var(--danger); color: var(--danger); }
.source-report { margin-top: 12px; line-height: 1.8; }
.source-report em { color: var(--danger); font-style: normal; }
.books-panel { position: sticky; top: 12px; }
.powered-google { font-size: .72rem; color: var(--muted); border: 1px solid var(--rule); padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.book-list { display: grid; gap: 12px; }
.book-item { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: start; }
.book-item h3 { font-size: .95rem; margin: 0 0 2px; font-family: var(--font-body); font-weight: 600; }
.cover { width: 54px; height: 78px; object-fit: cover; border-radius: 3px; border: 1px solid var(--rule); background: var(--rule-soft); }
.cover-placeholder { font-size: .62rem; color: var(--muted); cursor: pointer; padding: 2px; }
.cover-none { display: block; }
.book-head { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.book-page .cover { width: 110px; height: 160px; }
.prov { font-family: var(--font-body); font-size: .7rem; font-weight: 500; color: var(--muted); border: 1px solid var(--rule); border-radius: 4px; padding: 0 6px; margin-left: 6px; vertical-align: middle; }
.provenance { margin-top: 14px; font-size: .88rem; }
.provenance summary { cursor: pointer; color: var(--muted); }
.ror { font-size: .68rem; font-weight: 600; text-decoration: none; border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; }
.report-error { margin-top: 10px; }
.sources-table input[type=number] { padding: 4px 6px; }
.sources-table textarea { width: 100%; min-width: 260px; font-size: .8rem; }
@media (max-width: 980px) { .search-layout { grid-template-columns: 1fr; } .books-panel { position: static; } }

/* Release identity (0.5.0-beta) */
.auth-brand-row { display: flex; align-items: center; gap: 12px; }
.release-badge { display: inline-flex; align-items: center; gap: 5px; font: 500 .74rem/1 var(--font-body); padding: 4px 9px; border-radius: 999px;
  background: var(--mark); color: #1b2a4a; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.release-badge b { font-weight: 700; letter-spacing: .08em; }
.release-badge-inline { font-size: .62em; margin-left: 6px; }
.auth-art p.auth-release, .auth-release { font-size: .8rem; line-height: 1.5; opacity: .8; margin-top: 10px; }
.release-line { margin: -6px 0 6px; }
.sidebar-legal .release-badge { margin-bottom: 4px; }
