/* ============================================================
   ISJournal — design tokens
   ============================================================ */
:root {
  --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;

  /* spacing scale */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* light theme */
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-sunken: #eef0f3;
  --text: #1a1d21;
  --text-soft: #5b6470;
  --text-faint: #8b95a1;
  --border: #e3e7ec;
  --border-strong: #cfd6de;
  --accent: #3b5bdb;
  --accent-soft: #e7ecfb;
  --accent-text: #2f49b0;
  --star: #f2b418;
  --of: #0ca678;        /* online-first */
  --of-soft: #d8f5ec;
  --warn: #e8590c;
  --shadow-sm: 0 1px 2px rgba(20, 28, 40, .06), 0 1px 3px rgba(20, 28, 40, .04);
  --shadow-md: 0 4px 16px rgba(20, 28, 40, .10);
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --bg-elev: #181c22;
  --bg-sunken: #12161b;
  --text: #e8ecf1;
  --text-soft: #a3adba;
  --text-faint: #6b7682;
  --border: #262c34;
  --border-strong: #333b45;
  --accent: #6f8cff;
  --accent-soft: #1d2740;
  --accent-text: #aab9ff;
  --star: #ffce4a;
  --of: #2bd4a4;
  --of-soft: #11332a;
  --warn: #ff9152;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f1216; --bg-elev: #181c22; --bg-sunken: #12161b;
    --text: #e8ecf1; --text-soft: #a3adba; --text-faint: #6b7682;
    --border: #262c34; --border-strong: #333b45;
    --accent: #6f8cff; --accent-soft: #1d2740; --accent-text: #aab9ff;
    --star: #ffce4a; --of: #2bd4a4; --of-soft: #11332a; --warn: #ff9152;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 6px 24px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* beat class rules like .note-area{display:flex} */
html, body { margin: 0; padding: 0; }

/* Password gate */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #2a3550, #0f1216);
}
.gate-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: #181c22; border: 1px solid #262c34; border-radius: 16px;
  padding: 40px 36px; width: min(360px, 92vw);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5); color: #e8ecf1;
  font-family: var(--font-sans);
}
.gate-mark {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px;
  background: linear-gradient(135deg, #3b5bdb, #7048e8); color: #fff;
  font-weight: 800; font-size: 20px; letter-spacing: .5px;
}
.gate-box h1 { margin: 4px 0 0; font-size: 22px; }
.gate-sub { margin: 0; font-size: 13px; color: #a3adba; text-align: center; }
.gate-box input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #333b45; background: #12161b; color: #e8ecf1; outline: none;
}
.gate-box input:focus { border-color: #6f8cff; box-shadow: 0 0 0 3px rgba(111, 140, 255, .25); }
.gate-box button {
  width: 100%; padding: 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: #3b5bdb; color: #fff; font-weight: 600; font-size: 15px; transition: .15s;
}
.gate-box button:hover { background: #2f49b0; }
.gate-err { margin: 0; font-size: 13px; color: #ff7a7a; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent-text); }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s3) var(--s5);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--s3); }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #7048e8);
  color: #fff; font-weight: 800; letter-spacing: .5px;
  box-shadow: var(--shadow-sm);
}
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: .3px; }
.tagline { margin: 0; font-size: 12px; color: var(--text-faint); }

.search-wrap { position: relative; flex: 1; max-width: 620px; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: none; stroke: var(--text-faint);
  stroke-width: 2; stroke-linecap: round;
}
#search {
  width: 100%; padding: 11px 14px 11px 42px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-pill); outline: none; transition: .15s;
}
#search:focus { border-color: var(--accent); background: var(--bg-elev);
  box-shadow: 0 0 0 3px var(--accent-soft); }

.topbar-actions { display: flex; align-items: center; gap: var(--s3); }
.seg { display: inline-flex; background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius-pill);
  color: var(--text-soft); font-size: 13px; transition: .15s;
}
.seg button.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-sunken);
  cursor: pointer; font-size: 18px; line-height: 1; transition: .15s;
}
.icon-btn:hover { border-color: var(--border-strong); }

/* Role indicator / switch button (only shown on the encrypted/gated site) */
.role-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-sunken);
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-soft);
  transition: .15s; white-space: nowrap;
}
.role-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.role-btn.is-admin { color: var(--accent-text); border-color: var(--accent-soft); background: var(--accent-soft); }

/* ============================================================
   Layout
   ============================================================ */
.layout {
  display: grid; grid-template-columns: 272px 1fr;
  gap: var(--s5); max-width: 1320px; margin: 0 auto;
  padding: var(--s5); align-items: start;
}
.sidebar {
  position: sticky; top: 76px;
  display: flex; flex-direction: column; gap: var(--s4);
  max-height: calc(100vh - 92px); overflow-y: auto;
  padding-right: var(--s2);
}

.save-status {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 12px; color: var(--text-soft);
  padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
  background: var(--bg-elev); border: 1px solid var(--border);
}
.save-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.save-status[data-mode="server"] .dot { background: var(--of); }
.save-status[data-mode="local"]  .dot { background: var(--warn); }
.save-status[data-mode="saving"] .dot { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.quick-filter {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev);
  cursor: pointer; transition: .15s; font-size: 14px;
}
.quick-filter:hover { border-color: var(--border-strong); }
.quick-filter.active { background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent-text); font-weight: 600; }
.quick-filter .count {
  font-size: 12px; padding: 1px 8px; border-radius: var(--radius-pill);
  background: var(--bg-sunken); color: var(--text-soft);
}

.facet h3 {
  margin: 0 0 var(--s2); font-size: 12px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-faint);
}
/* Folders (user collections) and Tags (data attributes) are grouped sections of
   quick-filters — give their stacked buttons consistent spacing. */
.facet.group-folders, .facet.group-tags { display: flex; flex-direction: column; gap: 6px; }
.facet.group-folders > h3, .facet.group-tags > h3 { margin-bottom: 2px; }
.facet.group-tags .facet-options { margin-top: 4px; }
#scroll-sentinel { height: 1px; }
.facet-options { display: flex; flex-direction: column; gap: 2px; }
.facet-options.scroll { max-height: 260px; overflow-y: auto; }
.opt {
  display: flex; align-items: center; gap: var(--s2);
  padding: 5px var(--s2); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13.5px; transition: .12s;
}
.opt:hover { background: var(--bg-sunken); }
.opt input { accent-color: var(--accent); margin: 0; }
.opt .opt-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .opt-count { font-size: 11.5px; color: var(--text-faint); }
.opt.checked { color: var(--accent-text); font-weight: 600; }

.clear-btn, .export-btn {
  padding: 9px var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev);
  cursor: pointer; font-size: 13px; transition: .15s;
}
.clear-btn:hover, .export-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.sidebar-foot { border-top: 1px dashed var(--border); padding-top: var(--s3); }
.export-btn { width: 100%; }
.hint { font-size: 11.5px; color: var(--text-faint); margin: var(--s2) 0 0; }

/* ============================================================
   Results + cards
   ============================================================ */
.results-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s3);
}
#result-count { font-size: 14px; color: var(--text-soft); }
#result-count b { color: var(--text); }
.results-tools { display: flex; align-items: center; gap: var(--s4); }
.bib-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer;
  font-size: 13px; color: var(--text-soft); transition: .15s;
}
.bib-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.sort-wrap { display: flex; align-items: center; gap: var(--s2); font-size: 13px; color: var(--text-soft); }
#sort { padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer; }

.active-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 12.5px; cursor: pointer; border: 1px solid transparent;
}
.chip:hover { border-color: var(--accent); }
.chip::after { content: "✕"; font-size: 10px; opacity: .7; }

.cards { display: flex; flex-direction: column; gap: var(--s4); }
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s;
  /* Skip layout/paint for off-screen cards so expanding one abstract only
     reflows the few visible cards, not all ~2000. Huge perf win on long lists. */
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card.is-fav { border-left: 3px solid var(--star); }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11.5px; padding: 2px 9px; border-radius: var(--radius-pill);
  background: var(--bg-sunken); color: var(--text-soft); white-space: nowrap;
}
.journal-badge { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.of-badge { background: var(--of-soft); color: var(--of); font-weight: 600; }
.pdf-badge { background: #e8f3ff; color: #1769aa; font-weight: 600; }
:root[data-theme="dark"] .pdf-badge { background: #142a3d; color: #79bfff; }
.tr-badge { background: transparent; color: var(--text-faint); border: 1px dashed var(--border-strong); }
.list-badge { background: var(--bg-sunken); color: var(--text-soft); cursor: pointer; font-weight: 600; }
.list-badge:hover { color: var(--accent-text); }

/* Phase 2 — add-by-DOI: topbar button, contributed badges, add modal */
.addpaper-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: .15s;
}
.addpaper-btn:hover { background: var(--accent-text); border-color: var(--accent-text); }
.contrib-badge { background: #7048e8; color: #fff; font-weight: 600; }
.contrib-del { background: var(--warn); color: #fff; cursor: pointer; font-weight: 600; }
.gate-cancel { background: transparent !important; color: var(--text-soft) !important; border: 1px solid var(--border) !important; }
.gate-cancel:hover { color: var(--text) !important; }
.gate-msg { margin: 0; font-size: 13px; color: var(--text-soft); text-align: center; min-height: 1em; }

.card-actions { display: flex; align-items: center; gap: var(--s3); flex-shrink: 0; }
.star {
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--border-strong); transition: .15s;
  padding: 0; flex-shrink: 0;
}
.star:hover { color: var(--star); transform: scale(1.1); }
.star.on { color: var(--star); }
.quick-filter#myfav-filter.active { background: rgba(245, 158, 11, .12);
  border-color: var(--star); color: var(--star); }

.hide-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--text-faint); transition: .15s;
  padding: 2px 4px; border-radius: var(--radius-sm);
}
.hide-btn:hover { color: var(--warn); background: var(--bg-sunken); }
.hide-btn.on { color: var(--warn); }   /* shown in the Hidden folder as a restore action */
.card.is-hidden { opacity: .72; border-left: 3px solid var(--warn); }
.quick-filter#hidden-filter.active { background: var(--of-soft); border-color: var(--warn);
  color: var(--warn); }

.watch-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--text-faint); transition: .15s;
  padding: 2px 4px; border-radius: var(--radius-sm);
}
.watch-btn:hover { color: #14b8a6; background: var(--bg-sunken); }
.watch-btn.on { color: #14b8a6; }
.watch-badge { background: rgba(20, 184, 166, .12); color: #14b8a6; }
.quick-filter#watch-filter.active { background: rgba(20, 184, 166, .12); border-color: #14b8a6; color: #14b8a6; }

/* The shared curation layer (公共收藏 / 不相关 / 待审建议 / 编辑 / 成员动态) is the
   admin's. "viewer" is the pre-multi-user role value — kept so a stale body
   dataset still hides admin UI rather than exposing it. */
body[data-role="member"] .admin-only,
body[data-role="viewer"] .admin-only { display: none !important; }

/* ---- ⭐ 公共收藏 + ⇧ 建议 (the group's shared shelf) ---- */
.pubstar {
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer;
  font-size: 12px; line-height: 1; color: var(--text-faint); transition: .15s;
  padding: 4px 9px; border-radius: var(--radius-pill); white-space: nowrap; flex-shrink: 0;
}
.pubstar:hover { border-color: var(--star); color: var(--star); }
.pubstar.on { color: var(--star); border-color: var(--star);
  background: rgba(245, 158, 11, .12); font-weight: 600; }
body[data-role="member"] .pubstar { cursor: default; }   /* members see it as a marker */
.card.is-pubfav { border-left: 3px solid var(--star); }
.quick-filter#pubfav-filter.active { background: rgba(245, 158, 11, .12);
  border-color: var(--star); color: var(--star); }

.suggest-btn {
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer;
  font-size: 12px; line-height: 1; color: var(--text-faint); transition: .15s;
  padding: 4px 9px; border-radius: var(--radius-pill); white-space: nowrap; flex-shrink: 0;
}
.suggest-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.suggest-btn.on { color: var(--accent-text); border-color: var(--accent);
  background: var(--accent-soft); font-weight: 600; }

/* admin: who suggested this, with inline 采纳 / 忽略 */
.suggest-badge-wrap { display: inline-flex; align-items: center; gap: 4px; }
.suggest-badge { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sug-act {
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer;
  font-size: 11px; line-height: 1; color: var(--text-soft); transition: .15s;
  padding: 3px 7px; border-radius: var(--radius-pill); white-space: nowrap;
}
.sug-act:hover { border-color: var(--accent); color: var(--accent-text); }
.quick-filter#suggest-filter.active { background: var(--accent-soft);
  border-color: var(--accent); color: var(--accent-text); }

/* ---- other members' notes (read-only, signed) ---- */
.group-notes { display: flex; flex-direction: column; gap: var(--s2);
  padding-top: var(--s2); border-top: 1px dashed var(--border); }
.gn-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
  font-size: 13px; color: var(--text-soft); line-height: 1.55; }
.gn-author { flex-shrink: 0; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--radius-pill);
  background: var(--bg-sunken); color: var(--text-soft); }
.gn-note { white-space: pre-wrap; }
.gn-tag { font-size: 11px; padding: 1px 6px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-text); }

/* ---- 成员动态 (admin) ---- */
.stats-box { max-width: 560px; width: 92vw; }
#stats-body { width: 100%; margin: var(--s3) 0; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table th, .stats-table td { padding: 6px 8px; text-align: left;
  border-bottom: 1px solid var(--border); }
.stats-table th { font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .04em; }
.stats-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tr.is-admin-row td { font-weight: 600; }
.stats-msg { margin: var(--s2) 0 0; font-size: 12px; color: var(--text-faint); text-align: center; }

/* ---- reading progress (已读/未读) ---- */
.read-btn {
  border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer;
  font-size: 12px; line-height: 1; color: var(--text-faint); transition: .15s;
  padding: 4px 9px; border-radius: var(--radius-pill); white-space: nowrap; flex-shrink: 0;
}
.read-btn:hover { border-color: var(--of); color: var(--of); }
.read-btn.on { color: var(--of); border-color: var(--of); background: var(--of-soft); font-weight: 600; }
.card.is-read { opacity: .58; }            /* read cards fade back so unread ones stand out */
.card.is-read:hover { opacity: 1; }
.quick-filter#unread-filter.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.quick-filter#read-filter.active { background: var(--of-soft); border-color: var(--of); color: var(--of); }
/* per-journal reading progress "已读/总数" in the journal facet */
.opt-count.progress { font-variant-numeric: tabular-nums; }
.opt-count.progress.done { color: var(--of); font-weight: 600; }
.opt-count.progress.none { color: var(--text-faint); }

/* ---- ✨ AI recommendations ---- */
.rec-quick { border-color: var(--accent); }
.quick-filter#rec-filter.active { background: var(--accent-soft); border-color: #7048e8; color: var(--accent-text); font-weight: 600; }
.rec-badge { background: linear-gradient(135deg, #7048e8, var(--accent)); color: #fff; font-weight: 600; cursor: pointer; }
.rec-reason {
  margin: var(--s2) 0 0; padding: 8px var(--s3); font-size: 13px; line-height: 1.5;
  color: var(--accent-text); background: var(--accent-soft);
  border-left: 3px solid #7048e8; border-radius: var(--radius-sm);
}
.continue-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  cursor: pointer; font-size: 13px; font-weight: 600; transition: .15s; white-space: nowrap;
}
.continue-btn:hover { background: var(--accent-text); border-color: var(--accent-text); }

.title-en { margin: var(--s3) 0 0; font-size: 17px; font-weight: 650;
  letter-spacing: .1px; line-height: 1.4; }
.title-zh { margin: var(--s1) 0 0; font-size: 15.5px; font-weight: 600;
  color: var(--accent-text); line-height: 1.5; }
.authors { margin: var(--s2) 0 0; font-size: 13px; color: var(--text-soft); }

.abstract { margin-top: var(--s3); }
.abs-en, .abs-zh { margin: 0; font-size: 14px; color: var(--text-soft); line-height: 1.65; }
.abs-zh { margin-top: var(--s2); color: var(--text); }
.abstract.clamp .abs-en, .abstract.clamp .abs-zh {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s3); }
.topic-tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: var(--radius-sm);
  background: var(--bg-sunken); color: var(--text-soft); cursor: pointer;
}
.topic-tag:hover { color: var(--accent-text); }

.card-foot { display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--s3); gap: var(--s3); }
.doi { font-size: 13px; text-decoration: none; word-break: break-all; }
.doi:hover { text-decoration: underline; }
.pdf-toggle, .pdf-close {
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-soft); font-size: 13px; white-space: nowrap;
}
.pdf-toggle:hover, .pdf-toggle.on, .pdf-close:hover { color: var(--accent-text); }
.pdf-toggle.on { font-weight: 600; }
.pdf-preview {
  margin-top: var(--s3); overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-sunken);
}
.pdf-preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 8px var(--s3); border-bottom: 1px solid var(--border);
  color: var(--text-soft); font-size: 12px; font-weight: 600;
}
.pdf-status { margin: 0; padding: var(--s5); text-align: center; color: var(--text-soft); }
.pdf-frame { display: block; width: 100%; height: min(72vh, 820px); border: 0; background: #fff; }
.note-toggle { border: 0; background: transparent; cursor: pointer;
  color: var(--text-soft); font-size: 13px; white-space: nowrap; }
.note-toggle:hover { color: var(--accent-text); }
.note-toggle.has-note { color: var(--accent-text); font-weight: 600; }

.note-area { margin-top: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.note-input, .tag-input {
  width: 100%; padding: 9px var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-sunken); outline: none; resize: vertical;
}
.note-input { min-height: 70px; }
.note-input:focus, .tag-input:focus { border-color: var(--accent); background: var(--bg-elev); }

/* Admin-only inline edit of title/abstract */
.foot-tools { display: flex; align-items: center; gap: var(--s3); flex-shrink: 0; }
.edit-btn { border: 0; background: transparent; cursor: pointer;
  color: var(--text-soft); font-size: 13px; white-space: nowrap; }
.edit-btn:hover { color: var(--accent-text); }
.edit-btn.on { color: var(--accent-text); font-weight: 600; }
.edit-area { margin-top: var(--s3); display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s3); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--bg-sunken); }
.edit-hint { font-size: 12px; color: var(--text-faint); margin: 0; }
.edit-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-soft); }
.edit-field input, .edit-field textarea {
  width: 100%; padding: 8px var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev); outline: none;
  resize: vertical; font-size: 13px; color: var(--text); font-family: inherit;
}
.edit-field textarea { min-height: 64px; }
.edit-field input:focus, .edit-field textarea:focus { border-color: var(--accent); }

.empty { text-align: center; padding: var(--s7); color: var(--text-faint); line-height: 2; }

/* hide language halves per mode */
body[data-lang="en"] .title-zh, body[data-lang="en"] .abs-zh { display: none; }
body[data-lang="zh"] .title-en, body[data-lang="zh"] .abs-en { display: none; }

/* responsive */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .search-wrap { max-width: none; }
  .brand-text { display: none; }
  .pdf-frame { height: 65vh; }
}
