/* ================================================================
   RV Target Vault — module styling
   Reuses the TODAY design system (styles.css variables: --primary,
   --secondary, --dark, --gradient-primary, --font-display, spacing).
   No Tailwind, no build step, no new CDN. Module-only classes are
   namespaced `rv-`. Focus-optimized dark surface for blind sessions.
   ================================================================ */

:root {
  --rv-bg:        #070A1C;            /* deeper than --dark for focus */
  --rv-surface:   #0F1430;
  --rv-surface-2: #161C42;
  --rv-line:      rgba(0, 217, 255, 0.12);
  --rv-line-soft: rgba(255, 255, 255, 0.07);
  --rv-text:      #E8ECFB;
  --rv-text-dim:  rgba(232, 236, 251, 0.62);
  --rv-text-mute: rgba(232, 236, 251, 0.38);
  --rv-good:      #34E5B0;
  --rv-bad:       #FF6B7A;
  --rv-warn:      #FFC857;
  --rv-glow:      0 0 0 1px var(--rv-line), 0 18px 50px -18px rgba(0, 217, 255, 0.35);
  --rv-mono:      'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Consolas', monospace;
}

/* App shell (served via the dedicated rv_base.html — NOT the marketing base) ----- */
body.rv-body {
  margin: 0; min-height: 100vh; color: var(--rv-text);
  font-family: var(--font-primary, 'Inter', sans-serif);
  background:
    radial-gradient(circle at 15% -12%, rgba(0, 217, 255, 0.10) 0%, transparent 46%),
    radial-gradient(circle at 92% 0%, rgba(0, 166, 156, 0.085) 0%, transparent 44%),
    var(--rv-bg);
  background-attachment: fixed;
}
.rv-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  background: rgba(7, 10, 28, .72); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--rv-line);
}
.rv-brand { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; color: var(--rv-text); }
.rv-brand-mark { color: var(--primary); font-size: 1.05rem; text-shadow: 0 0 14px rgba(0, 217, 255, .6); }
.rv-brand-name { font-family: var(--font-display, 'Space Grotesk', sans-serif); font-weight: 700; letter-spacing: -.01em; font-size: 1.06rem; }
.rv-brand-tag { font-family: var(--rv-mono); font-size: .58rem; letter-spacing: .3em; text-transform: uppercase; color: var(--rv-text-mute); }
.rv-topnav { display: flex; gap: .2rem; }
.rv-topnav a {
  color: var(--rv-text-dim); text-decoration: none; font-size: .85rem; font-weight: 500;
  padding: .5rem .95rem; border-radius: 9px; transition: color .15s, background .15s;
}
.rv-topnav a:hover { color: var(--rv-text); background: rgba(255, 255, 255, .05); }
.rv-topnav a.is-active { color: var(--primary); background: rgba(0, 217, 255, .1); }
@media (max-width: 560px) { .rv-brand-tag { display: none; } }

.rv-page { padding: 2.25rem clamp(1rem, 4vw, 3rem) 5rem; }
.rv-page--focus { padding-top: 1.25rem; }
.rv-wrap { max-width: 1200px; margin: 0 auto; }
.rv-wrap--narrow { max-width: 880px; }

/* the per-page nav is superseded by the global top bar */
.rv-nav { display: none; }

/* Header ---------------------------------------------------------- */
.rv-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2rem;
}
.rv-eyebrow {
  font-family: var(--rv-mono); font-size: .7rem; letter-spacing: .28em;
  text-transform: uppercase; color: var(--primary); opacity: .85; margin-bottom: .5rem;
}
.rv-title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.05;
  margin: 0; letter-spacing: -.01em;
}
.rv-sub { color: var(--rv-text-dim); margin-top: .4rem; max-width: 60ch; }

.rv-nav { display: none; }  /* superseded by the global top bar (.rv-topnav) */
.rv-nav a {
  color: var(--rv-text-dim); text-decoration: none; font-size: .85rem; font-weight: 500;
  padding: .45rem .85rem; border-radius: 8px; transition: background .15s, color .15s;
}
.rv-nav a:hover { color: var(--rv-text); background: rgba(255,255,255,.05); }
.rv-nav a.is-active { color: var(--dark); background: var(--primary); }

/* Cards / surfaces ------------------------------------------------ */
.rv-card {
  background: linear-gradient(180deg, var(--rv-surface) 0%, rgba(15,20,48,.78) 100%);
  border: 1px solid var(--rv-line-soft);
  border-radius: 16px; padding: 1.4rem 1.5rem; position: relative;
  box-sizing: border-box;
}
.rv-card--accent { box-shadow: var(--rv-glow); border-color: var(--rv-line); }

.rv-grid { display: grid; gap: 1rem; }
.rv-grid--stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.rv-grid--pools { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.rv-grid--cols2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .rv-grid--cols2 { grid-template-columns: 1fr; } }

/* master-detail (pool list + target panel) — narrow list, wide panel, top-aligned */
.rv-master-detail {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1.25rem; align-items: start;
}
@media (max-width: 820px) { .rv-master-detail { grid-template-columns: 1fr; } }

/* Stat tile ------------------------------------------------------- */
.rv-stat { display: flex; flex-direction: column; gap: .35rem; }
.rv-stat .rv-stat-val {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 2.4rem; font-weight: 700; line-height: 1;
  background: var(--gradient-primary, linear-gradient(135deg,#00D9FF,#00A69C));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.rv-stat .rv-stat-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--rv-text-mute);
  font-weight: 600;
}

/* Sparkline / trend bars ----------------------------------------- */
.rv-spark { display: flex; align-items: flex-end; gap: 4px; height: 64px; }
.rv-spark .bar {
  flex: 1; min-width: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--primary), rgba(0,217,255,.18));
  transition: height .4s var(--tdy-ease, cubic-bezier(.4,0,.2,1));
}

/* Buttons --------------------------------------------------------- */
.rv-btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font-family: var(--font-primary, sans-serif); font-weight: 600; font-size: .9rem;
  padding: .65rem 1.2rem; border-radius: 10px; border: 1px solid transparent;
  text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.rv-btn:active { transform: translateY(1px); }
.rv-btn--primary {
  background: var(--gradient-primary, linear-gradient(135deg,#00D9FF,#00A69C));
  color: var(--dark); box-shadow: 0 6px 18px -6px rgba(0,217,255,.6);
}
.rv-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -8px rgba(0,217,255,.7); }
.rv-btn--ghost { background: rgba(255,255,255,.04); color: var(--rv-text); border-color: var(--rv-line-soft); }
.rv-btn--ghost:hover { background: rgba(255,255,255,.09); border-color: var(--rv-line); }
.rv-btn--danger { background: rgba(255,107,122,.12); color: var(--rv-bad); border-color: rgba(255,107,122,.3); }
.rv-btn--danger:hover { background: rgba(255,107,122,.2); }
.rv-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.rv-btn--block { width: 100%; justify-content: center; }

/* Coordinate display (the heart of blind mode) ------------------- */
.rv-coordinate {
  font-family: var(--rv-mono);
  font-size: clamp(2.8rem, 9vw, 6rem); font-weight: 700;
  letter-spacing: .12em; text-align: center;
  color: var(--rv-text);
  text-shadow: 0 0 38px rgba(0, 217, 255, 0.35);
  user-select: all;
}
.rv-coordinate .dash { color: var(--primary); opacity: .55; }

/* Stage stepper --------------------------------------------------- */
.rv-stepper { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.rv-step {
  cursor: pointer; border: 1px solid var(--rv-line-soft); background: rgba(255,255,255,.03);
  color: var(--rv-text-dim); border-radius: 999px; padding: .4rem 1rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  transition: all .18s var(--tdy-ease, ease);
}
.rv-step:hover { color: var(--rv-text); border-color: var(--rv-line); }
.rv-step.is-active {
  color: var(--dark); background: var(--primary); border-color: var(--primary);
  box-shadow: 0 6px 18px -8px rgba(0,217,255,.7);
}
.rv-step.is-done { color: var(--rv-good); border-color: rgba(52,229,176,.35); }
.rv-step.is-done::before { content: '\2713\00a0'; }

/* Notes pane ------------------------------------------------------ */
.rv-notes-editor {
  min-height: 220px; border-radius: 12px; padding: 1rem 1.1rem;
  background: rgba(7,10,28,.6); border: 1px solid var(--rv-line-soft); color: var(--rv-text);
  font-size: 1rem; line-height: 1.7; outline: none; resize: vertical; overflow: auto;
}
.rv-notes-editor:focus { border-color: var(--rv-line); box-shadow: 0 0 0 3px rgba(0,217,255,.12); }
.rv-notes-editor:empty::before { content: attr(data-placeholder); color: var(--rv-text-mute); }
.rv-toolbar { display: flex; gap: .25rem; margin-bottom: .6rem; flex-wrap: wrap; }
.rv-tool {
  cursor: pointer; background: rgba(255,255,255,.04); border: 1px solid var(--rv-line-soft);
  color: var(--rv-text-dim); border-radius: 7px; width: 34px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
}
.rv-tool:hover { color: var(--rv-text); background: rgba(255,255,255,.09); }

/* Sketch pad ------------------------------------------------------ */
.rv-sketch-shell { display: flex; flex-direction: column; gap: .6rem; }
.rv-canvas-frame {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--rv-line-soft); background: #0B0F22;
  box-shadow: inset 0 0 60px rgba(0,0,0,.4);
}
.rv-canvas-frame canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.rv-sketch-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rv-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
}
.rv-swatch.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,217,255,.3); }
.rv-range { accent-color: var(--primary); }

/* Saved-state pill ------------------------------------------------ */
.rv-saved {
  font-size: .72rem; font-family: var(--rv-mono); color: var(--rv-text-mute);
  display: inline-flex; align-items: center; gap: .4rem;
}
.rv-saved .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rv-text-mute); }
.rv-saved.is-ok .dot { background: var(--rv-good); }
.rv-saved.is-busy .dot { background: var(--rv-warn); animation: rv-pulse 1s infinite; }
@keyframes rv-pulse { 0%,100%{opacity:.3} 50%{opacity:1} }

/* Reveal page ----------------------------------------------------- */
.rv-reveal-img {
  width: 100%; border-radius: 14px; border: 1px solid var(--rv-line); display: block;
  opacity: 0; transform: scale(1.02); transition: opacity 1.1s ease, transform 1.4s ease;
}
.rv-reveal-img.is-in { opacity: 1; transform: scale(1); }
.rv-score-ring { display: flex; align-items: center; gap: 1.25rem; }
.rv-score-num {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 3.4rem; font-weight: 700; line-height: 1;
  background: var(--gradient-primary, linear-gradient(135deg,#00D9FF,#00A69C));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.rv-hit, .rv-miss {
  display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .75rem;
  border-radius: 9px; font-size: .9rem; margin-bottom: .45rem; line-height: 1.4;
}
.rv-hit  { background: rgba(52,229,176,.1);  border: 1px solid rgba(52,229,176,.25); }
.rv-miss { background: rgba(255,107,122,.08); border: 1px solid rgba(255,107,122,.22); color: var(--rv-text-dim); }
.rv-hit i  { color: var(--rv-good); margin-top: .15rem; }
.rv-miss i { color: var(--rv-bad);  margin-top: .15rem; }

/* Pools / targets ------------------------------------------------- */
.rv-pool-card { display: flex; flex-direction: column; gap: .75rem; }
.rv-pool-card h3 { font-family: var(--font-display, sans-serif); font-size: 1.15rem; margin: 0; }
.rv-pool-meta { font-size: .78rem; color: var(--rv-text-mute); display: flex; gap: 1rem; }
.rv-thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.rv-thumb { aspect-ratio: 1; border-radius: 8px; object-fit: cover; border: 1px solid var(--rv-line-soft); width:100%; }
.rv-blind-tile {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--rv-line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  color: var(--rv-text-mute);
  background:
    repeating-linear-gradient(45deg, rgba(0,217,255,.03) 0 8px, rgba(0,217,255,.07) 8px 16px),
    var(--rv-surface);
}
.rv-blind-tile i { font-size: 1.1rem; opacity: .6; color: var(--primary); }
.rv-blind-tile .rv-mono { font-size: .62rem; letter-spacing: .04em; color: var(--rv-text-dim); }
.rv-reveal-toggle {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .78rem;
  color: var(--rv-text-dim); border: 1px solid var(--rv-line-soft); border-radius: 8px; padding: .35rem .7rem;
}
.rv-reveal-toggle:hover { color: var(--rv-text); border-color: var(--rv-line); }
.rv-reveal-toggle.is-on { color: var(--rv-bad); border-color: rgba(255, 107, 122, .4); }
.rv-reveal-toggle input { accent-color: var(--rv-bad); }
.rv-dropzone {
  border: 2px dashed var(--rv-line); border-radius: 14px; padding: 2.5rem 1rem; text-align: center;
  color: var(--rv-text-dim); transition: background .15s, border-color .15s; cursor: pointer;
}
.rv-dropzone.is-over { background: rgba(0,217,255,.07); border-color: var(--primary); color: var(--rv-text); }

/* History --------------------------------------------------------- */
.rv-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rv-table th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--rv-text-mute); font-weight: 700; padding: .6rem .8rem; border-bottom: 1px solid var(--rv-line-soft);
}
.rv-table td { padding: .7rem .8rem; border-bottom: 1px solid var(--rv-line-soft); }
.rv-table tr { transition: background .12s; }
.rv-table tbody tr:hover { background: rgba(255,255,255,.03); cursor: pointer; }
.rv-table .coord { font-family: var(--rv-mono); color: var(--primary); }

/* Status badges --------------------------------------------------- */
.rv-badge {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .2rem .55rem; border-radius: 999px;
}
.rv-badge--open     { background: rgba(0,217,255,.14);  color: var(--primary); }
.rv-badge--recorded { background: rgba(255,200,87,.14);  color: var(--rv-warn); }
.rv-badge--revealed { background: rgba(139,124,246,.16); color: #b9acff; }
.rv-badge--scored   { background: rgba(52,229,176,.14);  color: var(--rv-good); }
.rv-badge--abandoned{ background: rgba(255,255,255,.06); color: var(--rv-text-mute); }

/* Forms ----------------------------------------------------------- */
/* min-width:0 lets a flex/grid child shrink below its content size — without it a long
   <select> option (the pool name or protocol label) forces the cell wider than the modal,
   which is what produced the horizontal scroll + clipped right column. */
.rv-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; min-width: 0; }
.rv-field label { font-size: .78rem; font-weight: 600; color: var(--rv-text-dim); }
.rv-grid > * { min-width: 0; }
.rv-input, .rv-select {
  width: 100%; box-sizing: border-box; max-width: 100%;
  background: rgba(7,10,28,.6); border: 1px solid var(--rv-line-soft); color: var(--rv-text);
  border-radius: 9px; padding: .6rem .8rem; font-size: .95rem; font-family: inherit; outline: none;
}
/* native select: keep its own (sometimes long) value text inside the box */
.rv-select { text-overflow: ellipsis; }
.rv-input:focus, .rv-select:focus { border-color: var(--rv-line); box-shadow: 0 0 0 3px rgba(0,217,255,.12); }

/* Empty + helper -------------------------------------------------- */
.rv-empty { text-align: center; color: var(--rv-text-mute); padding: 3rem 1rem; }
.rv-empty i { font-size: 2.2rem; opacity: .4; display: block; margin-bottom: .8rem; }
.rv-divider { height: 1px; background: var(--rv-line-soft); margin: 1.25rem 0; border: 0; }
.rv-muted { color: var(--rv-text-mute); }
.rv-mono { font-family: var(--rv-mono); }
.rv-fade-in { animation: rv-fade .5s ease both; }
@keyframes rv-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Modal ----------------------------------------------------------- */
.rv-modal-back {
  position: fixed; inset: 0; background: rgba(3,5,15,.72); display: flex;
  align-items: center; justify-content: center; z-index: 210; padding: 1rem;
}
.rv-modal { width: 100%; max-width: 460px; }
.rv-modal--wide {
  max-width: 640px; max-height: 88vh; overflow-y: auto;
  /* keep the rounded card corners clean while the body scrolls */
  scroll-padding: 1.4rem; scrollbar-gutter: stable;
}
/* Thin, themed scrollbar — replaces the harsh OS default (Firefox) */
.rv-modal--wide { scrollbar-width: thin; scrollbar-color: rgba(120,140,200,.35) transparent; }
/* …and WebKit/Chromium */
.rv-modal--wide::-webkit-scrollbar { width: 8px; }
.rv-modal--wide::-webkit-scrollbar-track { background: transparent; margin: 14px 0; }
.rv-modal--wide::-webkit-scrollbar-thumb {
  background: rgba(120,140,200,.32); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
.rv-modal--wide::-webkit-scrollbar-thumb:hover { background: rgba(150,168,228,.55); background-clip: padding-box; }

/* ARV outcome pick (radio chips) --------------------------------- */
.rv-pickopt {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  padding: .55rem .85rem; border-radius: 10px; font-size: .9rem;
  background: rgba(255,255,255,.04); border: 1px solid var(--rv-line-soft);
  color: var(--rv-text); transition: border-color .15s, background .15s;
}
.rv-pickopt.is-on { border-color: var(--primary); background: rgba(0,217,255,.1); }

/* Top-bar right cluster + profile menu --------------------------- */
.rv-topbar-right { display: flex; align-items: center; gap: 1rem; }

.rv-profile { position: relative; }
.rv-profile-btn {
  display: inline-flex; align-items: center; gap: .55rem; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--rv-line-soft);
  color: var(--rv-text); border-radius: 999px; padding: .3rem .75rem .3rem .35rem;
  font-family: inherit; font-size: .85rem; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.rv-profile-btn:hover { background: rgba(255,255,255,.08); border-color: var(--rv-line); }
.rv-profile-avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display, 'Space Grotesk', sans-serif); font-weight: 700; font-size: .85rem;
  color: var(--dark); background: var(--gradient-primary, linear-gradient(135deg,#00D9FF,#00A69C));
}
.rv-profile-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-profile-caret { font-size: .65rem; color: var(--rv-text-mute); transition: transform .18s; }
.rv-profile-caret.is-open { transform: rotate(180deg); }

.rv-profile-menu {
  position: absolute; right: 0; top: calc(100% + .55rem); z-index: 60;
  min-width: 230px; padding: .6rem;
  background: linear-gradient(180deg, var(--rv-surface-2) 0%, var(--rv-surface) 100%);
  border: 1px solid var(--rv-line); border-radius: 14px; box-shadow: var(--rv-glow);
}
.rv-profile-id { padding: .35rem .55rem .1rem; }
.rv-profile-id-name { font-weight: 600; font-size: .9rem; }
.rv-profile-id-email { font-size: .72rem; color: var(--rv-text-mute); margin-top: .15rem; }
.rv-profile-id .rv-badge { margin-top: .45rem; }
.rv-profile-item {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none;
  color: var(--rv-text-dim); font-family: inherit; font-size: .88rem; font-weight: 500;
  padding: .55rem .55rem; border-radius: 9px; transition: background .12s, color .12s;
}
.rv-profile-item:hover { background: rgba(255,255,255,.06); color: var(--rv-text); }
.rv-profile-item i { width: 1.1rem; text-align: center; color: var(--rv-text-mute); }

@media (max-width: 640px) {
  .rv-profile-name { display: none; }
  .rv-topbar-right { gap: .5rem; }
}
