/* ResearchHUB — manuscript review: comments sidebar, floating toolbar, tracked changes (researchhub-review-threads.js) */
::highlight(rv-open) { background-color: #ffe58f; color: inherit; }
::highlight(rv-addressed) { background-color: #cfe8ff; color: inherit; }
::highlight(rv-resolved) { background-color: #e6ecf2; color: inherit; }
::highlight(rv-suggest) { background-color: #ead9ff; color: inherit; text-decoration: underline dotted #7a3fd1; }
::highlight(rv-revised) { background-color: #d5f5dd; color: inherit; text-decoration: underline #1f8a3a; }
::highlight(rv-pending) { background-color: #ffd27a; color: inherit; }
::highlight(rv-active) { background-color: #ffbf47; color: inherit; }
::highlight(rv-orig) { background-color: #fff1bf; color: inherit; }
.rv-clean { }
.rv-over { cursor: pointer; }

body.rv-wide main { max-width: 1520px; }
.rv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.rv-layout > .rv-doc { min-width: 0; }
.rv-layout:not(.rv-on) { grid-template-columns: minmax(0, 1fr); }
.rv-layout:not(.rv-on) > .rv-sidebar { display: none; }
.rv-sidebar { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; background: #f8fafd; border: 1px solid #dbe2ec;
  border-radius: 14px; padding: 12px; font-size: 13.5px; line-height: 1.45; color: #1d2b3a; overscroll-behavior: contain; }
.rv-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rv-side-head h3 { margin: 0; font-size: 15px; }
.rv-close { display: none; background: none; color: inherit; font-size: 22px; line-height: 1; padding: 2px 8px; }
.rv-drawer-btn { display: none; }

/* Narrow screens: the sidebar becomes a drawer on the right. */
@media (max-width: 1199px) {
  .rv-layout, .rv-layout.rv-on { grid-template-columns: minmax(0, 1fr); }
  .rv-layout.rv-on > .rv-sidebar.rv-drawer { display: block; position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); max-height: none;
    border-radius: 0; z-index: 1900; transform: translateX(105%); transition: transform .2s ease; box-shadow: -10px 0 30px #0f203a33; }
  .rv-layout.rv-on > .rv-sidebar.rv-drawer.rv-drawer-open { transform: none; }
  .rv-sidebar.rv-drawer .rv-close { display: inline-block; }
  .rv-drawer-btn { display: inline-block; }
}

.rv-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.rv-modes[hidden] { display: none; }
.rv-seg { display: inline-flex; border: 1px solid #ccd9e8; border-radius: 10px; overflow: hidden; }
.rv-seg button { background: #fff; color: #1d2b3a; border: 0; border-radius: 0; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.rv-seg button + button { border-left: 1px solid #ccd9e8; }
.rv-seg button.on { background: #15243a; color: #fff; }
.rv-seg button:disabled { opacity: .45; cursor: not-allowed; }
.rv-cycle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.rv-cycle select { width: auto; padding: 4px 8px; font-size: 13px; }
.rv-mode-hint { font-size: 12.5px; color: #5b6b7c; }
.rv-original { background: #fffdf5 !important; border-style: dashed !important; }

.rv-summary { background: #fff; border: 1px solid #e1e8f0; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; display: grid; gap: 4px; }
.rv-filter { display: flex; gap: 12px; font-size: 12.5px; }
.rv-filter label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 500; }
.rv-filter input { width: auto; margin: 0; }
.rv-empty { color: #5b6b7c; margin: 6px 2px; }

.rv-card { background: #fff; border: 1px solid #dbe2ec; border-left: 4px solid #f2b705; border-radius: 10px; padding: 10px 11px; margin: 0 0 10px; cursor: pointer; outline: none; }
.rv-card.st-addressed { border-left-color: #3b8fe0; }
.rv-card.st-resolved { border-left-color: #9aa8b8; opacity: .86; }
.rv-card.active, .rv-card:focus-visible { box-shadow: 0 0 0 2px #ffbf47; }
.rv-card.rv-pending { border-left-color: #ff9d00; cursor: default; }
.rv-head { display: flex; gap: 8px; align-items: center; }
.rv-head strong { font-size: 13.5px; }
.rv-av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.rv-ini { display: inline-grid; place-items: center; background: #15243a; color: #fff; font-size: 11.5px; font-weight: 700; }
.rv-time { font-size: 11.5px; color: #5b6b7c; }
.rv-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.rv-chip { font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: #eef2f7; color: #34465a; }
.rv-chip.draft { background: #fff1cc; color: #7a5600; }
.rv-chip.s-addressed { background: #dcecff; color: #0f4f8f; }
.rv-chip.s-resolved { background: #e3f4e6; color: #1d6b31; }
.rv-chip.r-pending_review { background: #ffe9d6; color: #8a3f00; }
.rv-chip.r-accepted { background: #dcf5e2; color: #17652e; }
.rv-chip.r-rejected, .rv-chip.r-changes_requested { background: #ffe0e0; color: #9a1d1d; }
.rv-chip.k-suggestion { background: #efe4ff; color: #5a2aa6; }
.rv-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b7a8c; margin: 8px 0 3px; display: block; }
.rv-quote { margin: 0; padding: 6px 9px; background: #fff7d6; border-radius: 7px; font-style: italic; max-height: 140px; overflow: auto; white-space: pre-wrap; }
.rv-body { white-space: pre-wrap; margin-top: 6px; overflow-wrap: anywhere; }
.rv-sugg { padding: 4px 8px; background: #f7f1ff; border-radius: 7px; }
.rv-rev { margin-top: 8px; padding: 6px 9px; background: #f5fbf6; border: 1px solid #d7eedb; border-radius: 8px; }
.rv-diff { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
del.rv-del { color: #b42318; text-decoration: line-through; text-decoration-color: #d92d20; background: #fde8e7; }
ins.rv-ins { color: #13702f; text-decoration: none; background: #dcf7e3; }
.rv-meta, .rv-note { font-size: 11.5px; color: #5b6b7c; margin-top: 4px; }
.rv-cite-flag { margin-top: 8px; padding: 6px 9px; background: #fff4e5; border: 1px solid #f5c98b; border-radius: 8px; font-size: 12.5px; }
.rv-replies { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.rv-replies li { display: flex; gap: 7px; padding-top: 6px; border-top: 1px solid #edf1f6; }
.rv-replies .rv-av { width: 24px; height: 24px; font-size: 10px; }
.rv-form textarea { width: 100%; min-height: 54px; margin: 4px 0; font-size: 13px !important; box-sizing: border-box; }
.rv-row, .rv-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rv-card button, .rv-pending button { padding: 4px 9px; font-size: 12.5px; }
.rv-history { margin-top: 8px; border-top: 1px dashed #dbe2ec; padding-top: 6px; font-size: 12.5px; }
.rv-history ol { margin: 0; padding-left: 16px; display: grid; gap: 6px; }

.rv-toolbar { position: absolute; z-index: 2100; display: flex; gap: 2px; padding: 4px; background: #15243a; border-radius: 10px; box-shadow: 0 8px 24px #0f203a40; }
.rv-toolbar button { background: transparent; color: #fff; border: 0; padding: 5px 9px; font-size: 12.5px; font-weight: 600; border-radius: 7px; white-space: nowrap; }
.rv-toolbar button:hover:not(:disabled) { background: #2b3f5c; }
.rv-toolbar button:disabled { opacity: .4; }
.rv-marker { position: absolute; z-index: 1500; width: 16px; padding: 0; border: 0; border-radius: 4px; background: #d92d20; color: #fff; font-size: 10px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px #0003; }
.rv-marker.active { outline: 2px solid #ffbf47; }

html[data-platform-theme="dark"] .rv-sidebar { background: #0f1a2c; border-color: #2c3f5c; color: #e8eef7; }
html[data-platform-theme="dark"] .rv-card, html[data-platform-theme="dark"] .rv-summary { background: #15233a; border-color: #2c3f5c; color: #e8eef7; }
html[data-platform-theme="dark"] .rv-quote { background: #3a3317; color: #fff4cc; }
html[data-platform-theme="dark"] .rv-rev { background: #12301d; border-color: #24563a; }
html[data-platform-theme="dark"] .rv-cite-flag { background: #3b2a12; border-color: #7a5520; }
html[data-platform-theme="dark"] .rv-seg button { background: #15233a; color: #e8eef7; }
html[data-platform-theme="dark"] .rv-seg button.on { background: #e8eef7; color: #15243a; }
html[data-platform-theme="dark"] .rv-original { background: #1b2436 !important; }
html[data-platform-theme="dark"] del.rv-del { background: #4a1714; color: #ffb4ab; }
html[data-platform-theme="dark"] ins.rv-ins { background: #133d22; color: #a6f0bb; }
html[data-platform-theme="dark"] .rv-time, html[data-platform-theme="dark"] .rv-meta, html[data-platform-theme="dark"] .rv-note, html[data-platform-theme="dark"] .rv-label { color: #a9b7c9; }
@media print { .rv-sidebar, .rv-toolbar, .rv-marker, .rv-modes { display: none !important; } }
