:root {
  --bg: #f7f7f8;
  --side: #f0f2f1;
  --side-hover: #e4eae6;
  --side-active: #d7ebe3;
  --line: #dde3df;
  --text: #1f2a25;
  --muted: #6b7a72;
  --accent: #2f8f74;
  --accent-2: #247a62;
  --danger: #c44b4b;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(20, 40, 32, 0.08);
  --radius: 14px;
  --font: "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-page { min-height: 100%; position: relative; }
.login-bg {
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 520px at 18% 8%, rgba(176, 141, 87, .12), transparent 58%),
    radial-gradient(700px 480px at 92% 88%, rgba(46, 74, 86, .35), transparent 62%),
    linear-gradient(165deg, #12181f 0%, #0d141b 42%, #101a22 100%);
}
.login-bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 100% 28px;
  opacity: .35;
  pointer-events: none;
}
.login-main {
  position: relative; z-index: 1;
  width: min(520px, calc(100% - 2rem));
  margin: 0 auto;
  min-height: 100%;
  padding: 7vh 0 3.2rem;
  display: grid;
  justify-items: stretch;
  align-content: center;
  gap: 1.35rem;
}
.login-hero {
  color: #f3efe6;
  text-align: center;
}
.login-tag {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #d6c4a2;
  border: 1px solid rgba(214, 196, 162, .38);
  padding: .2rem .7rem;
  border-radius: 999px;
  margin-bottom: .85rem;
}
.login-hero h1 {
  font-size: clamp(1.55rem, 3.4vw, 2.05rem);
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.35;
  margin: 0 0 .55rem;
  color: #f7f3ea;
}
.login-hero p {
  margin: 0 auto;
  max-width: 26rem;
  color: rgba(243, 239, 230, .78);
  line-height: 1.65;
  font-size: .95rem;
}
.login-card {
  background: #f7f4ee;
  border: 1px solid rgba(214, 196, 162, .35);
  border-radius: 14px;
  padding: 1.35rem 1.3rem 1.25rem;
  box-shadow: 0 18px 46px rgba(6, 10, 14, .28);
  display: grid;
  gap: .9rem;
}
.login-card label {
  display: grid;
  gap: .38rem;
  font-size: .86rem;
  color: #5c564c;
  letter-spacing: .04em;
}
.login-card input {
  border: 1px solid #d7d1c6;
  border-radius: 10px;
  padding: .78rem .85rem;
  background: #fffcf7;
  color: #1c211f;
}
.login-card input:focus {
  outline: none;
  border-color: #9a8058;
  box-shadow: 0 0 0 3px rgba(176, 141, 87, .18);
}
.login-captcha {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55rem;
  align-items: center;
}
.captcha-q {
  min-width: 6.2rem;
  padding: .7rem .7rem;
  border-radius: 10px;
  background: #ece6da;
  color: #2a2e33;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  font-weight: 600;
}
.login-error {
  background: #f6e8e4;
  color: #7a3a32;
  border-radius: 8px;
  padding: .55rem .7rem;
  font-size: .88rem;
}
.login-page .btn-primary {
  border: none;
  border-radius: 10px;
  padding: .82rem 1rem;
  margin-top: .15rem;
  background: linear-gradient(180deg, #3a4650, #2a343c);
  color: #f4efe6;
  font-weight: 600;
  letter-spacing: .08em;
}
.login-page .btn-primary:hover { filter: brightness(1.08); }
.btn-primary {
  border: none; border-radius: 10px; padding: .75rem 1rem;
  background: linear-gradient(180deg, #3a9a80, #2f8f74);
  color: #fff; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: .55rem .9rem; color: var(--text);
}
.login-qrs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}
.login-qr {
  margin: 0;
  background: rgba(247, 244, 238, .08);
  border: 1px solid rgba(214, 196, 162, .22);
  border-radius: 12px;
  padding: .85rem .7rem .8rem;
  display: grid;
  justify-items: center;
  gap: .65rem;
  text-align: center;
}
.login-qr img {
  width: 118px;
  height: 118px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}
.login-qr figcaption {
  display: grid;
  gap: .18rem;
  color: #efe8d8;
  min-height: 2.8rem;
}
.login-qr figcaption strong {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.4;
}
.login-qr figcaption span {
  font-size: .75rem;
  color: rgba(239, 232, 216, .72);
  line-height: 1.45;
}

.login-qrs[hidden] { display: none !important; }

@media (max-width: 560px) {
  .login-main { width: min(100% - 1.5rem, 520px); padding-top: 4.5vh; }
  .login-qrs { grid-template-columns: 1fr; }
}

/* ---------- App shell ---------- */
.app-page {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.sidebar-top {
  display: flex; gap: .45rem; padding: .85rem .75rem .35rem;
}
.sidebar-actions {
  padding: 0 .75rem .55rem;
}
.btn-clear-all {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: .42rem .65rem;
  font-size: .82rem;
}
.btn-clear-all:hover {
  background: #fdf2f2;
  color: var(--danger);
  border-color: #efc4c4;
}
.btn-new {
  flex: 1; display: flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: .65rem .8rem; font-weight: 550;
}
.btn-new:hover { background: var(--side-hover); }
.btn-new .plus { color: var(--accent); font-size: 1.1rem; }
.btn-icon {
  width: 2.4rem; border: 1px solid var(--line); background: #fff;
  border-radius: 12px;
}
.side-section { padding: .35rem .7rem .2rem; }
.side-label {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: .35rem .35rem .25rem;
}
.folder-chips { display: flex; flex-wrap: wrap; gap: .35rem; padding: .15rem .2rem .4rem; position: relative; }
.chip {
  border: 1px solid transparent; background: transparent;
  border-radius: 999px; padding: .28rem .65rem; font-size: .82rem; color: var(--muted);
}
.chip:hover { background: var(--side-hover); color: var(--text); }
.chip.active {
  background: var(--side-active); color: var(--accent-2); font-weight: 560;
}
.folder-create {
  display: flex; gap: .35rem; padding: 0 .2rem .5rem;
}
.folder-create input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .55rem; background: #fff; font-size: .85rem;
}
.btn-tiny {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: .35rem .55rem; font-size: .82rem;
}

.side-chats { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: visible; }
.chat-list {
  flex: 1; overflow: auto; padding: .1rem .2rem 1.5rem;
  scrollbar-width: thin;
}
.group-label {
  font-size: .72rem; color: var(--muted);
  padding: .55rem .45rem .2rem;
}
.chat-item {
  position: relative;
  display: flex; align-items: center;
  border-radius: 10px; margin: .1rem 0;
}
.chat-item:hover, .chat-item.menu-open { background: var(--side-hover); }
.chat-item.active { background: var(--side-active); }
.chat-item .title-btn {
  flex: 1; min-width: 0; text-align: left;
  border: none; background: transparent;
  padding: .55rem .55rem .55rem .65rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: .92rem;
}
.chat-item .more-btn {
  opacity: 1; border: none; background: transparent;
  width: 1.9rem; height: 1.9rem; border-radius: 8px;
  color: var(--muted); margin-right: .25rem; flex-shrink: 0;
  z-index: 2;
}
@media (hover: hover) and (pointer: fine) {
  .chat-item .more-btn { opacity: 0; }
  .chat-item:hover .more-btn,
  .chat-item.menu-open .more-btn,
  .chat-item.active .more-btn { opacity: 1; }
}
.chat-item .more-btn:hover { background: rgba(0,0,0,.06); color: var(--text); }

.chip-wrap {
  display: inline-flex; align-items: center; gap: .1rem;
  border-radius: 999px; max-width: 100%;
}
.chip-wrap.active { background: var(--side-active); }
.chip-wrap .chip { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-wrap.active .chip { color: var(--accent-2); font-weight: 560; }
.chip-more {
  border: none; background: transparent; color: var(--muted);
  width: 1.35rem; height: 1.35rem; border-radius: 999px; font-size: .85rem;
  padding: 0; line-height: 1;
}
.chip-more:hover { background: rgba(0,0,0,.06); color: var(--text); }
.folder-menu {
  display: none; position: absolute; z-index: 65;
  min-width: 140px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: .3rem;
}
.folder-menu.open { display: grid; gap: .05rem; }
.folder-menu button {
  border: none; background: transparent; text-align: left;
  padding: .5rem .65rem; border-radius: 8px; font-size: .88rem;
}
.folder-menu button:hover { background: var(--side-hover); }
.folder-menu button.danger { color: var(--danger); }

/* ⋯ 菜单：贴着会话行右下角 */
.chat-item .item-menu {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  right: .2rem;
  z-index: 60;
  min-width: 168px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: .3rem;
}
.chat-item.menu-open .item-menu { display: grid; gap: .05rem; }
.chat-item .item-menu button {
  border: none; background: transparent; text-align: left;
  padding: .5rem .65rem; border-radius: 8px; font-size: .88rem;
}
.chat-item .item-menu button:hover { background: var(--side-hover); }
.chat-item .item-menu button.danger { color: var(--danger); }
.chat-item .item-menu .menu-sep {
  height: 1px; background: var(--line); margin: .2rem .3rem;
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: .7rem .75rem .85rem;
  display: grid;
  gap: .55rem;
}
.kb-side {
  padding: .45rem .5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef6f2;
}
.kb-side .kb-tag {
  display: inline-block;
  font-size: .62rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid rgba(47, 143, 116, .28);
  border-radius: 999px;
  padding: .06rem .38rem;
  margin-bottom: .2rem;
}
.kb-side .kb-name {
  font-size: .82rem;
  font-weight: 600;
  color: #274038;
  line-height: 1.3;
}
.kb-side .kb-sub {
  margin: .18rem 0 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.4;
}
.kb-side .foot-meta {
  margin: .28rem 0 0;
  color: var(--muted);
  font-size: .72rem;
}
.user-line { display: flex; align-items: center; gap: .45rem; font-weight: 550; font-size: .9rem; }
.user-dot {
  width: .65rem; height: .65rem; border-radius: 50%;
  background: var(--accent);
}
.btn-logout {
  width: 100%; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: .45rem .6rem; font-size: .85rem;
}

/* ---------- Main ---------- */
.main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  height: 100%; max-height: 100%; overflow: hidden; background: var(--bg);
}
.main-head {
  flex: none;
  display: flex; align-items: flex-start; gap: .55rem;
  padding: 1rem 1.4rem .4rem;
  border-bottom: 1px solid transparent;
}
.main-head-text { min-width: 0; flex: 1; }
.main-head h1 {
  margin: 0; font-size: 1.15rem; font-weight: 600; color: #274038;
}
.main-sub { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }
.btn-open-side {
  display: none;
  flex: none; margin-top: .1rem;
  width: 2.4rem; border: 1px solid var(--line); background: #fff;
  border-radius: 12px;
}
.side-scrim {
  display: none;
  position: fixed; inset: 0; z-index: 25;
  background: rgba(20, 35, 30, .28);
}

/* 桌面收起侧栏 */
.app-page.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app-page.side-collapsed .sidebar {
  overflow: hidden; border-right: none; pointer-events: none;
}
.app-page.side-collapsed .btn-open-side { display: grid; place-items: center; }

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 1rem 1.25rem 1.25rem;
  max-width: 880px; width: 100%; margin: 0 auto;
}
.status-bar { flex: none; }
.composer { flex: none; }

.msg {
  display: grid; gap: .45rem; margin: 0 0 1.15rem;
}
.msg .role {
  font-size: .75rem; color: var(--muted); letter-spacing: .04em;
}
.msg.user .bubble {
  background: #e8f3ee; border: 1px solid #d5e6de;
  border-radius: 16px 16px 4px 16px; padding: .85rem 1rem;
  white-space: pre-wrap; line-height: 1.6;
}
.msg.assistant .bubble {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px; padding: .95rem 1.05rem;
  line-height: 1.65;
}
.msg.assistant .bubble :is(h1,h2,h3) {
  margin: .85rem 0 .4rem; font-weight: 600; color: #274038;
}
.msg.assistant .bubble h1 { font-size: 1.2rem; }
.msg.assistant .bubble h2 { font-size: 1.08rem; }
.msg.assistant .bubble h3 { font-size: 1rem; }
.msg.assistant .bubble p { margin: .45rem 0; }
.msg.assistant .bubble ul, .msg.assistant .bubble ol { margin: .35rem 0 .35rem 1.2rem; }
.msg.assistant .bubble code {
  background: #eef3f0; padding: .05rem .3rem; border-radius: 4px; font-size: .9em;
}
.msg .timing { color: var(--muted); font-size: .78rem; }
.msg .attach-note {
  font-size: .8rem; color: var(--muted);
  background: #f3f6f4; border-radius: 8px; padding: .4rem .55rem;
}

.status-bar {
  max-width: 880px; width: 100%; margin: 0 auto;
  padding: .35rem 1.25rem .55rem;
  color: var(--accent-2); font-size: .9rem;
  display: flex; flex-direction: column; gap: .45rem;
}
.progress-steps {
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.pstep {
  font-size: .75rem; color: var(--muted);
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: .18rem .55rem;
}
.pstep.done {
  color: var(--accent-2); border-color: rgba(47,143,116,.35);
  background: rgba(47,143,116,.08);
}
.pstep.done::before { content: "✓ "; }
.pstep.active {
  color: #fff; background: var(--accent); border-color: var(--accent);
}
.status-row {
  display: flex; align-items: center; gap: .5rem;
}
.status-row #statusText { flex: 1; min-width: 0; }
.btn-stop {
  border: 1px solid #d9a0a0; background: #fff;
  color: var(--danger); border-radius: 8px;
  padding: .28rem .65rem; font-size: .82rem; flex: none;
}
.btn-stop:hover { background: #fdf2f2; }
.spin {
  width: .85rem; height: .85rem; border-radius: 50%;
  border: 2px solid rgba(47,143,116,.25);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: grid; gap: .75rem; padding: .4rem 0 1rem;
}
.empty-state .empty-lead {
  color: var(--muted); line-height: 1.55; margin: 0;
}
.empty-examples {
  display: grid; gap: .45rem;
}
.empty-examples button {
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: .7rem .85rem; color: var(--text);
  line-height: 1.45; font-size: .92rem;
}
.empty-examples button:hover {
  border-color: rgba(47,143,116,.45); background: #f3faf7;
}
.composer-hint {
  margin: .4rem .2rem 0; color: var(--muted); font-size: .75rem;
}
.waiting-bubble {
  color: var(--muted); font-style: italic;
}

.composer {
  max-width: 880px; width: 100%; margin: 0 auto;
  padding: .4rem 1.25rem 1rem;
  position: relative;
  z-index: 5;
}
.composer-box {
  display: flex; gap: .5rem; align-items: flex-end;
  background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: .55rem .55rem .55rem .85rem;
  box-shadow: 0 4px 18px rgba(20,40,32,.04);
}
.composer-box textarea {
  flex: 1; border: none; outline: none; resize: none;
  max-height: 160px; min-height: 28px; line-height: 1.45;
  background: transparent;
}
.composer-actions { display: flex; gap: .3rem; align-items: center; }
.msg.assistant .role-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .15rem;
}
.btn-copy-msg {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; cursor: pointer;
}
.btn-copy-msg:hover { color: var(--text); border-color: #b7c7be; }
.btn-send {
  width: 2.2rem; height: 2.2rem; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 1.05rem; font-weight: 700;
}
.btn-send:disabled { opacity: .45; cursor: not-allowed; }
.btn-pause {
  min-width: 3.4rem; height: 2.2rem; border: none; border-radius: 999px;
  padding: 0 .75rem; background: #c45c5c; color: #fff; font-size: .88rem;
}
.btn-pause:hover { filter: brightness(1.05); }
.btn-pause:disabled { opacity: .45; cursor: not-allowed; }
/* 文献目录/阅读器遮罩之上：生成中仍可看进度并暂停 */
.job-float-bar {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 140;
  display: flex;
  align-items: center;
  gap: .65rem;
  max-width: min(520px, calc(100vw - 1.5rem));
  padding: .55rem .65rem .55rem .9rem;
  border-radius: 999px;
  border: 1px solid rgba(47, 143, 116, .35);
  background: rgba(248, 252, 250, .96);
  box-shadow: 0 10px 28px rgba(30, 50, 42, .18);
  color: #1f4d3f;
  font-size: .9rem;
  line-height: 1.3;
  pointer-events: auto;
}
.job-float-bar.hidden { display: none !important; }
.job-float-bar .job-float-spin {
  width: .7rem; height: .7rem; border-radius: 50%;
  border: 2px solid rgba(47, 143, 116, .25);
  border-top-color: #2f8f74;
  animation: job-float-spin .7s linear infinite;
  flex: none;
}
.job-float-bar.done .job-float-spin { display: none; }
.job-float-bar .job-float-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-float-bar .job-float-pause {
  flex: none;
  border: none;
  border-radius: 999px;
  padding: .35rem .75rem;
  background: #c45c5c;
  color: #fff;
  font-size: .84rem;
  cursor: pointer;
}
.job-float-bar .job-float-pause:hover { filter: brightness(1.05); }
.job-float-bar.done {
  border-color: rgba(47, 143, 116, .45);
  background: rgba(47, 143, 116, .12);
}
@keyframes job-float-spin { to { transform: rotate(360deg); } }
.menu-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: transparent;
  pointer-events: none; /* 默认不挡主区滚轮与点击 */
}
.menu-backdrop:not(.hidden) {
  pointer-events: auto;
}
.menu-backdrop.hidden,
.paper-backdrop.hidden,
.side-scrim.hidden,
.modal-backdrop.hidden {
  display: none !important;
  pointer-events: none !important;
}
/* 侧栏菜单打开时，不要挡住右侧聊天输入区与消息滚动 */
.menu-backdrop.sidebar-only {
  right: auto;
  width: 280px;
  pointer-events: auto;
}
.modal-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(20, 35, 30, .35);
  display: grid; place-items: center; padding: 1rem;
}
.modal {
  width: min(420px, 100%);
  background: #fff; border-radius: 16px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1rem;
}
.modal h3 { margin: 0 0 .75rem; font-size: 1.05rem; }
.modal input, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: .65rem .75rem; background: #fff;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem;
}

.msg.assistant .bubble sup.cite-sup {
  display: inline-block; margin: 0 1px; padding: 0 .2rem;
  background: rgba(47,143,116,.12); color: #247a62;
  border: 1px solid rgba(47,143,116,.25); border-radius: 4px;
  font-size: .78em; font-weight: 600; line-height: 1.35;
  vertical-align: super; cursor: pointer;
}
.msg.assistant .bubble sup.cite-sup:hover,
.msg.assistant .bubble sup.cite-sup.clickable:hover {
  background: rgba(47,143,116,.28);
}
.msg.assistant .bubble sup.cite-sup.clickable::after {
  content: none;
}

.paper-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 35, 30, .28);
}
.paper-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 81;
  width: min(760px, 92vw);
  background: #f9fbf9; border-left: 1px solid var(--line);
  box-shadow: -12px 0 28px rgba(40,55,48,.12);
  transform: translateX(105%);
  transition: transform .28s ease;
  display: flex; flex-direction: column;
}
.paper-drawer.open { transform: translateX(0); }
.paper-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1rem; border-bottom: 1px solid var(--line);
  background: #eef4f0; flex: none;
}
.paper-title {
  flex: 1; font-weight: 600; color: #274038;
  word-break: break-all; font-size: .95rem;
}
.paper-close {
  width: 2.1rem; height: 2.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: #f5f8f5; color: var(--muted);
}
.paper-body {
  flex: 1; overflow-y: auto; padding: 1rem 1.25rem 2.5rem;
  line-height: 1.7; font-size: .95rem; color: #2f3a35;
}
.paper-body .cite-note {
  margin: 0 0 .85rem; padding: .55rem .75rem;
  background: #eef6f2; border: 1px solid #d5e6de;
  border-radius: 8px; color: #3d5c50; font-size: .88rem;
}
.paper-body .hl-block {
  background: #fff8e1;
  border-left: 4px solid #e0a800;
  padding: .55rem .75rem;
  border-radius: 8px;
  margin: .55rem 0;
  box-shadow: inset 0 0 0 1px rgba(224, 168, 0, .22);
}
.paper-body .hl-block-fallback {
  background: #fff3c4;
}
.paper-body mark.hl-sent,
.paper-body mark.hl-sent.primary {
  background-color: #ffd36a !important;
  background-image: none !important;
  color: inherit;
  padding: 0.12em 0.22em;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  outline: 1px solid #e0a800;
}
.paper-body h1, .paper-body h2, .paper-body h3 { color: #274038; margin: .85rem 0 .35rem; line-height: 1.35; }
.paper-body h1 { font-size: 1.15rem; }
.paper-body h2 { font-size: 1.05rem; }
.paper-body h3 { font-size: 1rem; }
.paper-body p { margin: .28rem 0; }
.paper-body p:empty { display: none; }
.paper-body br + br { display: none; }
.paper-body ul, .paper-body ol { margin: .28rem 0 .28rem 1.15rem; }
.paper-body li { margin: .12rem 0; }
.paper-body table {
  border-collapse: collapse; width: 100%; margin: .55rem 0; font-size: .88rem;
}
.paper-body th, .paper-body td {
  border: 1px solid var(--line); padding: .35rem .5rem; vertical-align: top;
}
.paper-body img { max-width: 100%; height: auto; display: none; /* 本地图路径无效，隐藏破图 */ }

.btn-lib-insights {
  width: 100%; margin: 0 0 .45rem; padding: .45rem .65rem;
  border: 1px solid #c5d6cc; border-radius: 8px;
  background: #eef6f1; color: #2a4a3c; font-size: .88rem; cursor: pointer;
}
.btn-lib-insights:hover { background: #e3f0e8; }
.session-search {
  width: 100%; box-sizing: border-box; padding: .4rem .55rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: .85rem; color: var(--text);
}
.main-head { display: flex; align-items: flex-start; gap: .6rem; }
.main-head-text { flex: 1; min-width: 0; }
.main-head-actions { display: flex; gap: .35rem; flex: none; padding-top: .15rem; }
.btn-head {
  padding: .3rem .55rem; border-radius: 8px; border: 1px solid #c5d6cc;
  background: #f5f8f5; color: #2a4a3c; font-size: .8rem; cursor: pointer;
}
.btn-head:hover { background: #e8f0eb; }
.msg-ops { display: flex; gap: .25rem; flex-wrap: wrap; }
.align-hint {
  margin: .35rem 0 0; font-size: .8rem; color: #7a6a3a;
  background: #fff8e8; border: 1px solid #edd9a8; border-radius: 6px;
  padding: .3rem .55rem;
}
.btn-expand {
  margin: .35rem 0 0; padding: .2rem .5rem; border: 1px solid #c5d6cc;
  border-radius: 6px; background: #f5f8f5; color: #3a5a4a; font-size: .78rem; cursor: pointer;
}
.followups { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.follow-chip, .ex-chip {
  text-align: left; padding: .35rem .55rem; border-radius: 8px;
  border: 1px solid #cfe0d6; background: #f3f8f5; color: #2f4a3c;
  font-size: .8rem; cursor: pointer; line-height: 1.35;
}
.follow-chip:hover, .ex-chip:hover { background: #e7f1eb; }
.lib-list { display: grid; gap: .45rem; }
.lib-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: .65rem .75rem; border: 1px solid #d7e3dc; border-radius: 10px;
  background: #fff; position: relative; overflow: hidden;
  border-left: 3px solid transparent;
  transition: border-color .15s ease, filter .15s ease, box-shadow .15s ease;
}
.lib-row:hover {
  border-color: #9fc0ae;
  filter: brightness(0.97);
  box-shadow: inset 0 0 0 1px rgba(45, 120, 85, .08);
}
.lib-title { font-size: .9rem; color: #243832; line-height: 1.45; font-weight: 500; }
.lib-meta { margin-top: .25rem; font-size: .78rem; color: #6a7a72; }
.lib-row .lib-if {
  display: inline-block; margin-left: .25rem; padding: .05rem .35rem;
  border-radius: 999px; font-size: .7rem; background: rgba(255,255,255,.55);
  color: #3d5c4a; border: 1px solid rgba(61, 92, 74, .18);
}
.lib-if-legend {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  margin: 0 0 .75rem; font-size: .78rem; color: #5a6b63;
}
.lib-if-swatch {
  display: inline-block; width: 2.4rem; height: .65rem; border-radius: 99px;
  background: linear-gradient(90deg, rgba(45,120,85,.08), rgba(45,120,85,.55));
  border: 1px solid rgba(45,120,85,.18); vertical-align: middle;
}
.lib-if-swatch.gray {
  background: linear-gradient(90deg, rgba(120,120,120,.08), rgba(120,120,120,.4));
  border-color: rgba(120,120,120,.25);
}
.lib-row.is-nonsci .lib-if { color: #5a5a5a; border-color: rgba(90,90,90,.2); }
.reader-meta-card {
  margin: 0 0 1.35rem; padding: .9rem 1rem; border-radius: 12px;
  background: rgba(255,255,255,.55); border: 1px solid rgba(180,160,130,.35);
  font-family: "IBM Plex Sans", "Noto Sans SC", sans-serif;
}
.reader-meta-card h4 {
  margin: 0 0 .55rem; font-size: .88rem; font-weight: 600; color: #3a342c;
}
.reader-meta-grid {
  display: grid; gap: .4rem;
  grid-template-columns: minmax(5.5rem, 7rem) 1fr;
  font-size: .84rem; line-height: 1.45;
}
.reader-meta-grid .k { color: #8a8074; }
.reader-meta-grid .v { color: #2c2822; word-break: break-word; }
.meta-chip {
  display: inline-block; margin: 0 .25rem .2rem 0; padding: .08rem .4rem;
  border-radius: 999px; border: 1px solid rgba(61,92,74,.25);
  background: rgba(61,92,74,.08); color: #2f5a44; cursor: pointer;
  font-size: .78rem; line-height: 1.3;
}
.meta-chip:hover { background: rgba(61,92,74,.16); }
.meta-chip.uncertain {
  border-color: rgba(140,110,60,.3); background: rgba(240,220,170,.35); color: #7a5a20;
  cursor: default;
}
.paper-drawer.reader-mode.theme-night .reader-meta-card {
  background: rgba(30,35,42,.9); border-color: #2e353e;
}
.paper-drawer.reader-mode.theme-night .reader-meta-card h4,
.paper-drawer.reader-mode.theme-night .reader-meta-grid .v { color: #eef2f7; }
.paper-drawer.reader-mode.theme-night .reader-meta-grid .k { color: #8b93a0; }
.paper-drawer.reader-mode.theme-night .meta-chip {
  background: rgba(120,160,140,.15); border-color: #3a4450; color: #c5e0d2;
}
.reader-back-btn {
  flex: none; border: 1px solid #d5cbb8; background: #f7f2e8; color: #3d5c4a;
  border-radius: 999px; padding: .3rem .7rem; font-size: .8rem; cursor: pointer;
  white-space: nowrap;
}
.reader-back-btn.hidden { display: none !important; }
.reader-back-btn:hover { background: #efe8da; }
.paper-drawer.reader-mode.theme-night .reader-back-btn {
  background: #2a313a; border-color: #3a4450; color: #c5ccd6;
}
.country-dot {
  display: inline-block; width: .55rem; height: .55rem; border-radius: 50%;
  margin-right: .35rem; vertical-align: middle; flex: none;
}
.country-tag {
  margin-left: .3rem; font-size: .68rem; padding: .05rem .3rem;
  border-radius: 999px; border: 1px solid; vertical-align: middle; white-space: nowrap;
}
.inst-row .insights-bar-name {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 0 .15rem;
  white-space: normal; line-height: 1.3;
  overflow: hidden; text-overflow: unset; word-break: break-word;
}
/* 文献阅读：全屏居中电子书版式 */
.paper-drawer.reader-mode {
  left: 0; right: 0; width: 100vw; max-width: none;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 250, 240, .55), transparent 60%),
    linear-gradient(180deg, #d9d0c2 0%, #cfc4b2 100%);
  z-index: 92; border-left: none;
  box-shadow: none; transform: translateX(0);
}
.paper-drawer.reader-mode:not(.open) { transform: translateX(105%); }
.paper-drawer.reader-mode .paper-head {
  background: rgba(250, 246, 238, .92);
  border-bottom: 1px solid rgba(180, 160, 130, .35);
  backdrop-filter: blur(8px);
  justify-content: center; gap: .55rem; flex-wrap: wrap;
  padding: .65rem 1rem .65rem 1rem;
}
.paper-drawer.reader-mode .paper-title {
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
  font-weight: 500; text-align: center; flex: 1 1 12rem;
  min-width: 0; font-size: .92rem; color: #3a342c;
}
.paper-drawer.reader-mode .paper-close { order: 9; }
.paper-drawer.reader-mode .paper-body {
  padding: 0; background: transparent;
  display: block;
}
.reader-ebook-shell {
  width: min(1520px, 98vw);
  margin: .75rem auto 2rem;
  padding: 2rem clamp(2rem, 5.5vw, 4.5rem) 3.25rem;
  background: #faf6ee;
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .65) inset,
    0 18px 48px rgba(40, 30, 18, .16),
    0 0 0 1px rgba(90, 70, 40, .08);
  box-sizing: border-box;
}
.reader-lang-switch,
.reader-fs-switch {
  display: inline-flex; flex: none; gap: 0; border: 1px solid #d5cbb8;
  border-radius: 999px; overflow: hidden; background: #f7f2e8;
  align-items: center;
}
.reader-lang-switch.hidden,
.reader-fs-switch.hidden { display: none !important; }
.reader-lang-switch button,
.reader-fs-switch button {
  border: 0; background: transparent; color: #6a6256;
  padding: .28rem .55rem; font-size: .78rem; cursor: pointer; line-height: 1.2;
}
.reader-lang-switch button:hover,
.reader-fs-switch button:hover { background: rgba(90, 80, 60, .08); }
.reader-lang-switch button.active {
  background: #3d5c4a; color: #f7f5f0;
}
.reader-fs-label {
  min-width: 1.6rem; text-align: center; font-size: .72rem;
  color: #6a6256; font-variant-numeric: tabular-nums; padding: 0 .1rem;
  user-select: none;
}
.insights-bar-fill { transition: width .25s ease, background-color .25s ease; }
.paper-backdrop:has(+ .paper-drawer.reader-mode.open),
body:has(.paper-drawer.reader-mode.open) .paper-backdrop:not(.hidden) {
  z-index: 91;
  background: rgba(28, 24, 18, .42);
}
.reader-meta {
  font-size: .78rem; color: #8a8074; margin: 0 0 1.35rem; padding-bottom: .75rem;
  border-bottom: 1px solid #e5ddd0; text-align: center; letter-spacing: .02em;
}
.reader-article {
  --reader-fs: 18px;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  font-size: var(--reader-fs); line-height: 1.95; color: #2c2822;
  max-width: 72em; width: 100%; margin: 0 auto; box-sizing: border-box;
  overflow-wrap: break-word; word-break: break-word;
  text-align: justify; text-justify: inter-ideograph;
  hyphens: auto;
}
.reader-article h1, .reader-article h2, .reader-article h3 {
  font-family: inherit; font-weight: 600; color: #1f1c18; line-height: 1.4;
  margin: 1.6rem 0 .7rem; text-align: left;
}
.reader-article h1 { font-size: 1.42em; letter-spacing: .01em; }
.reader-article h2 { font-size: 1.22em; }
.reader-article h3 { font-size: 1.08em; }
.reader-article p { margin: .85em 0; }
.reader-article ul, .reader-article ol { margin: .65em 0 .65em 1.35em; }
.reader-article li { margin: .28em 0; }
.reader-article table {
  border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .88em;
  font-family: "IBM Plex Sans", "Noto Sans SC", sans-serif;
  text-align: left;
}
.reader-article th, .reader-article td {
  border: 1px solid #ddd4c6; padding: .4rem .55rem; vertical-align: top;
}
.reader-article blockquote {
  margin: 1em 0; padding: .4rem 1rem; border-left: 3px solid #c4b59a;
  color: #5a5348; background: #f3efe6;
}
.reader-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; background: #efe9de; padding: .05em .3em; border-radius: 4px;
}
.reader-article pre {
  overflow-x: auto; padding: .75rem 1rem; background: #ebe4d8; border-radius: 8px;
  font-size: .85em; line-height: 1.5; text-align: left;
}
.reader-article img { display: none; }
.reader-pre {
  white-space: pre-wrap; word-break: break-word; font-size: .9rem; line-height: 1.7;
}
@media (max-width: 720px) {
  .reader-ebook-shell {
    width: 100%; margin: 0; border-radius: 0; min-height: 100%;
    padding: 1.4rem 1.1rem 3rem;
    box-shadow: none;
  }
  .paper-drawer.reader-mode { background: #faf6ee; }
}
body.ebook-reading { overflow: hidden; }
body.ebook-reading .paper-drawer.reader-mode .paper-head {
  position: sticky; top: 0; z-index: 3;
}
.reader-progress {
  height: 3px; background: rgba(90, 70, 40, .12); flex: none; z-index: 2;
}
.reader-progress.hidden { display: none !important; }
.reader-progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #6a9b7a, #3d5c4a);
  transition: width .12s linear;
}
.reader-theme-switch {
  display: inline-flex; flex: none; gap: 0; border: 1px solid #d5cbb8;
  border-radius: 999px; overflow: hidden; background: #f7f2e8;
}
.reader-theme-switch.hidden { display: none !important; }
.reader-theme-switch button {
  border: 0; background: transparent; color: #6a6256;
  padding: .28rem .5rem; font-size: .78rem; cursor: pointer; line-height: 1.2;
}
.reader-theme-switch button:hover { background: rgba(90, 80, 60, .08); }
.reader-theme-switch button.active { background: #3d5c4a; color: #f7f5f0; }
.reader-find-btn {
  border: 1px solid #d5cbb8; background: #f7f2e8; color: #6a6256;
  border-radius: 999px; padding: .28rem .65rem; font-size: .78rem; cursor: pointer;
}
.reader-find-btn.hidden { display: none !important; }
.reader-findbar {
  display: flex; align-items: center; gap: .35rem; flex: none;
  padding: .4rem .75rem; background: rgba(250, 246, 238, .96);
  border-bottom: 1px solid rgba(180, 160, 130, .35); z-index: 2;
}
.reader-findbar.hidden { display: none !important; }
.reader-findbar input {
  flex: 1; min-width: 0; border: 1px solid #d5cbb8; border-radius: 8px;
  padding: .35rem .55rem; background: #fff; font-size: .85rem;
}
.reader-find-count { font-size: .75rem; color: #7a7268; min-width: 3.2rem; text-align: center; }
.reader-findbar button {
  border: 1px solid #d5cbb8; background: #f7f2e8; border-radius: 6px;
  padding: .25rem .45rem; cursor: pointer; color: #4a4338; font-size: .8rem;
}
.reader-article mark.reader-hit {
  background: rgba(255, 193, 7, .35); border-radius: 2px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.reader-article mark.reader-hit.current {
  background: rgba(255, 152, 0, .55); outline: 1px solid rgba(180, 100, 0, .35);
}
.reader-recent {
  margin: 0 0 1rem; padding: .65rem .75rem; border-radius: 10px;
  background: #f3efe6; border: 1px solid #e0d8cc;
}
.reader-recent h4 {
  margin: 0 0 .4rem; font-size: .82rem; font-weight: 600; color: #5a5348;
}
.reader-recent-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: .35rem 0; cursor: pointer; border-bottom: 1px dashed #e0d8cc;
}
.reader-recent-item:last-child { border-bottom: 0; }
.reader-recent-title { font-size: .86rem; color: #2a2824; }
.reader-recent-meta { font-size: .72rem; color: #8a8074; margin-top: .1rem; }
.reader-toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  z-index: 130; padding: .45rem .85rem; border-radius: 999px;
  background: rgba(35, 40, 36, .88); color: #f5f2ea; font-size: .82rem;
  pointer-events: none; opacity: 0; transition: opacity .2s ease;
}
.reader-toast.show { opacity: 1; }

/* 护眼 / 夜间 */
.paper-drawer.reader-mode.theme-eye {
  background: linear-gradient(180deg, #c5d4b8 0%, #b7c9a8 100%);
}
.paper-drawer.reader-mode.theme-eye .paper-head,
.paper-drawer.reader-mode.theme-eye .reader-findbar {
  background: rgba(232, 240, 222, .94);
}
.paper-drawer.reader-mode.theme-eye .reader-ebook-shell { background: #eef5e6; }
.paper-drawer.reader-mode.theme-eye .reader-article { color: #243028; }
.paper-drawer.reader-mode.theme-night {
  background: linear-gradient(180deg, #1a1d21 0%, #121418 100%);
}
.paper-drawer.reader-mode.theme-night .paper-head,
.paper-drawer.reader-mode.theme-night .reader-findbar {
  background: rgba(28, 32, 38, .94); border-bottom-color: #2e353e;
}
.paper-drawer.reader-mode.theme-night .paper-title { color: #d8dde4; }
.paper-drawer.reader-mode.theme-night .reader-ebook-shell {
  background: #1e2329; box-shadow: 0 18px 48px rgba(0,0,0,.35);
}
.paper-drawer.reader-mode.theme-night .reader-meta { color: #8b93a0; border-bottom-color: #2e353e; }
.paper-drawer.reader-mode.theme-night .reader-article { color: #d5dbe3; }
.paper-drawer.reader-mode.theme-night .reader-article h1,
.paper-drawer.reader-mode.theme-night .reader-article h2,
.paper-drawer.reader-mode.theme-night .reader-article h3 { color: #eef2f7; }
.paper-drawer.reader-mode.theme-night .reader-lang-switch,
.paper-drawer.reader-mode.theme-night .reader-fs-switch,
.paper-drawer.reader-mode.theme-night .reader-theme-switch,
.paper-drawer.reader-mode.theme-night .reader-find-btn {
  background: #2a313a; border-color: #3a4450; color: #c5ccd6;
}
.paper-drawer.reader-mode.theme-night .reader-lang-switch button,
.paper-drawer.reader-mode.theme-night .reader-fs-switch button,
.paper-drawer.reader-mode.theme-night .reader-theme-switch button { color: #c5ccd6; }
.paper-drawer.reader-mode.theme-night .reader-fs-label { color: #9aa3b0; }
.paper-drawer.reader-mode.theme-night .paper-close {
  background: #2a313a; border-color: #3a4450; color: #c5ccd6;
}
.paper-drawer.reader-mode.theme-night .reader-findbar input {
  background: #15191e; border-color: #3a4450; color: #d5dbe3;
}
.paper-drawer.reader-mode.theme-night .reader-findbar button {
  background: #2a313a; border-color: #3a4450; color: #c5ccd6;
}
.insights-drawer { width: min(640px, 96vw); }
.insights-sec { margin: 0 0 1.25rem; }
.insights-sec h3 {
  margin: 0 0 .55rem; font-size: .95rem; font-weight: 600; color: #274038;
}
.insights-meta { color: #5a6b63; font-size: .82rem; margin: 0 0 .75rem; line-height: 1.45; }
.insights-bars { display: grid; gap: .35rem; }
.insights-bar-row {
  display: grid; grid-template-columns: minmax(4.5rem, 7rem) 1fr auto;
  gap: .45rem; align-items: center; font-size: .82rem;
}
/* 研究单位：名称列约一半宽度，便于读完整中文名 */
.insights-bar-row.inst-row {
  grid-template-columns: minmax(0, 50%) minmax(3rem, 1fr) auto;
  align-items: start;
}
.insights-bar-name { color: #3a4a43; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insights-bar-track { height: .45rem; background: #e4ece7; border-radius: 99px; overflow: hidden; }
.insights-bar-fill { height: 100%; background: #5a8f74; border-radius: 99px; }
.insights-bar-n { color: #6a7a72; font-variant-numeric: tabular-nums; min-width: 2rem; text-align: right; }
.insights-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.insights-chip {
  padding: .2rem .45rem; border-radius: 6px; background: #eef4f0;
  border: 1px solid #d5e2db; font-size: .78rem; color: #3d5349;
}
.pi-list { display: grid; gap: .65rem; }
.pi-card {
  padding: .65rem .75rem; border: 1px solid #d7e3dc; border-radius: 10px;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 50%) minmax(0, 1fr);
  gap: .35rem .75rem; align-items: start;
}
.pi-card .pi-name {
  font-weight: 600; color: #243832; font-size: .92rem;
  grid-column: 1; word-break: break-word; line-height: 1.35;
}
.pi-card .pi-tags { margin: .28rem 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.pi-tag {
  font-size: .72rem; padding: .12rem .4rem; border-radius: 999px;
  background: #e8f3ec; color: #2f6b4f; border: 1px solid #cfe3d6;
}
.pi-tag.warn { background: #fff6e8; color: #8a5a12; border-color: #edd9b0; }
.pi-card .pi-inst {
  margin: 0; font-size: .8rem; color: #3d5349; line-height: 1.4;
  grid-column: 2; word-break: break-word;
}
.pi-card .pi-metrics, .pi-card .pi-reason {
  margin: .15rem 0 0; font-size: .78rem; color: #5a6b63; line-height: 1.4;
  grid-column: 1 / -1;
}
.insights-actions { display: flex; gap: .5rem; margin: 0 0 1rem; flex-wrap: wrap; }
.insights-actions button {
  padding: .35rem .7rem; border-radius: 8px; border: 1px solid #c5d6cc;
  background: #f5f8f5; color: #2a4a3c; font-size: .82rem; cursor: pointer;
}
.reader-note-tools {
  display: inline-flex; flex: none; gap: .25rem; align-items: center;
}
.reader-note-tools.hidden { display: none !important; }
.note-pen {
  width: 1.7rem; height: 1.7rem; border-radius: 999px; border: 1px solid transparent;
  font-size: .72rem; font-weight: 600; cursor: pointer; line-height: 1; color: #1f2a24;
}
.note-pen.mint { background: #7dcea0; border-color: #5dad7f; min-width: 2.6rem; padding: 0 .35rem; width: auto; border-radius: 999px; }
.note-pen.clear { background: #ece7de; border-color: #d5cbb8; color: #6a6256; min-width: 1.7rem; }
.note-pen:hover { filter: brightness(.96); transform: translateY(-1px); }
.btn-meta-online {
  float: right; margin-top: -.15rem; border: 1px solid #c5d6cc; background: #eef6f0;
  color: #2a4a3c; border-radius: 999px; padding: .2rem .65rem; font-size: .76rem; cursor: pointer;
}
.btn-meta-online:hover { background: #e0efe6; }
.btn-meta-online:disabled { opacity: .6; cursor: wait; }
.meta-online-badge {
  display: inline-block; margin-left: .35rem; padding: .05rem .4rem; border-radius: 999px;
  background: #d8f3e4; color: #2f6b4f; font-size: .72rem; font-weight: 500;
}
.note-float {
  position: fixed; z-index: 120; display: flex; gap: .3rem;
  padding: .28rem .35rem; border-radius: 999px; background: #fff;
  border: 1px solid #d8d0c4; box-shadow: 0 8px 24px rgba(40,40,30,.14);
}
.note-float.hidden { display: none !important; }
.reader-article mark.note-hl {
  padding: .05em .12em; border-radius: 3px; cursor: pointer;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.reader-article mark.note-hl.mint { background: rgba(125, 206, 160, .45); }
.reader-article mark.note-hl.sky { background: rgba(127, 179, 213, .45); }
.reader-article mark.note-hl.coral { background: rgba(229, 152, 155, .45); }
.reader-article mark.note-hl.active-note {
  outline: 2px solid rgba(60, 80, 70, .35); outline-offset: 1px;
}
.note-card {
  border: 1px solid #d7e3dc; border-radius: 10px; background: #fff;
  padding: .65rem .75rem; margin: 0 0 .55rem;
}
.note-card .note-quote {
  margin: .2rem 0; font-size: .88rem; line-height: 1.45; color: #2a2824;
  border-left: 3px solid #bbb; padding-left: .55rem;
}
.note-card .note-quote.mint { border-left-color: #7dcea0; }
.note-card .note-quote.sky { border-left-color: #7fb3d5; }
.note-card .note-quote.coral { border-left-color: #e5989b; }
.note-card .note-memo { margin: .25rem 0 0; font-size: .8rem; color: #5a6b63; }
.note-card .note-meta {
  display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
  font-size: .72rem; color: #7a8a82; margin-bottom: .2rem;
}
.note-chip {
  display: inline-block; padding: .08rem .4rem; border-radius: 999px;
  font-size: .7rem; color: #1f2a24;
}
.note-chip.mint { background: #d8f3e4; }
.note-chip.sky { background: #d6eaf8; }
.note-chip.coral { background: #fadbd8; }
.note-card-actions { display: flex; gap: .4rem; margin-top: .45rem; }
.note-card-actions button {
  border: 1px solid #c5d6cc; background: #f5f8f5; border-radius: 6px;
  padding: .2rem .45rem; font-size: .75rem; cursor: pointer; color: #2a4a3c;
}
.note-group-title {
  margin: 1rem 0 .4rem; font-size: .92rem; font-weight: 600; color: #274038;
}
.note-group-title:first-child { margin-top: 0; }
.note-empty { color: #5a6b63; font-size: .85rem; }

@media (max-width: 900px) {
  .app-page { grid-template-columns: 1fr; }
  .app-page.side-collapsed { grid-template-columns: 1fr; }
  .btn-open-side { display: grid; place-items: center; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw);
    z-index: 30; transform: translateX(-105%); transition: transform .2s ease;
    pointer-events: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .side-scrim:not(.hidden) { display: block; }
  .menu-backdrop.sidebar-only { width: min(300px, 86vw); }
}
