/* ============================================================
   复盘 → 笔记库 + 笔记编辑页（2026-11-08）
   视觉依据 docs/review-reference（白灰石墨 + 轻玻璃文件夹）。
   颜色全部从主题变量派生：日间 / 夜间、各配色都能用；文件夹自己的玻璃色分日 / 夜两套。
   ============================================================ */
.rvLib, .rvEditor, #rvLayer {
  --rvInk: var(--text);
  --rvMuted: var(--muted);
  --rvFaint: var(--mutedDark);
  --rvLine: var(--border);
  --rvCard: var(--surface);
  --rvCard2: var(--surface2);
  --rvPrimary: color-mix(in srgb, var(--text) 86%, var(--bg));
  --rvOnPrimary: var(--bg);
  --rvShadow: 0 2px 4px color-mix(in srgb, #000 6%, transparent), 0 8px 20px color-mix(in srgb, #000 3%, transparent);
  --rvShadowHover: 0 7px 20px color-mix(in srgb, #000 12%, transparent);
  --rvEase: cubic-bezier(.22,.76,.28,1);
}
.rvIcon { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- 按钮 ---------- */
.rvBtn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 7px 13px;
  border: 1px solid var(--rvLine); border-radius: 11px; background: var(--rvCard); color: var(--rvMuted);
  font: 500 12.5px var(--fontUI); white-space: nowrap; cursor: pointer; box-shadow: 0 1px 3px color-mix(in srgb, #000 6%, transparent);
  transition: border-color .15s, color .15s, background .15s, opacity .15s; }
.rvBtn:hover { border-color: var(--borderLight); color: var(--rvInk); }
.rvBtn .rvIcon { width: 14px; height: 14px; }
.rvBtn.primary { background: var(--rvPrimary); border-color: var(--rvPrimary); color: var(--rvOnPrimary); }
.rvBtn.primary:hover { opacity: .88; color: var(--rvOnPrimary); }
.rvBtn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--rvLine)); }
.rvBtn.danger:hover { background: var(--negSoft); color: var(--neg); }
.rvBtn:disabled { opacity: .55; cursor: default; }
.rvBtn:focus-visible, .rvLib button:focus-visible, .rvEditor button:focus-visible, #rvLayer button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

/* ---------- 页头 ---------- */
.rvHead { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; padding: 2px 0 22px; }
.rvEyebrow { margin: 0 0 6px; font: 500 11px var(--fontMono); letter-spacing: 1.6px; color: var(--rvFaint); }
.rvTagline { margin: 0; font-size: 13px; color: var(--rvMuted); }
.rvHeadActions { display: flex; gap: 9px; }

/* ---------- 文件夹 ---------- */
.rvSectionHead { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.rvSectionHead h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; color: var(--rvInk); }
.rvSectionHead h2 span { font-size: 11px; font-weight: 400; color: var(--rvFaint); border: 1px solid var(--rvLine); border-radius: 5px; padding: 0 5px; }
.rvSectionAside { font-size: 11.5px; color: var(--rvFaint); }
.rvFolders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 10px; margin: 0 -4px 22px; }

.rvFolder {
  /* 夜间默认 */
  --fInk: var(--text); --fMuted: var(--muted);
  --fBase: #3b4347; --fLight: #59636a; --fShadow: #22282b;
  --fPaper: color-mix(in srgb, var(--surface2) 80%, #fff 8%); --fPaperEdge: color-mix(in srgb, var(--border) 80%, transparent);
  --fPaperLine: color-mix(in srgb, var(--borderLight) 70%, transparent);
  --fFront1: rgba(255,255,255,.06); --fFront2: rgba(40,46,52,.62); --fFront3: rgba(30,35,40,.92);
  --fHi: rgba(255,255,255,.18);
  --angle: 0deg;
  position: relative; display: block; box-sizing: border-box; height: 222px; min-width: 0; isolation: isolate; color: var(--fInk);
  -webkit-tap-highlight-color: transparent;
}
.rvFolder--sage { --fBase: #3a463e; --fLight: #59695d; --fShadow: #222b25; }
.rvFolder--graphite { --fBase: #343a40; --fLight: #4d555c; --fShadow: #1d2125; }
.rvFolder--empty { --fBase: #34383a; --fLight: #45494b; --fShadow: #26292a; }
:root[data-theme="light"] .rvFolder {
  --fInk: #303336; --fMuted: #767c7c;
  --fBase: #c5ccce; --fLight: #f3f5f5; --fShadow: #8e999e;
  --fPaper: linear-gradient(170deg, #fff 20%, #f3f5f4 100%); --fPaperEdge: rgba(122,132,134,.18); --fPaperLine: #e3e8e5;
  --fFront1: rgba(255,255,255,.19); --fFront2: rgba(250,253,252,.60); --fFront3: rgba(248,250,249,.96);
  --fHi: rgba(255,255,255,.9);
}
:root[data-theme="light"] .rvFolder--sage { --fBase: #b6c6bb; --fLight: #f1f6f1; --fShadow: #9bad9c; }
:root[data-theme="light"] .rvFolder--graphite { --fBase: #8d999f; --fLight: #e9edef; --fShadow: #646f78; }
:root[data-theme="light"] .rvFolder--empty { --fBase: #d7d9d6; --fLight: #f8f8f4; --fShadow: #bbbfbc; }

.rvFolderStage { position: absolute; top: 54px; left: 12px; right: 12px; height: 142px; perspective: 850px; }
.rvFolderShadow { position: absolute; left: 12%; right: 12%; bottom: -4px; height: 30px; background: rgba(20,26,28,.22);
  border-radius: 50%; filter: blur(12px); transform: scaleX(.94); transition: opacity .35s, transform .4s var(--rvEase); }
.rvFolderBack { position: absolute; inset: 0; overflow: hidden; border-radius: 13px 13px 16px 16px;
  clip-path: polygon(0 19%, 40% 19%, 42% 18%, 49% 2%, 52% 0, 100% 0, 100% 100%, 0 100%);
  background: var(--fBase); box-shadow: inset 0 1px 0 var(--fHi); }
.rvFolderLiquid { position: absolute; inset: -4px;
  background:
    radial-gradient(ellipse 105% 56% at 3% 2%, var(--fLight) 14%, transparent 54%),
    radial-gradient(ellipse 95% 25% at 78% 30%, color-mix(in srgb, var(--fLight) 70%, transparent) 1%, transparent 43%),
    radial-gradient(ellipse 70% 80% at 81% 70%, var(--fLight), transparent 80%),
    linear-gradient(125deg, var(--fShadow), var(--fBase) 42%, var(--fLight) 56%, var(--fShadow) 100%);
  transform: scale(1.08) rotate(-2deg); transition: transform .55s var(--rvEase); }
.rvFolderGrain { position: absolute; inset: 0; opacity: .16; pointer-events: none; mix-blend-mode: soft-light;
  background: repeating-linear-gradient(113deg, rgba(255,255,255,.5) 0 .6px, transparent .7px 3px); }
.rvPapers { position: absolute; z-index: 2; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; clip-path: inset(-54px -4px 6px -4px); }
.rvPaperSlot { display: contents; }
.rvPaper, .rvPaperEmpty { appearance: none; box-sizing: border-box; position: absolute; top: 32px; left: 8%; width: 84%; height: 112px; padding: 0;
  border: 1px solid var(--fPaperEdge); border-radius: 7px; color: var(--fInk); background: var(--fPaper);
  box-shadow: 0 3px 9px rgba(20,30,32,.14); font: inherit; text-align: left; cursor: pointer;
  transform-origin: 50% 100%;
  transform: translate(calc(var(--paper-slot, 0) * 2px), calc(7px - var(--paper-depth, 0) * 7px)) rotate(calc(var(--paper-slot, 0) * .8deg));
  transition: transform .48s var(--rvEase), box-shadow .3s; transition-delay: calc(var(--paper-index, 0) * 25ms); }
.rvPaper { z-index: calc(2 + var(--paper-index)); }
.rvPaperHead { position: absolute; top: 7px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: baseline; line-height: 16px; }
.rvPaperTitle { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; font-weight: 600; }
.rvPaperMeta { flex-shrink: 0; margin-left: auto; font-size: 10.5px; color: var(--fMuted); font-family: var(--fontMono); }
.rvPaperLines { position: absolute; top: 35px; left: 11px; right: 11px; display: flex; flex-direction: column; gap: 7px; }
.rvPaperLines i { height: 3px; width: 88%; border-radius: 3px; background: var(--fPaperLine); }
.rvPaperLines i:nth-child(2) { width: 97%; } .rvPaperLines i:nth-child(3) { width: 63%; } .rvPaperLines i:nth-child(4) { width: 78%; }
.rvPaperEmpty { border-style: dashed; box-shadow: none; cursor: default; opacity: .75; }
.rvPaperEmptyCap { position: absolute; left: 10px; top: 8px; font-size: 11px; color: var(--fMuted); }
.rvFolderFront { position: absolute; z-index: 4; left: 0; right: 0; top: 36px; height: 106px; overflow: hidden; border-radius: 13px 13px 16px 16px;
  clip-path: polygon(0 0, 35% 0, 38% 2%, 45% 15%, 48% 17%, 100% 17%, 100% 100%, 0 100%);
  background: linear-gradient(174deg, var(--fFront1), var(--fFront2) 40%, var(--fFront3));
  -webkit-backdrop-filter: blur(12px) saturate(.8); backdrop-filter: blur(12px) saturate(.8);
  box-shadow: inset 0 1px 0 var(--fHi), inset 1px 0 0 color-mix(in srgb, var(--fHi) 70%, transparent), inset 0 -1px 0 rgba(126,139,140,.15);
  transform-origin: 50% 100%; transform: perspective(650px) rotateX(var(--angle)); transition: transform .48s var(--rvEase); }
.rvFolderFront::before { content: ""; position: absolute; z-index: 1; top: 17%; left: 48%; right: 7px; height: 1px; background: var(--fHi); }
.rvFolderGlare { position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background: linear-gradient(116deg, transparent 20%, color-mix(in srgb, var(--fHi) 50%, transparent) 36%, transparent 50%); }
.rvFolderToggle { appearance: none; position: absolute; inset: 0; width: 100%; margin: 0; padding: 0; border: 0; border-radius: inherit;
  background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rvFolderLabel { position: absolute; left: 17px; bottom: 18px; right: 52px; display: flex; flex-direction: column; gap: 7px; }
.rvFolderTitle { font-size: 16px; font-weight: 600; letter-spacing: -.3px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rvFolderCount { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 11px; color: var(--fMuted); line-height: 1.3; }
.rvFolderCurrent { padding-left: 8px; border-left: 1px solid var(--fPaperEdge); color: var(--fInk); opacity: .75; }
.rvFolderMore { appearance: none; position: absolute; z-index: 6; right: 13px; bottom: 17px; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--fHi); background: color-mix(in srgb, var(--rvCard) 80%, transparent); color: var(--fInk);
  cursor: pointer; box-shadow: 0 2px 5px rgba(20,30,28,.1); transition: transform .2s, background .2s; }
.rvFolderMore:hover { transform: translateY(-2px); background: var(--rvCard); }
.rvFolderUpdated { position: absolute; left: 15px; right: 15px; bottom: 0; margin: 0; text-align: center; font-size: 11px; line-height: 15px;
  color: var(--rvFaint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rvFolderAdd { position: absolute; left: 14%; right: 14%; top: -7px; z-index: 3; appearance: none; padding: 7px 8px; border: 1px solid var(--rvLine);
  border-radius: 7px; background: var(--rvCard); color: var(--rvMuted); font: inherit; font-size: 11px; cursor: pointer; }
.rvFolder:focus-within { --angle: -10deg; }
.rvFolder:focus-within .rvPaper { transform: translate(calc(var(--paper-slot) * 4px), calc(-5px - var(--paper-depth) * 8px)) rotate(calc(var(--paper-slot) * 1.5deg)); }
@media (hover: hover) {
  .rvFolder:hover { --angle: -10deg; }
  .rvFolder:hover .rvPaper { transform: translate(calc(var(--paper-slot) * 4px), calc(-5px - var(--paper-depth) * 8px)) rotate(calc(var(--paper-slot) * 1.5deg)); }
  .rvFolder:hover .rvFolderLiquid { transform: scale(1.12) rotate(0deg); }
  .rvFolder:hover .rvFolderShadow { transform: scaleX(1); opacity: .8; }
}
.rvFolder.isOpen { --angle: -22deg; }
.rvFolder.isOpen .rvPaper { pointer-events: auto; transform: translate(calc(var(--paper-slot) * 7px), calc(-70px + var(--paper-index) * 24px)) rotate(calc(var(--paper-slot) * 2.5deg)); }
.rvFolder.isOpen .rvPaperEmpty { transform: translateY(-32px) rotate(-2deg); }
.rvFolder.isOpen .rvPaper:hover, .rvFolder.isOpen .rvPaper:focus-visible {
  transform: translate(calc(var(--paper-slot) * 7px), calc(-74px + var(--paper-index) * 24px)) rotate(calc(var(--paper-slot) * 1.5deg)); box-shadow: 0 5px 12px rgba(20,30,28,.2); }
.rvFolder.isSelected .rvFolderTitle { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
/* 拖笔记进来 */
.rvFolder.dragOverTarget .rvFolderFront { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); }
.rvFolder.dragOverTarget { --angle: -16deg; }
@media (prefers-reduced-motion: reduce) { .rvFolder *, .rvFolder *::before { transition: none !important; } }

/* ---------- 笔记区 ---------- */
.rvLibTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--rvLine); }
.rvScopes { display: flex; align-items: center; gap: 6px; }
.rvScopes button { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--rvMuted); font: 12px var(--fontUI); cursor: pointer; white-space: nowrap; }
.rvScopes button .rvIcon { width: 12px; height: 12px; }
.rvScopes button span { color: var(--rvFaint); font-size: 11px; }
.rvScopes button:hover { color: var(--rvInk); }
.rvScopes button[aria-pressed="true"] { color: var(--rvInk); background: var(--rvCard); border-color: var(--rvLine); box-shadow: 0 1px 3px color-mix(in srgb, #000 5%, transparent); }
.rvViewControls { display: flex; gap: 12px; align-items: center; }
.rvSort { display: flex; align-items: center; gap: 5px; color: var(--rvFaint); }
.rvSort .rvIcon { width: 13px; height: 13px; }
.rvSort select { font: 12px var(--fontUI); color: var(--rvMuted); padding: 5px 2px; border: 0; background: transparent; cursor: pointer; }
.rvSort select option { background: var(--rvCard); color: var(--rvInk); }
.rvViewSwitch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--rvLine); border-radius: 9px; background: var(--rvCard2); }
.rvViewSwitch button { width: 28px; height: 25px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--rvFaint); cursor: pointer; }
.rvViewSwitch button .rvIcon { width: 13px; height: 13px; }
.rvViewSwitch button[aria-pressed="true"] { color: var(--rvInk); background: var(--rvCard); box-shadow: 0 1px 4px color-mix(in srgb, #000 10%, transparent); }
.rvLibFilter { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 16px; }
.rvResultHead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rvResultHead h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.3px; color: var(--rvInk); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.rvResultHead > span { font-size: 11.5px; color: var(--rvFaint); white-space: nowrap; }
.rvClearFolder { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--rvCard2); color: var(--rvMuted); cursor: pointer; flex-shrink: 0; }
.rvClearFolder .rvIcon { width: 10px; height: 10px; }
.rvSearch { display: flex; align-items: center; gap: 8px; width: 280px; max-width: 45%; padding: 7px 10px; background: var(--rvCard); border: 1px solid var(--rvLine); border-radius: 9px; color: var(--rvFaint); }
.rvSearch:focus-within { border-color: var(--borderLight); }
.rvSearch .rvIcon { width: 13px; height: 13px; }
.rvSearch input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--rvInk); font: 12.5px var(--fontUI); }
.rvSearch input::-webkit-search-cancel-button { opacity: .5; }
.rvSearchHint { font-size: 11px; white-space: nowrap; border-left: 1px solid var(--rvLine); padding-left: 8px; }

.rvNoteGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 13px; }
.rvNote { position: relative; min-width: 0; display: flex; flex-direction: column; padding: 16px 15px 0; background: var(--rvCard);
  border: 1px solid var(--rvLine); border-radius: 13px; box-shadow: var(--rvShadow); transition: transform .2s, box-shadow .2s, border-color .2s, opacity .2s; }
.rvNote:hover { transform: translateY(-3px); border-color: var(--borderLight); box-shadow: var(--rvShadowHover); }
.rvNote.isDragging { opacity: .4; }
.rvNoteTop { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; min-width: 0; font-size: 11.5px; color: var(--rvFaint); }
.rvNoteFile { width: 25px; height: 28px; display: grid; place-items: center; flex-shrink: 0; border: 1px solid var(--rvLine); border-radius: 5px; background: var(--rvCard2); color: var(--rvMuted); }
.rvNoteFile .rvIcon { width: 14px; height: 14px; stroke-width: 1.4; }
.rvNoteGroup { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rvNotePin, .rvNoteMore { display: grid; place-items: center; padding: 3px; border: 0; border-radius: 5px; background: transparent; color: var(--rvFaint); cursor: pointer; flex-shrink: 0; }
.rvNotePin { margin-left: auto; }
.rvNotePin .rvIcon { width: 12px; height: 12px; }
.rvNoteMore { margin-left: auto; }
.rvNotePin + .rvNoteMore { margin-left: 0; }
.rvNoteMore:hover, .rvNotePin:hover { background: var(--rvCard2); color: var(--rvInk); }
.rvNoteOpen { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.rvNoteTitle { margin: 0 0 8px; font-size: 16px; line-height: 1.45; font-weight: 600; letter-spacing: -.3px; color: var(--rvInk);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.rvNoteExcerpt { margin: 0 0 14px; min-height: 42px; font-size: 12px; line-height: 1.8; color: var(--rvMuted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.rvNoteTags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; margin: auto 0 14px; }
.rvNoteTag { padding: 2px 6px; border-radius: 4px; background: var(--rvCard2); color: var(--rvMuted); font-size: 11px; line-height: 1.5; }
.rvNoteTag::before { content: "#"; margin-right: 3px; color: var(--rvFaint); }
.rvNoteTag.more::before { content: none; }
.rvNoteFoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 40px; padding: 10px 0; border-top: 1px solid var(--rvLine);
  font-size: 11px; color: var(--rvFaint); }
.rvNoteDate, .rvNoteRel, .rvNoteLinked { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.rvNoteRel { gap: 10px; min-width: 0; overflow: hidden; }
.rvNoteFoot .rvIcon { width: 11px; height: 11px; }
/* 列表视图：一行一篇 */
.rvNoteGrid.isList { grid-template-columns: 1fr; gap: 6px; }
.rvNoteGrid.isList .rvNote { flex-direction: row; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 10px; }
.rvNoteGrid.isList .rvNote:hover { transform: none; }
.rvNoteGrid.isList .rvNoteTop { order: 4; margin: 0; flex-shrink: 0; width: 150px; }
.rvNoteGrid.isList .rvNoteTop .rvNoteFile { display: none; }
.rvNoteGrid.isList .rvNoteOpen { order: 1; flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.rvNoteGrid.isList .rvNoteTitle { margin: 0; font-size: 14px; -webkit-line-clamp: 1; flex-shrink: 0; max-width: 45%; }
.rvNoteGrid.isList .rvNoteExcerpt { margin: 0; min-height: 0; -webkit-line-clamp: 1; font-size: 12px; }
.rvNoteGrid.isList .rvNoteTags { order: 2; margin: 0; min-height: 0; flex-wrap: nowrap; max-width: 180px; overflow: hidden; }
.rvNoteGrid.isList .rvNoteFoot { order: 3; border: 0; padding: 0; min-height: 0; gap: 12px; }
.rvEmpty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; padding: 32px;
  border: 1px dashed var(--borderLight); border-radius: 12px; text-align: center; color: var(--rvFaint); }
.rvEmpty > .rvIcon { width: 30px; height: 30px; margin-bottom: 14px; stroke-width: 1.2; }
.rvEmpty h3 { margin: 0 0 7px; font-size: 16px; font-weight: 600; color: var(--rvMuted); }
.rvEmpty p { margin: 0 0 17px; font-size: 12.5px; }
.rvLibFoot { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 11.5px; color: var(--rvFaint); }
.rvLibFoot > span:last-child { display: flex; align-items: center; gap: 5px; }
.rvLibFoot .rvIcon { width: 11px; height: 11px; }

/* ---------- 菜单 / 对话框 / 提示（#rvLayer，盖在一切上面） ---------- */
#rvLayer { position: relative; z-index: 300; }
.rvMenu { position: fixed; z-index: 310; min-width: 190px; padding: 5px; border: 1px solid var(--rvLine); border-radius: 11px; background: var(--rvCard);
  box-shadow: var(--shadowPop); }
.rvMenuCaption { max-width: 230px; padding: 7px 9px; margin-bottom: 4px; border-bottom: 1px solid var(--rvLine); font-size: 11.5px; color: var(--rvFaint);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rvMenu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; border-radius: 7px; background: transparent;
  color: var(--rvInk); font: 13px var(--fontUI); text-align: left; cursor: pointer; }
.rvMenu button .rvIcon { width: 15px; height: 15px; color: var(--rvFaint); }
.rvMenu button:hover, .rvMenu button:focus-visible { background: var(--rvCard2); outline: none; }
.rvMenu button.danger, .rvMenu button.danger .rvIcon { color: var(--neg); }
.rvMenuSep { border-top: 1px solid var(--rvLine); margin: 4px; }
.rvDialogLayer { position: fixed; inset: 0; z-index: 320; display: flex; align-items: flex-start; justify-content: center; padding: 14vh 16px 24px;
  background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.rvDialog { width: 400px; max-width: 100%; padding: 24px; background: var(--rvCard); border: 1px solid var(--rvLine); border-radius: 17px; box-shadow: var(--shadowModal); color: var(--rvInk); }
.rvDialog h2 { margin: 0 0 9px; font-size: 19px; font-weight: 600; letter-spacing: -.4px; }
.rvDialog p { margin: 0 0 18px; font-size: 13px; line-height: 1.8; color: var(--rvMuted); }
.rvDialog label { display: block; margin: 0 0 8px; font-size: 12px; color: var(--rvMuted); }
.rvDialog select { width: 100%; }
.rvDialogError, .rvFieldError { margin: 10px 0 0 !important; font-size: 12px !important; color: var(--neg) !important; }
.rvDialogActions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.rvToast { position: fixed; z-index: 330; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 10px; background: var(--rvPrimary); color: var(--rvOnPrimary); font-size: 13px; box-shadow: var(--shadowPop); }
.rvToast .rvIcon { width: 14px; height: 14px; }
.rvToast button { padding: 0 0 0 10px; border: 0; border-left: 1px solid color-mix(in srgb, var(--rvOnPrimary) 35%, transparent); background: transparent;
  color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* ============================================================
   编辑页
   ============================================================ */
.rvTopBar { height: 54px; padding: 0 18px; }
.rvCrumbs { gap: 6px; }
.rvCrumbBack { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--rvMuted);
  font: 13px var(--fontUI); cursor: pointer; }
.rvCrumbBack:hover { background: var(--rvCard2); color: var(--rvInk); }
.rvCrumbBack .rvIcon { width: 15px; height: 15px; }
.rvCrumbGroup { color: var(--rvMuted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rvFocusBtn .rvIcon { width: 16px; height: 16px; }
.rvSaveBtn { min-height: 32px; padding: 6px 13px; }
.rvSaveBtn.isClean { opacity: .7; }

.rvEditorBody { display: grid; grid-template-columns: minmax(0, 1fr) 290px; max-width: 1180px; margin: 0 auto; }
.rvEditor.isFocus .rvEditorBody { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.rvEditor.isFocus .rvSide { display: none; }
.rvDocCol { max-width: 780px; width: 100%; margin: 0 auto; padding: 42px 40px 0; box-sizing: border-box; }
.rvDocEyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 500 10.5px var(--fontMono); letter-spacing: 2px; color: var(--rvFaint); }
.rvDocEyebrow::before { content: ""; width: 26px; height: 1px; background: var(--rvLine); }
.rvTitle { font-family: var(--fontBody) !important; font-size: 32px !important; letter-spacing: -.5px; }

.rvPeriodRow { gap: 10px; margin: 16px 0 14px; padding-bottom: 16px; }
.rvPeriodLabel { font-size: 12px; color: var(--rvFaint); }
.rvPeriodSeg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--rvCard2); border: 1px solid var(--rvLine); }
.rvPeriodSeg button, .rvPeriodQuick button { padding: 4px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--rvMuted); font: 12px var(--fontUI); cursor: pointer; }
.rvPeriodSeg button:hover, .rvPeriodQuick button:hover { color: var(--rvInk); }
.rvPeriodSeg button.on { background: var(--rvCard); color: var(--rvInk); font-weight: 600; box-shadow: 0 1px 3px color-mix(in srgb, #000 10%, transparent); }
.rvPeriodQuick { display: inline-flex; gap: 4px; }
.rvPeriodQuick button { border: 1px solid var(--rvLine); border-radius: 999px; padding: 3px 11px; }
.rvPeriodQuick button.on { border-color: var(--rvInk); color: var(--rvInk); }
.rvPeriodDate { width: auto; padding: 4px 8px; font-size: 12px; }
.rvPeriodRange { font-size: 12px; color: var(--rvMuted); font-family: var(--fontMono); }
.rvPeriodClear { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--rvFaint); cursor: pointer; }
.rvPeriodClear:hover { background: var(--rvCard2); color: var(--rvInk); }
.rvPeriodClear .rvIcon { width: 12px; height: 12px; }
.rvPeriodNeed { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--neg); }
.rvPeriodNeed .rvIcon { width: 13px; height: 13px; }

.rvToolbar { position: sticky; top: 54px; z-index: 3; display: flex; align-items: center; gap: 2px; margin: 0 -8px 18px; padding: 6px 8px;
  border-radius: 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.rvTbInsert { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 0; border-radius: 7px; background: transparent;
  color: var(--rvMuted); font: 12.5px var(--fontUI); cursor: pointer; }
.rvTbInsert .rvIcon { width: 14px; height: 14px; }
.rvTbBtn { display: grid; place-items: center; width: 30px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--rvMuted); cursor: pointer; }
.rvTbBtn svg { width: 15px; height: 15px; }
.rvTbInsert:hover, .rvTbBtn:hover { background: var(--rvCard2); color: var(--rvInk); }
.rvTbSep { width: 1px; height: 16px; margin: 0 6px; background: var(--rvLine); }
.rvTbHint { margin-left: auto; font-size: 11px; color: var(--rvFaint); white-space: nowrap; }

.rvConflict { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; margin: 0 0 22px; padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--neg) 40%, var(--rvLine)); border-radius: 12px; background: var(--negSoft); color: var(--rvInk); }
.rvConflict > .rvIcon { color: var(--neg); margin-top: 2px; }
.rvConflict > div:first-of-type { flex: 1; min-width: 200px; }
.rvConflict b { font-size: 13.5px; }
.rvConflict p { margin: 4px 0 0; font-size: 12.5px; color: var(--rvMuted); }
.rvConflictActions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; justify-content: flex-end; }

/* 右栏 */
.rvSide { position: sticky; top: 54px; align-self: start; max-height: calc(100vh - 54px); overflow-y: auto; box-sizing: border-box;
  padding: 34px 22px 80px; border-left: 1px solid var(--rvLine); scrollbar-width: thin; }
.rvSideSec { padding: 0 0 20px; margin: 0 0 20px; border-bottom: 1px solid var(--rvLine); }
.rvSideSec:last-child { border-bottom: 0; }
.rvSideSec h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 12.5px; font-weight: 600; color: var(--rvInk); }
.rvSideSec h3 span { font-size: 11px; font-weight: 400; color: var(--rvFaint); }
.rvSideH3Gap { margin-top: 22px !important; }
.rvSideLabel { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font-size: 11.5px; color: var(--rvFaint); }
.rvSideLabel .rvIcon { width: 13px; height: 13px; }
.rvSideSelect, .rvSideInput { width: 100%; box-sizing: border-box; font-size: 13px; }
.rvSideEmpty { margin: 0 0 10px; font-size: 12px; line-height: 1.6; color: var(--rvFaint); }
.rvSideAdd { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border: 1px dashed var(--borderLight); border-radius: 9px;
  background: transparent; color: var(--rvMuted); font: 12.5px var(--fontUI); cursor: pointer; }
.rvSideAdd:hover { border-style: solid; color: var(--rvInk); background: var(--rvCard2); }
.rvSideAdd .rvIcon { width: 13px; height: 13px; }
.rvRefRow { display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0; margin: 0 0 6px; padding: 5px 6px; border: 0; border-radius: 7px;
  background: transparent; color: var(--rvInk); font: 12.5px var(--fontUI); text-align: left; cursor: pointer; }
button.rvRefRow:hover { background: var(--rvCard2); }
.rvRefTrade { padding: 0; cursor: default; }
.rvRefTrade .tradeRef { max-width: 100%; }
.rvRefRow.isMissing { color: var(--neg); cursor: default; font-size: 12px; }
.rvRefRow.isMissing .rvIcon { width: 13px; height: 13px; }
.rvRefTitle { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reviewOutline.inSide { position: static; display: block; width: auto; max-height: none; }
.reviewOutline.inSide .outlineList { max-height: 40vh; }

/* 链接页面选择器的分类 */
.pagePickerKinds { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 14px 10px; }
.pagePickerKinds button { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted);
  font: 12px var(--fontUI); cursor: pointer; }
.pagePickerKinds button:hover { color: var(--text); }
.pagePickerKinds button[aria-pressed="true"] { border-color: var(--text); color: var(--text); background: var(--surface2); }
.pageRefKind.kind-review { background: var(--muted); }

/* ---------- 窄屏 ---------- */
@media (max-width: 1080px) {
  .rvEditorBody { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
  .rvSide { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--rvLine); padding: 26px 40px 120px; }
  .rvEditor:not(.isFocus) .reviewDocTail { height: 12vh; }
}
@media (max-width: 720px) {
  .rvHead { flex-direction: column; align-items: stretch; }
  .rvHeadActions { justify-content: flex-start; }
  .rvSectionAside, .rvSearchHint, .rvTbHint, .rvLibFoot > span:last-child { display: none; }
  .rvFolders { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .rvLibTop { flex-wrap: wrap; }
  .rvViewControls { margin-left: auto; }
  .rvLibFilter { flex-wrap: wrap; }
  .rvSearch { width: 100%; max-width: 100%; }
  .rvSearch input { font-size: 16px; }
  .rvNoteGrid { grid-template-columns: 1fr; }
  .rvNoteGrid.isList .rvNoteTop, .rvNoteGrid.isList .rvNoteTags, .rvNoteGrid.isList .rvNoteExcerpt { display: none; }
  .rvNoteGrid.isList .rvNoteTitle { max-width: none; }
  .rvDocCol { padding: 26px 16px 0; }
  .rvSide { padding: 22px 16px 120px; }
  .rvTitle { font-size: 26px !important; }
  .rvTopBar { padding: 0 8px; }
  .rvCrumbGroup { max-width: 34vw; }
}
@media (max-width: 460px) {
  .rvFolders { grid-template-columns: 1fr; }
}
