
/* ═══════════════════════════════════════════════════════════════════════════
   RESEARCH VAULT — flagship page, ported from site/_mockup_research_vault.html.
   Skinned in the house macro.html mx5 aurora-glass language. Canvas + mx5 tokens
   come from theme.css :root (linked above); only the vault-specific mx5 recipe +
   the BLUE --rv intelligence accent live here.
   ── Signature accent: --rv BLUE. A STABLE brand token (research / intelligence).
      It is a brand accent, NOT price direction — NEVER flipped in zh. A SELL rating
      is editorial amber (--sell), not alarm red. Blue must never read as up/down.
   ═════════════════════════════════════════════════════════════════════════════ */
:root{
  /* --num : the macro data face. Every count / date / page-no / quota figure rides it. */
  --num: var(--font-mono, ui-monospace,"SF Mono",SFMono-Regular,"Cascadia Mono",Menlo,Consolas,"DejaVu Sans Mono",monospace);

  /* ── mx5 glass recipe (verbatim from dashboard.html.j2 #mx5-css) ───────────── */
  --mx5-glass-bg:      rgba(16,22,30,.55);
  --mx5-pop-bg:        rgba(13,18,26,.96);
  --mx5-glass-border:  rgba(255,255,255,.12);
  --mx5-glass-shadow:  0 8px 32px rgba(0,0,0,.55), 0 1.5px 0 rgba(255,255,255,.07) inset;
  --mx5-glass-hover:   0 12px 40px rgba(0,0,0,.65), 0 1.5px 0 rgba(255,255,255,.09) inset;
  --mx5-blur:          blur(20px);
  --mx5-radius-card:   18px;
  --mx5-radius-pill:   999px;
  --mx5-hover-bg:      rgba(22,29,38,.62);
  --mx5-hover-border:  rgba(255,255,255,.16);

  /* ── signature: the Vault BLUE intelligence accent (direction-STABLE) ── */
  --rv:#4f8ff7;                /* primary brand accent — research / intelligence */
  --rv-2:#38bdf8;              /* cyan companion for gradient + beam depth */
  --rv-ink:#9cc2ff;            /* light-on-dark accent text (>=4.5:1 on glass) */
  --rv-dim: rgba(79,143,247,.13);
  --rv-glow: rgba(79,143,247,.34);
  --gold:#d8b26a;              /* editorial highlight (Top Picks) — brass, not neon */

  /* rating stamps — a SELL is editorial (amber), NOT a danger state. */
  --buy:#45b873; --sell:#dCA24a; --indep:#8c93c8;
}
html[data-theme="light"]{
  --mx5-glass-bg:      rgba(255,255,255,.82);
  --mx5-pop-bg:        rgba(255,255,255,.97);
  --mx5-glass-border:  rgba(0,0,0,.06);
  --mx5-glass-shadow:  0 4px 24px rgba(0,0,0,.09), 0 1px 0 rgba(255,255,255,.95) inset;
  --mx5-glass-hover:   0 8px 32px rgba(0,0,0,.13), 0 1px 0 rgba(255,255,255,.95) inset;
  --mx5-hover-bg:      rgba(255,255,255,.92);
  --mx5-hover-border:  rgba(0,0,0,.14);

  --rv:#285fff; --rv-2:#0f8fd8; --rv-ink:#1b49c8;
  --rv-dim: rgba(40,95,255,.10); --rv-glow: rgba(40,95,255,.26);
  --gold:#a9812e;
  --buy:#1f9a55; --sell:#a9781f; --indep:#5b62a8;
}
/* Asia colour convention: in zh, a bullish BUY stamp reads bullish only if red.
   Swap the BUY stamp toward red; SELL stays editorial amber; brand blue untouched. */
html[data-lang="zh"]{ --buy:#e06464; }
html[data-theme="light"][data-lang="zh"]{ --buy:#cf4040; }

/* ── page shell (body top padding satisfies check_nav_gap ≥14px) ── */
body{ padding-top:22px; }
.rv-wrap{ max-width:1240px; margin:0 auto; padding:0 22px 96px; }
.rv-scope :focus-visible{ outline:2px solid var(--rv); outline-offset:2px; border-radius:6px; }

/* ── mx5 aurora backdrop (re-biased BLUE/cyan; static gradients, compositor-safe) ── */
.mx5-aurora{ position:fixed; inset:0; pointer-events:none; z-index:-1; overflow:hidden; }
.mx5-aurora::before{ content:""; position:absolute; width:900px; height:700px; top:-200px; left:-160px;
  border-radius:50%; filter:blur(90px); background:radial-gradient(ellipse, rgba(79,143,247,.15) 0%, transparent 70%); }
.mx5-aurora::after{ content:""; position:absolute; width:720px; height:600px; bottom:-120px; right:-110px;
  border-radius:50%; filter:blur(90px); background:radial-gradient(ellipse, rgba(56,189,248,.11) 0%, transparent 70%); }
.mx5-aurora .a3{ position:absolute; width:620px; height:520px; top:38%; left:52%; transform:translate(-50%,-50%);
  border-radius:50%; filter:blur(90px); background:radial-gradient(ellipse, rgba(79,143,247,.08) 0%, transparent 70%); }
.mx5-aurora .a4{ position:absolute; width:820px; height:600px; bottom:-160px; left:16%;
  border-radius:50%; filter:blur(90px); background:radial-gradient(ellipse, rgba(56,189,248,.07) 0%, transparent 70%); }
html[data-theme="light"] .mx5-aurora::before{ background:radial-gradient(ellipse, rgba(40,95,255,.07) 0%, transparent 70%); }
html[data-theme="light"] .mx5-aurora::after { background:radial-gradient(ellipse, rgba(15,143,216,.05) 0%, transparent 70%); }
html[data-theme="light"] .mx5-aurora .a3{ background:radial-gradient(ellipse, rgba(40,95,255,.04) 0%, transparent 70%); }
html[data-theme="light"] .mx5-aurora .a4{ background:radial-gradient(ellipse, rgba(15,143,216,.035) 0%, transparent 70%); }

/* shared mx5 glass surface */
.glass{
  background:var(--mx5-glass-bg); border:1px solid var(--mx5-glass-border);
  -webkit-backdrop-filter:var(--mx5-blur); backdrop-filter:var(--mx5-blur);
  box-shadow:var(--mx5-glass-shadow); border-radius:var(--mx5-radius-card);
}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .glass{ background:var(--panel); }
}

/* ═══════════════ 1 · THIS WEEK — mx5 command hero ═══════════════════════════ */
.rv-hero{ position:relative; margin-top:14px; overflow:hidden; isolation:isolate;
  padding:30px 32px; display:grid; grid-template-columns:1.35fr 1fr; gap:30px; align-items:center; }
.rv-hero::before{ content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
  background:radial-gradient(560px 320px at 86% 8%, var(--rv-dim), transparent 70%); }
.rv-eyebrow{ display:inline-flex; align-items:center; gap:8px; font-family:var(--num); font-size:10.5px; font-weight:700;
  letter-spacing:.16em; text-transform:uppercase; color:var(--rv-ink); margin-bottom:14px; }
html[data-theme="light"] .rv-eyebrow{ color:var(--rv); }
.rv-eyebrow .dot{ width:7px; height:7px; border-radius:50%; background:var(--rv); box-shadow:0 0 0 4px var(--rv-dim); }
.rv-hero h1{ font-weight:800; font-size:clamp(27px,3.4vw,40px); line-height:1.08; letter-spacing:-.022em;
  margin:0 0 14px; max-width:20ch; color:var(--text); }
.rv-hero h1 .accent{ color:transparent; background:linear-gradient(100deg, var(--rv), var(--rv-2));
  -webkit-background-clip:text; background-clip:text; }
.rv-verdict{ font-size:15.5px; line-height:1.55; color:color-mix(in srgb,var(--text) 92%,var(--muted)); max-width:56ch; margin:0; }
.rv-verdict b{ font-weight:700; color:var(--text); }
.rv-stance{ display:inline-flex; align-items:center; gap:9px; margin-top:16px; padding:9px 15px;
  border-radius:12px; background:var(--rv-dim); border:1px solid color-mix(in srgb,var(--rv) 32%,transparent);
  font-size:13.5px; font-weight:600; color:var(--text); }
.rv-stance svg{ width:16px; height:16px; color:var(--rv); flex:none; }
.rv-stance b{ font-weight:800; color:var(--rv-ink); }
html[data-theme="light"] .rv-stance b{ color:var(--rv); }

.rv-figs{ display:flex; flex-wrap:wrap; gap:12px; margin-top:22px; }
.rv-fig{ flex:1 1 120px; min-width:104px; padding:13px 15px; border-radius:13px;
  background:color-mix(in srgb, var(--panel2) 46%, transparent); border:1px solid var(--mx5-glass-border); }
.rv-fig .n{ font-family:var(--num); font-size:26px; font-weight:700; line-height:1; color:var(--text);
  font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.rv-fig .n.hl{ color:var(--rv-ink); } html[data-theme="light"] .rv-fig .n.hl{ color:var(--rv); }
.rv-fig .n.sm{ font-size:17px; letter-spacing:0; }
.rv-fig .k{ font-size:11.5px; font-weight:600; color:var(--muted); margin-top:5px; letter-spacing:.01em; }

/* ── signature: the Publishing Beam (blue Fed-beam / arc echo, DESCRIPTIVE) ── */
.rv-beam{ position:relative; align-self:stretch; min-height:230px; border-radius:16px; overflow:hidden;
  background:color-mix(in srgb, var(--panel2) 40%, transparent); border:1px solid var(--mx5-glass-border);
  padding:18px 18px 16px; display:flex; flex-direction:column; }
.rv-beam-hd{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.rv-beam-hd .lb{ font-family:var(--num); font-size:10px; font-weight:700; letter-spacing:.13em; text-transform:uppercase; color:var(--muted); }
.rv-beam-hd .big{ font-family:var(--num); font-size:19px; font-weight:700; color:var(--rv-ink); font-variant-numeric:tabular-nums; }
html[data-theme="light"] .rv-beam-hd .big{ color:var(--rv); }
.rv-beam-stage{ position:relative; flex:1; margin-top:6px; }
.rv-beam-svg{ position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.rv-beam-cap{ margin-top:8px; font-size:11.5px; line-height:1.45; color:var(--muted); }
.rv-beam-cap b{ color:color-mix(in srgb,var(--text) 82%,var(--muted)); font-weight:700; }
@keyframes rvPulse{ 0%,100%{ opacity:.35; } 50%{ opacity:1; } }
.rv-beam-svg .pulse{ animation:rvPulse 3.4s ease-in-out infinite; transform-origin:center; }

/* ═══════════════ 2 · LANE TABS (segmented, unread badges) ═══════════════════ */
.rv-lanes{ display:flex; align-items:center; gap:8px; margin-top:30px; flex-wrap:wrap; }
.rv-lane{ appearance:none; display:inline-flex; align-items:center; gap:9px; font:inherit; font-size:14px; font-weight:700;
  padding:9px 15px; border-radius:var(--mx5-radius-pill); cursor:pointer; color:var(--muted);
  background:color-mix(in srgb, var(--panel2) 52%, transparent); border:1px solid var(--mx5-glass-border); transition:.16s; }
.rv-lane:hover{ color:var(--text); border-color:var(--mx5-hover-border); }
.rv-lane.on{ color:#fff; background:linear-gradient(120deg, var(--rv), color-mix(in srgb,var(--rv) 72%,var(--rv-2)));
  border-color:transparent; box-shadow:0 6px 18px -6px var(--rv-glow); }
.rv-lane .badge{ font-family:var(--num); font-size:11px; font-weight:700; min-width:20px; text-align:center;
  padding:1px 6px; border-radius:999px; background:color-mix(in srgb, var(--text) 12%, transparent); color:var(--text);
  font-variant-numeric:tabular-nums; }
.rv-lane.on .badge{ background:rgba(255,255,255,.24); color:#fff; }
.rv-lane svg{ width:15px; height:15px; }
.rv-unread{ margin-left:auto; font-size:12.5px; color:var(--muted); font-family:var(--num); font-variant-numeric:tabular-nums; }
.rv-unread b{ color:var(--rv-ink); font-weight:700; }
html[data-theme="light"] .rv-unread b{ color:var(--rv); }

/* ═══════════════ 3 · WORKBENCH (browse rail + filter + feed) ════════════════ */
.rv-work{ display:grid; grid-template-columns:236px 1fr; gap:22px; margin-top:18px; align-items:start; }
.rv-rail{ position:sticky; top:70px; padding:16px 15px; }
.rv-rail-hd{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px; }
.rv-rail-hd h3{ margin:0; font-size:12px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.rv-rail-hd .rv-drawer-x{ display:none; }
.rv-tree{ list-style:none; margin:0; padding:0; font-size:13.5px; }
.rv-tree li{ margin:0; }
.rv-tw{ display:flex; align-items:center; gap:7px; width:100%; text-align:left; appearance:none; border:0; background:none;
  font:inherit; color:var(--text); padding:6px 8px; border-radius:9px; cursor:pointer; transition:.14s; }
.rv-tw:hover{ background:color-mix(in srgb,var(--rv) 12%,transparent); color:var(--rv-ink); }
html[data-theme="light"] .rv-tw:hover{ color:var(--rv); }
.rv-tw.sel{ background:var(--rv-dim); color:var(--rv-ink); font-weight:700; }
html[data-theme="light"] .rv-tw.sel{ color:var(--rv); }
.rv-tw .caret{ width:13px; height:13px; flex:none; transition:transform .18s; color:var(--muted); }
.rv-node.open > .rv-tw .caret{ transform:rotate(90deg); }
.rv-tw .lbl{ flex:1; min-width:0; }
.rv-tw .cn{ font-family:var(--num); font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.rv-children{ list-style:none; margin:2px 0 4px; padding:0 0 0 16px; border-left:1px solid var(--line); display:none; }
.rv-node.open > .rv-children{ display:block; }
.rv-leaf .rv-tw{ font-size:13px; }
.rv-leaf .rv-tw .dotinst{ width:6px; height:6px; border-radius:50%; background:var(--rv); opacity:.6; flex:none; }

.rv-filter{ position:sticky; top:60px; z-index:40; padding:13px 15px; margin-bottom:16px; }
.rv-search{ display:flex; align-items:center; }
.rv-search input[type="search"]{
  appearance:none; -webkit-appearance:none; flex:1 1 auto; min-width:0; box-sizing:border-box;
  padding:10px 14px 10px 40px; border-radius:11px; border:1px solid var(--line); color:var(--text);
  font:inherit; font-size:14px; outline:none; transition:border-color .18s, box-shadow .25s ease;
  background:var(--panel2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b94a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E")
    no-repeat 13px 50%; background-size:16px; }
.rv-search input::placeholder{ color:var(--muted); }
.rv-search input:hover{ border-color:color-mix(in srgb,var(--rv) 40%,var(--line)); }
.rv-search input:focus{ border-color:var(--rv); box-shadow:0 0 0 3px var(--rv-dim); }
.rv-facets{ display:flex; flex-wrap:wrap; gap:8px 16px; margin-top:12px; align-items:center; }
.facet-grp{ display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.facet-lbl{ font-family:var(--num); font-size:10px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); margin-right:2px; }
.aff{ appearance:none; padding:6px 13px; border-radius:var(--mx5-radius-pill); background:color-mix(in srgb,var(--panel2) 60%,transparent);
  color:var(--muted); font-family:inherit; font-weight:700; font-size:12.5px; cursor:pointer; border:1px solid var(--mx5-glass-border); transition:.16s; white-space:nowrap; }
.aff:hover{ color:var(--text); border-color:var(--mx5-hover-border); }
.aff.active{ background:var(--rv); color:#fff; border-color:var(--rv); box-shadow:0 4px 12px -4px var(--rv-glow); }
.rv-result{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px;
  padding-top:11px; border-top:1px solid color-mix(in srgb,var(--text) 8%,transparent); flex-wrap:wrap; }
.rv-result .cnt{ font-size:13px; color:var(--muted); font-family:var(--num); font-variant-numeric:tabular-nums; }
.rv-result .cnt b{ color:var(--text); font-weight:700; }
.rv-active{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.chiptag{ display:inline-flex; align-items:center; gap:7px; font-size:12px; font-weight:600; padding:4px 6px 4px 11px;
  border-radius:var(--mx5-radius-pill); background:var(--rv-dim); border:1px solid color-mix(in srgb,var(--rv) 30%,transparent); color:var(--text); }
.chiptag button{ appearance:none; border:0; background:color-mix(in srgb,var(--rv) 26%,transparent); color:var(--text);
  width:17px; height:17px; border-radius:50%; cursor:pointer; display:grid; place-items:center; font-size:11px; line-height:1; padding:0; }
.chiptag button:hover{ background:var(--rv); color:#fff; }
.rv-clear{ appearance:none; border:0; background:none; color:var(--rv); font:inherit; font-size:12.5px; font-weight:700; cursor:pointer; padding:2px; }
.rv-clear:hover{ text-decoration:underline; }
.rv-searching{ font-size:12px; color:var(--muted); font-family:var(--num); }

.rv-browse-btn{ display:none; }
.rv-scrim{ display:none; }

.rv-picks-hd{ display:flex; align-items:baseline; gap:11px; margin-bottom:14px; flex-wrap:wrap; }
.rv-picks-hd h2{ margin:0; font-size:20px; font-weight:800; letter-spacing:-.015em; color:var(--text); }
.rv-picks-hd .why{ font-size:12.5px; color:var(--muted); }

/* ═══════════════ 4 · REPORT CARDS (mx5 glass) ═══════════════════════════════ */
.rv-feed{ display:flex; flex-direction:column; gap:14px; }
.rep{ position:relative; display:grid; grid-template-columns:1fr; gap:0; padding:19px 21px;
  transition:transform .2s ease-out, box-shadow .2s, border-color .2s, background .2s; }
.rep:hover{ transform:translateY(-1px); background:var(--mx5-hover-bg); border-color:var(--mx5-hover-border); box-shadow:var(--mx5-glass-hover); }
.rep.pick{ border-color:color-mix(in srgb,var(--rv) 34%,var(--mx5-glass-border)); }
.rep.pick::before{ content:""; position:absolute; top:0; left:0; right:0; height:3px; border-radius:18px 18px 0 0;
  background:linear-gradient(90deg, var(--rv), var(--rv-2)); }
.rep-top{ display:flex; align-items:center; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.rep-logo{ width:30px; height:30px; border-radius:8px; flex:none; display:grid; place-items:center;
  font-family:var(--num); font-weight:700; font-size:11.5px; color:#fff; letter-spacing:-.02em;
  background:linear-gradient(150deg, var(--rv), var(--rv-2)); box-shadow:inset 0 1px 0 rgba(255,255,255,.28); }
.rep.needs .rep-logo{ background:linear-gradient(150deg, var(--muted), color-mix(in srgb,var(--muted) 60%,var(--panel2))); }
.rep-inst{ font-size:13px; font-weight:800; color:var(--text); }
.rep.needs .rep-inst{ color:var(--muted); }
.rep-desk{ font-size:12px; color:var(--muted); }
.rep-sep{ color:color-mix(in srgb,var(--text) 22%,transparent); }
.rep-unread{ width:8px; height:8px; border-radius:50%; background:var(--rv); flex:none; box-shadow:0 0 0 3px var(--rv-dim); margin-left:1px; }
.rep.read .rep-unread{ background:transparent; box-shadow:none; border:1px solid var(--line); }
.rep-pin{ display:inline-flex; align-items:center; gap:5px; font-family:var(--num); font-size:9.5px; font-weight:700; letter-spacing:.06em;
  text-transform:uppercase; color:var(--rv-ink); padding:3px 8px; border-radius:999px; background:var(--rv-dim);
  border:1px solid color-mix(in srgb,var(--rv) 30%,transparent); }
html[data-theme="light"] .rep-pin{ color:var(--rv); }
.rep-pin svg{ width:10px; height:10px; }
.rep-savebtn{ margin-left:auto; appearance:none; border:1px solid var(--mx5-glass-border); background:color-mix(in srgb,var(--panel2) 50%,transparent);
  color:var(--muted); width:32px; height:32px; border-radius:9px; cursor:pointer; display:grid; place-items:center; transition:.16s; flex:none; }
.rep-savebtn svg{ width:16px; height:16px; }
.rep-savebtn:hover{ color:var(--rv); border-color:color-mix(in srgb,var(--rv) 45%,var(--line)); }
.rep-savebtn.on{ color:var(--rv); background:var(--rv-dim); border-color:color-mix(in srgb,var(--rv) 40%,transparent); }
.rep-savebtn.on svg{ fill:var(--rv); }
.rep h3{ font-weight:700; font-size:17.5px; line-height:1.28; margin:0 0 10px; letter-spacing:-.012em; color:var(--text); }
.rep-points{ list-style:none; margin:0 0 12px; padding:0; display:flex; flex-direction:column; gap:6px; }
.rep-points li{ position:relative; padding-left:18px; font-size:13.5px; line-height:1.5; color:color-mix(in srgb,var(--text) 88%,var(--muted)); }
.rep-points li::before{ content:""; position:absolute; left:2px; top:8px; width:6px; height:6px; border-radius:2px; background:var(--rv); transform:rotate(45deg); }
.rep-points.pend li{ color:var(--muted); font-style:italic; }
.rep-more{ appearance:none; border:0; background:none; color:var(--rv); font:inherit; font-size:12.5px; font-weight:700;
  cursor:pointer; padding:0; margin:-2px 0 12px; display:inline-flex; align-items:center; gap:5px; }
.rep-more:hover{ text-decoration:underline; }
.rep-more svg{ width:13px; height:13px; transition:transform .2s; }
.rep.open-pts .rep-more svg{ transform:rotate(180deg); }
.rep-points .extra{ display:none; }
.rep.open-pts .rep-points .extra{ display:list-item; }
.rep-foot{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
  padding-top:13px; border-top:1px solid color-mix(in srgb,var(--text) 8%,transparent); }
.rep-meta{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.rep-date{ font-family:var(--num); font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; display:inline-flex; align-items:center; gap:6px; }
.rep-date svg{ width:13px; height:13px; opacity:.7; }
.rep-tags{ display:flex; gap:6px; flex-wrap:wrap; }
.rep-tag{ font-size:11px; font-weight:600; color:var(--muted); padding:2px 8px; border-radius:6px; background:color-mix(in srgb,var(--text) 6%,transparent); }
.rep-ticker{ font-size:11px; font-weight:700; color:var(--rv-ink); padding:2px 8px; border-radius:6px;
  background:var(--rv-dim); border:1px solid color-mix(in srgb,var(--rv) 22%,transparent); text-decoration:none; }
html[data-theme="light"] .rep-ticker{ color:var(--rv); }
a.rep-ticker:hover{ border-color:var(--rv); }
.rep-acts{ display:flex; align-items:center; gap:8px; }
.btn{ appearance:none; display:inline-flex; align-items:center; gap:7px; font:inherit; font-size:12.5px; font-weight:700;
  padding:8px 14px; border-radius:10px; cursor:pointer; border:1px solid var(--mx5-glass-border);
  background:color-mix(in srgb,var(--panel2) 55%,transparent); color:var(--text); transition:.16s; }
.btn svg{ width:15px; height:15px; }
.btn:hover{ transform:translateY(-1px); border-color:var(--mx5-hover-border); }
.btn.primary{ background:linear-gradient(120deg, var(--rv), color-mix(in srgb,var(--rv) 74%,var(--rv-2)));
  border-color:transparent; color:#fff; box-shadow:0 6px 16px -6px var(--rv-glow); }
.btn.primary:hover{ filter:brightness(1.06); }
.btn.ghost{ background:transparent; }

.stamp{ display:inline-flex; align-items:center; gap:5px; font-family:var(--num); font-size:10px;
  font-weight:700; letter-spacing:.1em; text-transform:uppercase; padding:3px 9px; border-radius:6px; border:1.5px solid currentColor; }
.stamp.buy{ color:var(--buy); } .stamp.sell{ color:var(--sell); } .stamp.indep{ color:var(--indep); }
.stamp .dt{ width:5px; height:5px; border-radius:50%; background:currentColor; }
.rep .backfill{ font-size:11px; color:var(--muted); font-style:italic; }

.rv-empty{ padding:40px 24px; text-align:center; }
.rv-empty svg{ width:34px; height:34px; color:var(--muted); opacity:.6; margin-bottom:12px; }
.rv-empty h3{ margin:0 0 6px; font-size:16px; font-weight:800; color:var(--text); }
.rv-empty p{ margin:0; font-size:13px; color:var(--muted); max-width:40ch; margin-inline:auto; }

.rv-foot{ margin-top:44px; padding-top:22px; border-top:1px solid color-mix(in srgb,var(--text) 8%,transparent);
  font-size:12px; line-height:1.6; color:var(--muted); max-width:78ch; }
.rv-foot b{ color:color-mix(in srgb,var(--text) 80%,var(--muted)); font-weight:700; }

/* ═══════════════ 5 · PDF VIEWER modal (clones the auth-overlay) ══════════════ */
.rv-overlay{ position:fixed; inset:0; z-index:100001; display:flex; align-items:center; justify-content:center;
  padding:24px; background:color-mix(in srgb,#04060c 74%,transparent);
  -webkit-backdrop-filter:blur(12px) saturate(1.05); backdrop-filter:blur(12px) saturate(1.05);
  opacity:0; visibility:hidden; pointer-events:none; transition:opacity .26s ease, visibility 0s linear .26s; }
.rv-overlay.open{ opacity:1; visibility:visible; pointer-events:auto; transition:opacity .26s ease, visibility 0s; }
html.rv-lock{ overflow:hidden; }
.rv-modal{ position:relative; width:min(1060px,97vw); height:min(90vh,900px); box-sizing:border-box;
  border-radius:20px; overflow:hidden; isolation:isolate; display:grid; grid-template-columns:96px 1fr; grid-template-rows:auto 1fr auto auto;
  background:var(--mx5-pop-bg); border:1px solid var(--mx5-glass-border);
  -webkit-backdrop-filter:blur(20px) saturate(1.4); backdrop-filter:blur(20px) saturate(1.4);
  box-shadow:0 34px 100px -24px rgba(0,0,0,.84), inset 0 1px 0 rgba(255,255,255,.08);
  transform:translateY(14px) scale(.98); opacity:.4; transition:transform .34s cubic-bezier(.32,1.28,.5,1), opacity .22s ease; color:var(--text); }
.rv-overlay.open .rv-modal{ transform:none; opacity:1; }
html[data-theme="light"] .rv-modal{ box-shadow:0 32px 88px -26px rgba(20,30,50,.44), inset 0 1px 0 rgba(255,255,255,.72); }
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){ .rv-modal{ background:var(--panel); } }
.rv-modal::before{ content:""; position:absolute; top:0; left:0; right:0; height:3px; z-index:5;
  background:linear-gradient(90deg, var(--rv), var(--rv-2), color-mix(in srgb,var(--rv) 20%,transparent)); }

.vh{ grid-column:1 / 3; display:flex; align-items:flex-start; gap:14px; padding:17px 20px 14px;
  border-bottom:1px solid color-mix(in srgb,var(--text) 9%,transparent); }
.vh-logo{ width:34px; height:34px; border-radius:9px; flex:none; display:grid; place-items:center;
  font-family:var(--num); font-weight:700; font-size:13px; color:#fff; letter-spacing:-.02em;
  background:linear-gradient(150deg, var(--rv), var(--rv-2)); box-shadow:inset 0 1px 0 rgba(255,255,255,.28); }
.vh-txt{ min-width:0; flex:1; }
.vh-txt .vh-inst{ font-size:12px; font-weight:800; color:var(--muted); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.vh-txt h3{ font-weight:700; font-size:16px; line-height:1.28; margin:3px 0 0; color:var(--text);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.vh-tools{ display:flex; align-items:center; gap:6px; flex:none; }
.vh-find{ position:relative; display:flex; align-items:center; }
.vh-find input{ appearance:none; width:150px; padding:7px 10px 7px 30px; border-radius:9px; border:1px solid var(--line);
  background:var(--panel2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b94a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E")
    no-repeat 9px 50%; background-size:14px; color:var(--text); font:inherit; font-size:12.5px; outline:none; transition:.16s; }
.vh-find input:focus{ border-color:var(--rv); box-shadow:0 0 0 3px var(--rv-dim); }
.vh-tbtn{ appearance:none; width:34px; height:34px; border-radius:9px; border:1px solid var(--mx5-glass-border);
  background:color-mix(in srgb,var(--panel2) 55%,transparent); color:var(--muted); cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; transition:.16s; }
.vh-tbtn:hover{ color:var(--rv); border-color:color-mix(in srgb,var(--rv) 45%,var(--line)); }
.vh-tbtn.on{ color:var(--rv); background:var(--rv-dim); border-color:color-mix(in srgb,var(--rv) 40%,transparent); }
.vh-tbtn svg{ width:16px; height:16px; }
.vh-x{ appearance:none; width:34px; height:34px; border-radius:9px; border:1px solid transparent; background:transparent;
  color:var(--muted); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; transition:.18s; flex:none; }
.vh-x:hover{ background:color-mix(in srgb,var(--text) 8%,transparent); color:var(--text); }
.vh-x svg{ width:17px; height:17px; }

.vthumbs{ grid-row:2 / 3; overflow-y:auto; padding:14px 10px; border-right:1px solid color-mix(in srgb,var(--text) 8%,transparent);
  display:flex; flex-direction:column; gap:9px; background:color-mix(in srgb,var(--panel) 40%,transparent); }
.vthumb{ appearance:none; border:1.5px solid var(--line); background:#fff; border-radius:5px; cursor:pointer; padding:0;
  width:100%; aspect-ratio:1/1.3; position:relative; overflow:hidden; transition:.16s; flex:none; display:block; }
.vthumb canvas{ display:block; width:100%; height:100%; object-fit:contain; }
.vthumb:hover{ border-color:color-mix(in srgb,var(--rv) 55%,var(--line)); transform:translateY(-1px); }
.vthumb.on{ border-color:var(--rv); box-shadow:0 0 0 2px var(--rv-dim); }
.vthumb .tn{ position:absolute; bottom:2px; right:3px; font-family:var(--num); font-size:8px; color:var(--muted);
  background:color-mix(in srgb,#fff 82%,transparent); padding:0 2px; border-radius:2px; }

.vstage{ grid-row:2 / 3; min-height:0; overflow:auto; position:relative;
  background:radial-gradient(600px 400px at 50% 0%, var(--rv-dim), transparent 70%), color-mix(in srgb,var(--bg) 60%,#000);
  padding:24px; display:flex; justify-content:center; align-items:flex-start; }
html[data-theme="light"] .vstage{ background:radial-gradient(600px 400px at 50% 0%, var(--rv-dim), transparent 70%), #dfe3ea; }
/* real pdf.js canvas host */
.vcanvas-wrap{ position:relative; align-self:flex-start; transition:transform .3s ease; transform-origin:top center; }
.vcanvas-wrap canvas{ display:block; max-width:100%; height:auto; background:#fff;
  border-radius:3px; box-shadow:0 20px 60px -20px rgba(0,0,0,.6), 0 4px 14px rgba(0,0,0,.3); }
.vstage.inverted .vcanvas-wrap canvas{ filter:invert(1) hue-rotate(180deg); }
/* gate / message panel shown in place of the canvas (401/402/429/error) */
.vgate{ align-self:center; max-width:420px; text-align:center; padding:34px 26px; border-radius:16px;
  background:var(--mx5-glass-bg); border:1px solid var(--mx5-glass-border); color:var(--text); }
.vgate svg{ width:38px; height:38px; color:var(--rv); opacity:.85; margin-bottom:14px; }
.vgate h4{ margin:0 0 8px; font-size:17px; font-weight:800; }
.vgate p{ margin:0 0 16px; font-size:13.5px; color:var(--muted); line-height:1.5; }
.vgate .btn{ margin:0 auto; }
/* load shimmer (compositor-only sweep) */
.vshim{ align-self:flex-start; position:relative; width:min(560px,100%); aspect-ratio:1/1.32; background:#fff;
  border-radius:3px; overflow:hidden; box-shadow:0 20px 60px -20px rgba(0,0,0,.6); }
.vshim::before{ content:""; position:absolute; top:0; bottom:0; width:60%; left:-60%;
  background:linear-gradient(90deg, transparent, color-mix(in srgb,var(--rv) 14%,#eef0f5), transparent);
  animation:vshim 1.15s linear infinite; }
.vshim .sk{ position:absolute; left:46px; right:46px; height:10px; border-radius:4px; background:#eef0f5; }
@keyframes vshim{ to{ transform:translateX(280%); } }

.vrelated{ grid-column:2 / 3; display:flex; align-items:center; gap:11px; padding:10px 18px; overflow-x:auto;
  border-top:1px solid color-mix(in srgb,var(--text) 9%,transparent); background:color-mix(in srgb,var(--panel) 50%,transparent); }
.vrelated .vr-lb{ font-family:var(--num); font-size:10px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); flex:none; }
.vr-chip{ appearance:none; display:inline-flex; align-items:center; gap:8px; flex:none; padding:6px 11px; border-radius:10px;
  border:1px solid var(--mx5-glass-border); background:color-mix(in srgb,var(--panel2) 55%,transparent); color:var(--text);
  font:inherit; font-size:12px; cursor:pointer; transition:.16s; white-space:nowrap; }
.vr-chip:hover{ border-color:color-mix(in srgb,var(--rv) 45%,var(--line)); transform:translateY(-1px); }
.vr-chip .vr-inst{ font-weight:700; } .vr-chip .vr-tk{ font-family:var(--num); font-size:11px; color:var(--muted); }

.vctrl{ grid-column:1 / 3; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 18px;
  border-top:1px solid color-mix(in srgb,var(--text) 9%,transparent); background:color-mix(in srgb,var(--panel) 55%,transparent); flex-wrap:wrap; }
.vc-grp{ display:inline-flex; align-items:center; gap:6px; }
.vc-btn{ appearance:none; height:34px; min-width:34px; padding:0 8px; border-radius:9px; border:1px solid var(--mx5-glass-border);
  background:color-mix(in srgb,var(--panel2) 55%,transparent); color:var(--text); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:6px;
  font:inherit; font-size:12px; font-weight:700; transition:.16s; }
.vc-btn:hover:not(:disabled){ border-color:var(--rv); color:var(--rv); transform:translateY(-1px); }
.vc-btn:disabled{ opacity:.4; cursor:default; }
.vc-btn svg{ width:16px; height:16px; }
.vc-page{ font-family:var(--num); font-size:12.5px; color:var(--text); font-variant-numeric:tabular-nums; min-width:60px; text-align:center; }
.vc-zoom{ font-family:var(--num); font-size:12px; color:var(--muted); min-width:44px; text-align:center; }
.vc-hint{ font-size:11px; color:var(--muted); display:inline-flex; align-items:center; gap:6px; }
.vc-hint kbd{ font-family:var(--num); font-size:10px; padding:1px 5px; border-radius:4px; border:1px solid var(--line);
  background:color-mix(in srgb,var(--panel2) 60%,transparent); color:var(--muted); }

.vdl{ grid-column:1 / 3; padding:13px 18px 15px; border-top:1px solid color-mix(in srgb,var(--text) 9%,transparent);
  background:color-mix(in srgb,var(--panel2) 55%,transparent); display:flex; flex-direction:column; gap:10px; }
.vdl-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.vdl-state{ display:flex; align-items:center; gap:10px; font-size:12.5px; }
.vdl-meter{ width:74px; height:6px; border-radius:6px; background:color-mix(in srgb,var(--text) 10%,transparent); overflow:hidden; flex:none; }
.vdl-meter i{ display:block; height:100%; border-radius:6px; background:linear-gradient(90deg,var(--rv),var(--rv-2)); transition:width .3s ease; }
.vdl-txt b{ font-weight:800; color:var(--text); font-family:var(--num); } .vdl-txt{ color:var(--muted); }
.vdl-txt.warnc b{ color:var(--warn); }
.btn.block{ padding:9px 16px; }
.btn.primary:disabled{ opacity:.5; cursor:default; filter:none; box-shadow:none; background:color-mix(in srgb,var(--panel2) 55%,transparent); border:1px solid var(--mx5-glass-border); color:var(--muted); }
.btn.upgrade{ background:linear-gradient(120deg,var(--gold),color-mix(in srgb,var(--gold) 60%,var(--rv-2))); border:0; color:#241a05; }
html[data-theme="light"] .btn.upgrade{ color:#fff; }
.vdl-wm{ font-size:11px; color:var(--muted); display:inline-flex; align-items:center; gap:7px; }
.vdl-wm svg{ width:13px; height:13px; opacity:.75; }

.rv-overlay.fs{ padding:0; }
.rv-overlay.fs .rv-modal{ width:100vw; height:100vh; border-radius:0; }

/* ═══════════════ responsive ═══════════════════════════════════════════════ */
@media (max-width:980px){
  .rv-hero{ grid-template-columns:1fr; gap:22px; }
  .rv-beam{ min-height:190px; }
  .rv-work{ grid-template-columns:1fr; }
  .rv-rail{ display:none; }
  .rv-browse-btn{ display:inline-flex; align-items:center; gap:7px; appearance:none; font:inherit; font-size:12.5px; font-weight:700;
    padding:8px 14px; border-radius:var(--mx5-radius-pill); border:1px solid var(--mx5-glass-border);
    background:color-mix(in srgb,var(--panel2) 55%,transparent); color:var(--text); cursor:pointer; margin-right:10px; }
  .rv-browse-btn svg{ width:15px; height:15px; }
  .rv-rail.drawer-open{ display:block; position:fixed; top:0; left:0; bottom:0; width:280px; max-width:86vw; z-index:70;
    border-radius:0 18px 18px 0; overflow-y:auto; }
  .rv-rail.drawer-open .rv-rail-hd .rv-drawer-x{ display:inline-flex; appearance:none; border:0; background:none; color:var(--muted); cursor:pointer; padding:2px; }
  .rv-scrim{ display:none; position:fixed; inset:0; z-index:69; background:color-mix(in srgb,#04060c 55%,transparent);
    -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
  .rv-scrim.on{ display:block; }
}
@media (max-width:640px){
  .rv-wrap{ padding:0 15px 80px; }
  .rv-hero{ padding:22px 18px; }
  .rep{ padding:16px 16px; }
  .rep-acts{ width:100%; } .rep-acts .btn{ flex:1; justify-content:center; }
  .rep-savebtn{ order:-1; }
  .rv-overlay{ align-items:flex-end; padding:0; }
  .rv-modal{ width:100%; height:94vh; height:94dvh; border-radius:20px 20px 0 0; grid-template-columns:1fr;
    transform:translateY(100%); opacity:1; }
  .rv-overlay.open .rv-modal{ transform:none; }
  .vthumbs{ display:none; }
  .vh, .vstage, .vrelated, .vctrl, .vdl{ grid-column:1 / 2; }
  .vh-find input{ width:96px; }
}

/* reduced motion — kill transforms/animations (mobile-perf law) */
@media (prefers-reduced-motion:reduce){
  .rv-scope *{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.12s !important; }
  .rv-overlay,.rv-modal{ transition:opacity .12s ease; } .rv-modal{ transform:none; }
  .rep:hover,.btn:hover,.vc-btn:hover,.vr-chip:hover,.vthumb:hover{ transform:none; }
  .vshim::before{ animation:none; } .rv-beam-svg .pulse{ animation:none; opacity:.85; }
}
