/* ============================================================
   vote.muir.tools — REVIEW LAYER (copy edits + pinned comments)
   Ported from GameChanger gcc2. Self-contained (no external tokens).
   Hidden from print and from anyone who hasn't activated ?review=1.
   ============================================================ */

/* ---- gate: hide all review chrome unless the body opts in ---- */
body:not(.rv-on) .rv-fabs,
body:not(.rv-on) .rv-drawer,
body:not(.rv-on) .rv-hint,
body:not(.rv-on) .rv-idask { display: none !important; }

/* ---- cursors / hover affordance when a mode is active ---- */
body.rv-editing [data-rv-editable], body.rv-commenting * { cursor: crosshair; }
body.rv-editing [data-rv-editable]:hover {
  outline: 2px dashed #2f9fb8; outline-offset: 3px; border-radius: 3px;
}

/* ---- pin layer ---- */
#rvPinLayer { position: absolute; top: 0; left: 0; width: 100%; height: 0; pointer-events: none; z-index: 80; }
.rv-pin {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  width: 26px; height: 26px; border-radius: 50% 50% 50% 2px; border: 2px solid #fff;
  background: #16171f; color: #fff; font: 700 12px/1 var(--font-mono, monospace); cursor: pointer;
  box-shadow: 0 2px 8px rgba(5, 9, 26, 0.3); display: grid; place-items: center;
}
.rv-pin:hover { background: #3a3f52; }
.rv-pin.resolved { background: #2e7d54; }
.rv-pin.edit { background: #c0563b; }
.rv-pin.flash { outline: 3px solid #f6b63e; outline-offset: 2px; }

/* ---- popover (composer + thread) ---- */
.rv-pop {
  position: absolute; z-index: 90; width: min(360px, calc(100vw - 24px)); pointer-events: auto;
  background: #fff; border: 1px solid #cfcabb; border-radius: 14px;
  box-shadow: 0 18px 40px rgba(5, 9, 26, 0.35); padding: 14px;
  font-family: var(--font-body, system-ui, sans-serif); color: #16171f;
}
.rv-pop .ctx { font-size: .8rem; color: #6b7280; background: #f3f0e6;
  border-radius: 10px; padding: .5em .7em; margin-bottom: 10px;
  max-height: 60px; overflow: auto; }
.rv-pop .ctx b { color: #16171f; }
.rv-pop textarea {
  width: 100%; box-sizing: border-box; min-height: 84px; resize: vertical;
  border: 1px solid #cfcabb; border-radius: 10px; padding: .6em .7em;
  font-family: var(--font-body, system-ui, sans-serif); font-size: 16px; line-height: 1.5; color: #16171f;
}
.rv-pop textarea:focus-visible { outline: 2px solid #2f9fb8; outline-offset: 1px; }
.rv-thread { max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.rv-c { padding: 7px 0; border-bottom: 1px solid #e6e3d8; }
.rv-c:last-child { border-bottom: none; }
.rv-c .meta { font-size: .72rem; color: #6b7280; display: flex; gap: 8px; flex-wrap: wrap; }
.rv-c .meta b { color: #16171f; }
.rv-c .txt { font-size: .92rem; white-space: pre-wrap; margin-top: 2px; }
.rv-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.rv-actions .spacer { flex: 1; }

/* buttons */
.rv-send { background: #e0203a; color: #fff; border: 0; border-radius: 999px;
  padding: .55em 1.2em; font-weight: 700; font-family: var(--font-body, system-ui, sans-serif); font-size: .9rem; cursor: pointer; }
.rv-send:hover { background: #b11628; }
.rv-cancel { background: none; border: 0; color: #6b7280; font-weight: 600; cursor: pointer;
  font-family: var(--font-body, system-ui, sans-serif); font-size: .9rem; padding: .55em .4em; }
.rv-cancel:hover { color: #16171f; text-decoration: underline; }
.rv-resolve { background: none; border: 1.5px solid #cfcabb; border-radius: 999px;
  padding: 5px 13px; font-size: .8rem; font-weight: 600; cursor: pointer; color: #6b7280;
  font-family: var(--font-body, system-ui, sans-serif); }
.rv-resolve:hover { border-color: #2e7d54; color: #2e7d54; }

/* ---- FABs ---- */
.rv-fabs { position: fixed; right: 16px; bottom: 16px; z-index: 95; display: flex; flex-direction: column;
  gap: 8px; align-items: flex-end; }
.rv-fab { font-family: var(--font-body, system-ui, sans-serif); font-weight: 700; font-size: .9rem; cursor: pointer;
  background: #16171f; color: #fff; border: 0; border-radius: 999px; padding: .65em 1.1em;
  box-shadow: 0 18px 40px rgba(5, 9, 26, 0.35); display: inline-flex; align-items: center; gap: .5em; }
.rv-fab:hover { background: #3a3f52; }
.rv-fab--edit { background: #f6b63e; color: #16171f; }
.rv-fab--edit:hover { background: #e09521; }
.rv-fab[aria-pressed="true"] { outline: 3px solid #f6b63e; outline-offset: 1px; }
.rv-count { background: #e0203a; color: #fff; border-radius: 999px;
  font: 700 .72rem var(--font-mono, monospace); padding: 1px 7px; }

/* ---- hint toast ---- */
.rv-hint { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  background: #16171f; color: #f4eee0; font-size: .85rem; padding: .6em 1em;
  border-radius: 999px; box-shadow: 0 18px 40px rgba(5, 9, 26, 0.35); z-index: 96;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 24px); text-align: center; }
.rv-hint.show { opacity: 1; }

/* ---- drawer / log ---- */
.rv-drawer { position: fixed; right: 0; top: 0; height: 100vh; width: min(380px, 92vw);
  background: #fff; border-left: 1px solid #e6e3d8; box-shadow: 0 18px 40px rgba(5, 9, 26, 0.35);
  z-index: 97; transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column; color: #16171f; }
.rv-drawer.open { transform: none; }
.rv-drawer header { padding: 14px; border-bottom: 1px solid #e6e3d8;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rv-who { font-size: .8rem; color: #6b7280; }
.rv-tabs { display: inline-flex; gap: 4px; background: #f3f0e6; border-radius: 999px; padding: 3px; }
.rv-tab { border: 0; background: transparent; color: #6b7280; font-weight: 600; font-size: .8rem;
  border-radius: 999px; padding: .35em .8em; cursor: pointer; font-family: var(--font-body, system-ui, sans-serif); }
.rv-tab[aria-pressed="true"] { background: #fff; color: #16171f; box-shadow: 0 2px 8px rgba(5, 9, 26, 0.18); }
.rv-list { padding: 14px; overflow-y: auto; display: grid; gap: 10px; }
.rv-muted { color: #6b7280; font-size: .9rem; }
.rv-entry { border: 1px solid #e6e3d8; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.rv-entry:hover { border-color: #2e7d54; }
.rv-entry .meta { font-size: .72rem; color: #6b7280; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rv-entry .meta .sec { background: #f3f0e6; border-radius: 999px; padding: 1px 8px; }
.rv-entry .meta .tag-edit { background: #f6e1d8; color: #8a3a26; border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.rv-entry .meta .done { color: #2e7d54; }
.rv-entry .meta b { color: #16171f; }
.rv-entry .txt { font-size: .9rem; margin-top: 3px; white-space: pre-wrap; }

/* ---- identity dialog ---- */
.rv-idask { position: fixed; inset: 0; z-index: 99; background: rgba(14, 22, 56, .6);
  display: grid; place-items: center; padding: 16px; }
.rv-idask[hidden] { display: none; }
.rv-idcard { background: #fff; border-radius: 14px; box-shadow: 0 18px 40px rgba(5, 9, 26, 0.45);
  padding: 26px; width: min(420px, 100%); color: #16171f; }
.rv-idcard h2 { font-family: var(--font-display, system-ui, sans-serif); font-weight: 700; text-transform: uppercase; font-size: 1.7rem; margin: 0 0 6px; }
.rv-idcard input { width: 100%; box-sizing: border-box; margin: 14px 0; border: 1px solid #cfcabb;
  border-radius: 10px; padding: .7em .8em; font-size: 16px; font-family: var(--font-body, system-ui, sans-serif); }

@media print { .rv-fabs, .rv-drawer, .rv-pop, #rvPinLayer, .rv-hint, .rv-idask { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .rv-drawer, .rv-hint { transition: none; } }
