/* 图书难借吗 · 纸面期刊风格看板 */
:root {
  --bg: #ece4d9;
  --surface: #f4f0ea;
  --card: #fffbf5;
  --ink: #4f483e;
  --ink-strong: #35302a;
  --muted: #8a7d6b;
  --faint: #b8ab97;
  --line: #d8cdbd;
  --accent: #f54001;
  --accent-tint: #ffc198;
  --ok: #5a7a3a;
  --ok-tint: #dde7cf;
  --warn: #b8860b;
  --warn-tint: #f0e3bd;
  --bad: #c7371f;
  --bad-tint: #f2d0c7;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  padding-bottom: 80px;
}

::selection { background: var(--accent-tint); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- 刊头 ---------- */
.masthead {
  border-bottom: 3px double var(--ink);
  padding: 28px 0 18px;
  margin-bottom: 8px;
}
.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 6px;
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(34px, 6vw, 58px);
  color: var(--ink-strong);
  letter-spacing: 0.04em;
  line-height: 1.15;
  margin: 14px 0 6px;
}
.masthead .subtitle {
  color: var(--muted);
  font-size: 14px;
}
.masthead .subtitle em { font-style: normal; color: var(--accent); }

/* ---------- 概览栏 ---------- */
.stats-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 24px 0 8px;
}
.stat-cell {
  background: var(--surface);
  padding: 16px 18px;
}
.stat-cell .num {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1.1;
}
.stat-cell .num small { font-size: 15px; color: var(--muted); font-family: var(--sans); }
.stat-cell .label { font-size: 12px; color: var(--muted); margin-top: 4px; letter-spacing: 0.05em; }

/* ---------- 浮动目录（TOC）：一级默认折叠，点击展开二级 ---------- */
/* PC：右侧悬浮面板，可用 » 收成竖排细条 */
.toc {
  position: fixed;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 184px;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(62, 48, 32, 0.14);
  padding: 10px 12px 12px;
  z-index: 60;
  font-size: 13px;
}
.toc-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.toc-title { font-family: var(--serif); font-weight: 700; color: var(--ink-strong); }
.toc-fold, .toc-close { background: none; border: none; cursor: pointer; color: var(--faint); padding: 0 4px; }
.toc-fold { margin-left: auto; font-size: 14px; }
.toc-close { display: none; } /* 仅移动端抽屉用 */
.toc.folded { width: auto; padding: 10px 7px; }
.toc.folded .toc-head { flex-direction: column; }
.toc.folded .toc-title { writing-mode: vertical-rl; letter-spacing: 0.2em; }
.toc.folded #toc-nav { display: none; }
.toc.folded .toc-fold { transform: rotate(180deg); margin: 6px 0 0; }
.toc-group { margin: 2px 0; }
.toc-l1, .toc-book { background: none; border: none; padding: 0; cursor: pointer; font: inherit; text-align: left; }
.toc-l1 { display: flex; align-items: baseline; gap: 6px; width: 100%; padding: 3px 0; font-weight: 600; color: var(--ink-strong); }
.toc-l1[data-group]::after { content: "▸"; margin-left: auto; color: var(--faint); font-size: 11px; }
.toc-group.open .toc-l1[data-group]::after { content: "▾"; }
.toc-count { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.toc-l2 { display: none; flex-direction: column; margin: 2px 0 4px 14px; }
.toc-group.open .toc-l2 { display: flex; }
.toc-book { color: var(--muted); padding: 2px 0; }
.toc-l1:hover, .toc-book:hover { color: var(--accent); }
.toc-fixed { border-top: 1px solid var(--surface); margin-top: 6px; padding-top: 6px; }
.toc-fab, .toc-mask { display: none; }

/* 移动端 / 窄屏：目录收进右下角悬浮按钮，点开为底部抽屉（带遮罩） */
@media (max-width: 1023px) {
  .toc {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    width: auto;
    max-height: 62vh;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
    padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
    display: none;
  }
  .toc.open { display: block; }
  .toc.folded { width: auto; padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); }
  .toc.folded .toc-head { flex-direction: row; }
  .toc.folded .toc-title { writing-mode: horizontal-tb; letter-spacing: normal; }
  .toc.folded #toc-nav { display: block; }
  .toc-fold { display: none; }
  .toc-close { display: block; margin-left: auto; font-size: 20px; color: var(--muted); }
  .toc-fab {
    display: block;
    position: fixed;
    right: 14px;
    bottom: 16px;
    z-index: 55;
    background: var(--ink-strong);
    color: var(--card);
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(62, 48, 32, 0.25);
  }
  .toc-mask { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.25); z-index: 58; }
}
/* hidden 守卫放在最后：优先级持平 .toc.open / .toc-fab，靠顺序压过它们 */
.toc[hidden], .toc-fab[hidden], .toc-mask[hidden] { display: none; }

/* ---------- 当前可借情况 ---------- */
.avail-board {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 14px 18px;
  margin: 0 0 8px;
}
.avail-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.avail-label {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.avail-label.ok { color: var(--ok); }
.avail-label.warn { color: var(--warn); }
.avail-label.muted { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.chip {
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 3px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: filter 0.15s;
}
.chip:hover { filter: brightness(0.95); }
.chip.ok { background: var(--ok-tint); color: var(--ok); border: 1px solid transparent; }
.chip.warn { background: var(--warn-tint); color: var(--warn); border: 1px solid transparent; }
.chip.muted { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.chips-empty { color: var(--faint); font-size: 12.5px; }
.avail-note { font-size: 12px; color: var(--faint); margin-top: 6px; }
.avail-note:empty { display: none; }

/* ---------- 区块标题 ---------- */
.section-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 40px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.section-title .en {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.section-note { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.section-note code { font-family: var(--mono); font-size: 12px; background: var(--surface); padding: 1px 6px; border: 1px solid var(--line); }

/* ---------- 筛选 pills ---------- */
.branch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 4px;
  font-size: 13px;
  color: var(--muted);
}
/* 筛选条分段：在馆状态 / 分组，段间竖线分隔 */
.filter-seg { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.filter-seg + .filter-seg { border-left: 1px solid var(--line); padding-left: 14px; margin-left: 6px; }
.filter-label { font-size: 12px; color: var(--faint); letter-spacing: 0.05em; }
.branch-pill {
  font-family: var(--mono);
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.branch-pill:hover { background: var(--surface); }
.branch-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.filter-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 36px 0; }

/* ---------- 书卡 ---------- */
.book-card {
  background: var(--card);
  margin: 18px 0;
  padding: 24px 26px;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 26px;
}
.score-col { border-right: 1px solid var(--line); padding-right: 22px; }
/* 易借指数：5 颗星 + 小字标签 + 计算说明气泡（桌面悬浮 / 触屏点击展开） */
.stars { position: relative; display: inline-block; cursor: help; outline: none; }
.stars-row { font-size: 26px; line-height: 1.3; letter-spacing: 2px; user-select: none; }
.stars-row .on { color: var(--accent); }
.stars-row .off { color: var(--line); }
.stars-label { font-size: 12px; color: var(--muted); margin-top: 6px; letter-spacing: 0.05em; }
.stars-na { font-size: 13px; color: var(--muted); }
.stars-tip {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 40;
  width: 250px;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--ink-strong);
  color: var(--surface);
  font-size: 12px;
  line-height: 1.7;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(53, 48, 42, 0.25);
  cursor: default;
}
.stars-tip i { font-style: normal; color: var(--faint); }
.stars:hover .stars-tip, .stars:focus .stars-tip, .rate:hover .stars-tip, .rate:focus .stars-tip, .stars-tip.open { display: block; }
/* 在架率：左栏评级指标（与星级同列），口径说明复用 .stars-tip 气泡（桌面悬浮 / 触屏点击） */
.rate { position: relative; display: block; width: fit-content; cursor: help; outline: none; margin-top: 18px; }
.rate-num { font-family: var(--mono); font-size: 24px; font-weight: 600; color: var(--ink-strong); line-height: 1.2; }
.rate-label { font-size: 12px; color: var(--muted); margin-top: 2px; letter-spacing: 0.05em; }

.book-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1.35;
}
.book-title a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.book-title a:hover { color: var(--accent); }
/* 书卡标题旁的分享按钮：默认低调，hover 才显形 */
.share-btn {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--faint);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
  margin-left: 10px;
  cursor: pointer;
  vertical-align: 3px;
  opacity: 0.7;
}
.share-btn:hover { color: var(--accent); border-color: var(--accent); opacity: 1; }
.book-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.book-meta .callnumber { color: var(--accent); }
.review-flag {
  font-family: var(--sans);
  background: var(--warn-tint);
  color: var(--warn);
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.kv-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 13px;
  margin-bottom: 6px;
}
.kv-row .k { color: var(--muted); }
.kv-row .v { color: var(--ink-strong); font-weight: 600; }
.kv-row .v.ok { color: var(--ok); }
.kv-row .v.bad { color: var(--bad); }

.charts {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  margin-top: 10px;
}
.chart-box .chart-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}
.chart-trend { height: 130px; }
.chart-week { height: 130px; }

/* ---------- 书卡：分馆小表（主视觉：底板 + 大字号 + 深色数字） ---------- */
.branch-rows {
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px 14px;
  font-size: 14px;
  max-width: 560px;
}
.branch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}
.branch-row:last-child { border-bottom: none; }
.branch-row .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
}
.branch-row .dot.ok { background: var(--ok); }
.branch-row .dot.bad { background: var(--bad); }
.branch-row .dot.none { background: var(--faint); }
.branch-row .bname { color: var(--ink-strong); font-weight: 600; }
.branch-row .bstat { color: var(--ink-strong); font-family: var(--mono); font-size: 13px; margin-left: auto; }

/* ---------- 历史数据管理 ---------- */
.panel {
  background: var(--card);
  padding: 24px 26px;
  margin: 18px 0;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 14px 0;
}
.history-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  letter-spacing: 0.08em;
}
.history-table td { padding: 6px 8px; border-bottom: 1px solid var(--surface); }
.history-table tr.selected td { background: #fdeee4; color: var(--accent); }
.history-table input[type="checkbox"] { accent-color: var(--accent); }

.prune-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  font-size: 13px;
}
.prune-row input[type="date"] {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

/* ---------- 按钮 ---------- */
.btn {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 9px 22px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--surface); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: #d93800; }
.btn::before { content: ""; }
.btn:hover::after { content: ""; }

/* ---------- 书单助手 ---------- */
.books-editor {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 14px 0;
}
.books-editor th {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  font-size: 12px;
}
.books-editor td { padding: 6px 8px; border-bottom: 1px solid var(--surface); vertical-align: middle; }
.books-editor tr.disabled td { opacity: 0.45; background: var(--surface); }
.books-editor tr.disabled input { background: transparent; }
.books-editor input[type="text"] {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.books-editor input[type="text"]:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.books-editor input[type="text"].bad { border-color: var(--bad); background: var(--bad-tint); }
.books-editor input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }
.books-editor .btn-delete {
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--bad);
  background: transparent;
  color: var(--bad);
  cursor: pointer;
  white-space: nowrap;
}
.books-editor .btn-delete:hover { background: var(--bad-tint); }
.helper-valid { font-size: 12.5px; margin: 10px 0; }
.helper-valid .ok { color: var(--ok); }
.helper-valid .bad { color: var(--bad); }
.resolve-tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.resolve-tag.ok { background: var(--ok-tint); color: var(--ok); }
.resolve-tag.bad { background: var(--bad-tint); color: var(--bad); }
.resolve-tag.warn { background: var(--warn-tint); color: var(--warn); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; }
.btn.primary:disabled:hover { background: var(--accent); }
.refresh-status { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.helper-note { font-size: 12px; color: var(--warn); margin: 4px 0 10px; }
.btn-subtle {
  font-family: var(--sans);
  font-size: 12px;
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 6px;
}
.btn-subtle:hover { color: var(--bad); }

/* ---------- 采样日志 / 远程采样 ---------- */
.sample-log {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  background: var(--ink-strong);
  color: #e8e0d2;
  padding: 10px 14px;
  margin: 4px 0 10px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 140px;
  overflow: auto;
}
.gh-box {
  margin: 6px 0 10px;
  font-size: 13px;
}
.gh-box summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  list-style: none;
}
.gh-box summary::before { content: "▸ "; color: var(--faint); }
.gh-box[open] summary::before { content: "▾ "; }
.gh-box summary:hover { color: var(--accent); }
.gh-config {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.gh-config label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.gh-config input {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  width: 200px;
}
.gh-config input:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.gh-note { font-size: 12px; color: var(--faint); margin: 8px 0; }
.gh-action { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gh-open { color: var(--accent); font-size: 12.5px; }
.gh-open.disabled { color: var(--faint); text-decoration: none; cursor: default; }
.gh-status { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- 空状态 / 提示 ---------- */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  background: var(--card);
  margin: 18px 0;
}
.empty-state .big { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--ink-strong); margin-bottom: 10px; }
.empty-state p { color: var(--muted); max-width: 520px; margin: 0 auto 20px; }

.demo-banner {
  background: var(--accent-tint);
  color: #7a2a00;
  font-size: 13px;
  padding: 9px 16px;
  text-align: center;
  margin: 14px 0 0;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-strong);
  color: #f4f0ea;
  font-size: 13px;
  padding: 10px 24px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 99;
}
.toast.show { opacity: 1; }

footer {
  margin-top: 60px;
  border-top: 3px double var(--ink);
  padding: 18px 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .book-card { grid-template-columns: 1fr; gap: 18px; }
  /* 窄屏：左栏变顶栏，星级与在架率并排 */
  .score-col { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 16px; display: flex; gap: 40px; align-items: flex-start; }
  .rate { margin-top: 0; }
  .charts { grid-template-columns: 1fr; }
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  /* 筛选条三段在窄屏各占一行，去掉段间竖线 */
  .filter-seg { width: 100%; }
  .filter-seg + .filter-seg { border-left: none; padding-left: 0; margin-left: 0; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .masthead { padding: 20px 0 14px; }
  .book-card { padding: 18px 16px; margin: 14px 0; }
  .book-title { font-size: 19px; }
  .branch-rows { max-width: none; }
  .branch-row .bstat { font-size: 11.5px; }
  .kv-row { gap: 6px 16px; }
  .panel { padding: 18px 14px; overflow-x: auto; }
  .books-editor { font-size: 12px; min-width: 620px; }
  .avail-group { gap: 6px; }
  .avail-label { flex-basis: 100%; }
  .group-title { font-size: 16px; margin: 22px 0 -4px; }
}

@media (max-width: 480px) {
  .stat-cell { padding: 12px 14px; }
  .stat-cell .num { font-size: 26px; }
  .book-card { padding: 16px 14px; gap: 14px; }
  .score-col { padding-bottom: 12px; }
  .book-meta { font-size: 11px; gap: 4px 12px; }
  .action-line { font-size: 12.5px; padding: 6px 10px; }
  .chart-trend, .chart-week { height: 110px; }
  .btn { padding: 8px 16px; }
  .prune-row { gap: 8px; }
  .toast { max-width: 88vw; text-align: center; }
}

/* ---------- 行动建议 / 新可借标记 ---------- */
.action-line {
  margin: 2px 0 10px;
  padding: 7px 12px;
  font-size: 13px;
  background: var(--surface);
  border-left: 3px solid var(--line);
  color: var(--ink-strong);
}
.action-line.ok { background: var(--ok-tint); border-left-color: var(--ok); }
.action-line.warn { background: var(--warn-tint); border-left-color: var(--warn); }
.action-line.muted { color: var(--muted); }
.new-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 0 7px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  vertical-align: 2px;
}
.chip .new-badge { margin-left: 5px; padding: 0 6px; vertical-align: 1px; }

/* ---------- 观测口径（分馆选择） ---------- */
.branch-prefs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
  font-size: 13px;
  color: var(--muted);
}
.branch-prefs-label { cursor: help; }
.branch-prefs .btn-subtle { font-size: 12px; }

/* ---------- 书单分组 ---------- */
.group-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 28px 0 -6px;
}
/* 分组 chips：实线描边，选中为深色实心（与橙色状态 pill 区分层级） */
.group-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  background: transparent;
  border: 1px solid var(--faint);
  color: var(--ink);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.group-chip:hover { background: var(--surface); }
.group-chip.active {
  background: var(--ink-strong);
  border-color: var(--ink-strong);
  color: #fff;
}

/* ---------- 书单助手：分组段标题 / 拖拽 ---------- */
.books-editor tr.group-row td {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
}
.books-editor tr.group-row.drop-into td { outline: 2px dashed var(--accent); outline-offset: -2px; }
.group-tag { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; margin-right: 8px; }
.group-tag.none { color: var(--faint); }
/*  specificity 需压过 .books-editor input[type="text"] 的全宽规则 */
.books-editor input[type="text"].group-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-strong);
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 4px 8px;
  width: 180px;
}
.books-editor input[type="text"].group-name:hover { border-color: var(--line); }
.books-editor input[type="text"].group-name:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); background: #fff; }
.group-count, .group-hint { font-size: 12px; color: var(--faint); margin-left: 10px; }
.books-editor .drag-cell { width: 34px; }
.drag-handle {
  display: inline-block;
  cursor: grab;
  color: var(--faint);
  font-size: 14px;
  padding: 2px 4px;
  user-select: none;
  touch-action: none;
}
.drag-handle:hover { color: var(--accent); }
.drag-handle:active { cursor: grabbing; }
.books-editor tr.book-row.dragging { opacity: 0.35; }
.books-editor tr.book-row.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.books-editor tr.book-row.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
