/*
 * rgp-hover.css — GODISNOWHERE Research Graph Protocol
 * Styles for the RGP hover card and [data-rgp-node] trigger affordances.
 *
 * Scope:
 *   #rgp-hover-card      — singleton floating card
 *   .rgp-node-trigger    — any element with data-rgp-node attribute
 *
 * z-index budget:
 *   article content   ~1
 *   toolbar           ~500
 *   nav               600
 *   overlays          700–800
 *   rgp hover card    1100   ← above everything, including nav
 *
 * Does NOT touch: #ref-panel, #research-sidebar, .article-toolbar,
 *                 or any existing site classes.
 */

/* ── Trigger affordance ─────────────────────────────────────────────────────── */

.rgp-node-trigger {
  cursor:          help;
  border-bottom:   1px dashed rgba(201, 147, 42, 0.55);   /* gold, dashed */
  padding-bottom:  1px;
  transition:      border-color 0.15s ease, color 0.15s ease;
}

.rgp-node-trigger:hover,
.rgp-node-trigger:focus {
  border-bottom-color: rgba(201, 147, 42, 1);
  outline:             none;
}

/* ── Hover card container ───────────────────────────────────────────────────── */

#rgp-hover-card {
  position:         absolute;
  top:              0;
  left:             0;
  z-index:          1100;
  width:            320px;
  max-width:        calc(100vw - 24px);

  background:       rgba(12, 12, 12, 0.97);
  border:           1px solid rgba(201, 147, 42, 0.28);
  border-radius:    6px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.65),
    0 1px 4px  rgba(0, 0, 0, 0.45),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.04);

  font-family:      'Inter', sans-serif;
  font-size:        13px;
  line-height:      1.5;
  color:            #e8e2d9;

  /* Hidden by default — toggled by .rgp-card-visible */
  opacity:          0;
  pointer-events:   none;
  transform:        translateY(-4px);
  transition:
    opacity   0.15s ease,
    transform 0.15s ease;

  /* Prevent card from being partially hidden behind sticky elements */
  will-change:      transform, opacity;
}

#rgp-hover-card.rgp-card-visible {
  opacity:          1;
  pointer-events:   auto;
  transform:        translateY(0);
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

.rgp-card-header {
  display:          flex;
  align-items:      baseline;
  gap:              8px;
  padding:          10px 12px 6px;
  border-bottom:    1px solid rgba(255, 255, 255, 0.07);
}

.rgp-card-type {
  font-size:        10px;
  font-weight:      600;
  letter-spacing:   0.08em;
  text-transform:   uppercase;
  color:            #C9932A;           /* brand gold */
  white-space:      nowrap;
  flex-shrink:      0;
}

.rgp-card-label {
  font-size:        14px;
  font-weight:      600;
  color:            #f0ebe3;
  line-height:      1.3;
}

/* ── Confidence badge ───────────────────────────────────────────────────────── */

.rgp-card-confidence {
  display:          flex;
  align-items:      center;
  gap:              6px;
  padding:          5px 12px;
  font-size:        11px;
  font-weight:      500;
  letter-spacing:   0.04em;
  border-bottom:    1px solid rgba(255, 255, 255, 0.05);
}

.rgp-conf-pip {
  width:            7px;
  height:           7px;
  border-radius:    50%;
  flex-shrink:      0;
}

/* Confidence colour coding */
.rgp-conf-strong      { color: #5aad6b; }
.rgp-conf-strong      .rgp-conf-pip { background: #5aad6b; }

.rgp-conf-supported   { color: #7ebfdc; }
.rgp-conf-supported   .rgp-conf-pip { background: #7ebfdc; }

.rgp-conf-contested   { color: #e89a3c; }
.rgp-conf-contested   .rgp-conf-pip { background: #e89a3c; }

.rgp-conf-speculative { color: #a78bcc; }
.rgp-conf-speculative .rgp-conf-pip { background: #a78bcc; }

.rgp-conf-unsupported { color: #c05c5c; }
.rgp-conf-unsupported .rgp-conf-pip { background: #c05c5c; }

/* ── Summary text ───────────────────────────────────────────────────────────── */

.rgp-card-summary {
  padding:          8px 12px;
  font-size:        12.5px;
  color:            #cbc4b8;
  line-height:      1.55;
  border-bottom:    1px solid rgba(255, 255, 255, 0.05);
}

/* ── Sections (related claims, sources) ─────────────────────────────────────── */

.rgp-card-section {
  padding:          7px 12px;
  border-bottom:    1px solid rgba(255, 255, 255, 0.05);
}

.rgp-card-section:last-of-type {
  border-bottom:    none;
}

.rgp-card-section-title {
  font-size:        10px;
  font-weight:      600;
  letter-spacing:   0.07em;
  text-transform:   uppercase;
  color:            rgba(255, 255, 255, 0.35);
  margin-bottom:    5px;
}

.rgp-card-list {
  list-style:       none;
  margin:           0;
  padding:          0;
  display:          flex;
  flex-direction:   column;
  gap:              3px;
}

.rgp-card-list li {
  font-size:        12px;
  color:            #b8b0a4;
  line-height:      1.4;
  display:          flex;
  align-items:      baseline;
  gap:              5px;
  flex-wrap:        wrap;
}

.rgp-card-list code {
  font-family:      'Menlo', 'Consolas', monospace;
  font-size:        11px;
  color:            #9fb8c8;
  background:       rgba(255, 255, 255, 0.06);
  padding:          1px 4px;
  border-radius:    3px;
}

/* ── Relation chips ────────────────────────────────────────────────────────── */

.rgp-relation-list {
  gap:              4px;
}

.rgp-relation-chip {
  display:          flex !important;
  align-items:      center;
  gap:              5px;
  padding:          2px 0;
}

.rgp-rel-verb {
  font-size:        10px;
  font-weight:      600;
  letter-spacing:   0.04em;
  color:            #7a9fb8;
  text-transform:   uppercase;
  white-space:      nowrap;
  flex-shrink:      0;
  min-width:        60px;
}

.rgp-rel-label {
  font-size:        12px;
  color:            #c9bfb4;
  flex:             1;
}

.rgp-rel-add {
  background:       none;
  border:           1px solid rgba(201, 147, 42, 0.25);
  border-radius:    3px;
  color:            rgba(201, 147, 42, 0.65);
  font-size:        11px;
  line-height:      1;
  padding:          1px 4px;
  cursor:           pointer;
  flex-shrink:      0;
  transition:       border-color 0.15s, color 0.15s;
}

.rgp-rel-add:hover {
  border-color:     rgba(201, 147, 42, 0.8);
  color:            rgba(201, 147, 42, 1);
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */

.rgp-card-footer {
  display:          flex;
  align-items:      center;
  gap:              8px;
  padding:          5px 8px 6px 12px;
  border-top:       1px solid rgba(255, 255, 255, 0.05);
  flex-wrap:        wrap;
}

.rgp-card-count {
  font-size:        9.5px;
  color:            rgba(255, 255, 255, 0.18);
  letter-spacing:   0.02em;
  flex:             1;
  text-align:       center;
}

.rgp-card-id {
  font-family:      'Menlo', 'Consolas', monospace;
  font-size:        10px;
  color:            rgba(255, 255, 255, 0.22);
  letter-spacing:   0.02em;
  user-select:      all;
}

.rgp-card-close {
  background:       none;
  border:           none;
  color:            rgba(255, 255, 255, 0.3);
  font-size:        14px;
  line-height:      1;
  cursor:           pointer;
  padding:          2px 4px;
  border-radius:    3px;
  transition:       color 0.1s ease;
}

.rgp-card-close:hover {
  color:            rgba(255, 255, 255, 0.75);
}

/* ── Loading / empty states ─────────────────────────────────────────────────── */

.rgp-card-loading,
.rgp-card-empty {
  padding:          14px 12px;
  font-size:        12.5px;
  color:            rgba(255, 255, 255, 0.4);
  text-align:       center;
}

.rgp-card-empty .rgp-card-type {
  display:          block;
  margin-bottom:    6px;
}

.rgp-card-empty p {
  margin:           4px 0;
}

.rgp-card-hint {
  font-size:        11px;
  color:            rgba(255, 255, 255, 0.25) !important;
  font-style:       italic;
}

/* ── Source node: quality badge ─────────────────────────────────────────────── */

.rgp-card-quality {
  padding:          4px 12px 5px;
  font-size:        10.5px;
  font-weight:      500;
  letter-spacing:   0.04em;
  color:            rgba(159, 184, 200, 0.75);   /* steel blue — archival feel */
  border-bottom:    1px solid rgba(255, 255, 255, 0.05);
  text-transform:   lowercase;
}

/* ── Source node: action buttons ─────────────────────────────────────────────── */

.rgp-card-actions {
  border-bottom:    none;
}

.rgp-action-btns {
  display:          flex;
  flex-wrap:        wrap;
  gap:              5px;
  margin-top:       2px;
}

.rgp-action-btn {
  font-family:      'Inter', sans-serif;
  font-size:        10.5px;
  font-weight:      500;
  letter-spacing:   0.04em;
  color:            rgba(201, 147, 42, 0.85);
  background:       rgba(201, 147, 42, 0.07);
  border:           1px solid rgba(201, 147, 42, 0.25);
  border-radius:    3px;
  padding:          3px 8px;
  cursor:           pointer;
  transition:       background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space:      nowrap;
}

.rgp-action-btn:hover {
  background:       rgba(201, 147, 42, 0.16);
  border-color:     rgba(201, 147, 42, 0.55);
  color:            rgba(201, 147, 42, 1);
}

/* ── Add to Query row (universal — all node types) ───────────────────────────── */

.rgp-card-tray-row {
  padding:          6px 12px 4px;
  border-top:       1px solid rgba(255, 255, 255, 0.05);
}

.rgp-card-add-query {
  font-family:      'Inter', sans-serif;
  font-size:        10.5px;
  font-weight:      500;
  letter-spacing:   0.04em;
  color:            rgba(90, 173, 107, 0.85);
  background:       rgba(90, 173, 107, 0.08);
  border:           1px solid rgba(90, 173, 107, 0.25);
  border-radius:    3px;
  padding:          3px 10px;
  cursor:           pointer;
  width:            100%;
  text-align:       left;
  transition:       background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.rgp-card-add-query:hover {
  background:       rgba(90, 173, 107, 0.18);
  border-color:     rgba(90, 173, 107, 0.5);
  color:            rgba(90, 173, 107, 1);
}

/* ── Reduced-motion ─────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  #rgp-hover-card {
    transition: none;
  }
}

/* ── Mobile: card becomes a bottom sheet ────────────────────────────────────── */

@media (max-width: 600px) {
  #rgp-hover-card.rgp-card-visible {
    position:   fixed;
    bottom:     0;
    left:       0;
    right:      0;
    top:        auto;
    width:      100%;
    max-width:  100%;
    border-radius: 10px 10px 0 0;
    border-left:   none;
    border-right:  none;
    border-bottom: none;
    max-height:    60vh;
    overflow-y:    auto;
    transform:     translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RGP QUERY TRAY
   Fixed bottom-right drawer. z-index 1050 (below hover card at 1100).
   Does not touch #ref-panel, #research-sidebar, or any existing site classes.
═══════════════════════════════════════════════════════════════════════════════ */

#rgp-query-tray {
  position:         fixed;
  bottom:           0;
  right:            24px;
  z-index:          1050;
  width:            320px;
  max-width:        calc(100vw - 32px);
  font-family:      'Inter', sans-serif;
  font-size:        13px;
  color:            rgba(255, 255, 255, 0.88);
}

/* ── Toggle tab ── */

.rgp-tray-toggle {
  display:          flex;
  align-items:      center;
  gap:              7px;
  width:            100%;
  padding:          8px 14px;
  background:       rgba(18, 16, 12, 0.96);
  border:           1px solid rgba(201, 147, 42, 0.35);
  border-bottom:    none;
  border-radius:    6px 6px 0 0;
  color:            rgba(201, 147, 42, 0.9);
  font-family:      'Oswald', sans-serif;
  font-size:        12px;
  font-weight:      400;
  letter-spacing:   0.1em;
  text-transform:   uppercase;
  cursor:           pointer;
  transition:       background 0.15s ease, border-color 0.15s ease;
}

.rgp-tray-toggle:hover {
  background:       rgba(30, 26, 18, 0.98);
  border-color:     rgba(201, 147, 42, 0.6);
}

.rgp-tray-toggle-icon {
  font-size:        15px;
  line-height:      1;
  color:            rgba(201, 147, 42, 0.7);
}

.rgp-tray-badge {
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  min-width:        18px;
  height:           18px;
  padding:          0 5px;
  background:       rgba(201, 147, 42, 0.85);
  color:            rgba(18, 16, 12, 1);
  border-radius:    9px;
  font-size:        10.5px;
  font-weight:      700;
  margin-left:      auto;
}

/* ── Body panel ── */

.rgp-tray-body {
  display:          none;
  flex-direction:   column;
  gap:              8px;
  padding:          12px;
  background:       rgba(14, 12, 9, 0.97);
  border:           1px solid rgba(201, 147, 42, 0.35);
  border-top:       1px solid rgba(201, 147, 42, 0.18);
  border-radius:    0;
  max-height:       55vh;
  overflow-y:       auto;
}

#rgp-query-tray.rgp-tray--open .rgp-tray-body {
  display:          flex;
}

/* ── Toggle hint text ── */

.rgp-tray-toggle-hint {
  font-size:        9.5px;
  letter-spacing:   0.08em;
  color:            rgba(201, 147, 42, 0.4);
  font-family:      'Inter', sans-serif;
  text-transform:   lowercase;
  margin-left:      2px;
}

/* ── Pulse animation on load to draw attention ── */

@keyframes rgpTrayPulse {
  0%   { border-color: rgba(201, 147, 42, 0.35); }
  50%  { border-color: rgba(201, 147, 42, 0.85); box-shadow: 0 0 10px rgba(201,147,42,0.25); }
  100% { border-color: rgba(201, 147, 42, 0.35); }
}

.rgp-tray-toggle {
  animation: rgpTrayPulse 1.8s ease 0.6s 2;
}

/* ── Onboarding panel ── */

.rgp-tray-onboard {
  padding:          4px 0 6px;
}

.rgp-tray-onboard-title {
  font-size:        10.5px;
  font-family:      'Oswald', sans-serif;
  letter-spacing:   0.1em;
  text-transform:   uppercase;
  color:            rgba(201, 147, 42, 0.6);
  margin:           0 0 8px;
}

.rgp-tray-onboard-steps {
  margin:           0;
  padding-left:     16px;
  font-size:        11.5px;
  color:            rgba(255, 255, 255, 0.5);
  line-height:      1.9;
  list-style:       decimal;
}

.rgp-tray-onboard-steps li {
  padding-left:     2px;
}

.rgp-tray-onboard-steps strong {
  color:            rgba(201, 147, 42, 0.85);
  font-weight:      500;
}

.rgp-onboard-highlight {
  color:            rgba(201, 147, 42, 0.75);
  border-bottom:    1px dashed rgba(201, 147, 42, 0.5);
}

.rgp-onboard-op {
  display:          inline-block;
  font-size:        10px;
  font-weight:      700;
  padding:          1px 5px;
  border-radius:    3px;
  letter-spacing:   0.05em;
  vertical-align:   middle;
}

.rgp-onboard-op.and {
  background:       rgba(90, 173, 107, 0.18);
  color:            rgba(90, 173, 107, 0.95);
  border:           1px solid rgba(90, 173, 107, 0.3);
}

.rgp-onboard-op.or {
  background:       rgba(126, 191, 220, 0.18);
  color:            rgba(126, 191, 220, 0.95);
  border:           1px solid rgba(126, 191, 220, 0.3);
}

.rgp-onboard-op.not {
  background:       rgba(192, 92, 92, 0.18);
  color:            rgba(192, 92, 92, 0.95);
  border:           1px solid rgba(192, 92, 92, 0.3);
}

/* ── Node chips ── */

.rgp-tray-chip {
  display:          flex;
  align-items:      center;
  gap:              6px;
  padding:          5px 8px;
  background:       rgba(255, 255, 255, 0.04);
  border:           1px solid rgba(255, 255, 255, 0.08);
  border-radius:    4px;
  flex-shrink:      0;
}

.rgp-chip-type {
  font-size:        9.5px;
  font-weight:      600;
  letter-spacing:   0.08em;
  text-transform:   uppercase;
  color:            rgba(201, 147, 42, 0.65);
  flex-shrink:      0;
}

.rgp-chip-label {
  font-size:        12.5px;
  color:            rgba(255, 255, 255, 0.85);
  flex:             1;
  white-space:      nowrap;
  overflow:         hidden;
  text-overflow:    ellipsis;
}

/* Operator toggle button */

.rgp-chip-op {
  font-family:      'Oswald', sans-serif;
  font-size:        10px;
  font-weight:      600;
  letter-spacing:   0.06em;
  padding:          2px 6px;
  border-radius:    3px;
  border:           1px solid transparent;
  cursor:           pointer;
  flex-shrink:      0;
  transition:       background 0.12s ease, color 0.12s ease;
}

.rgp-chip-op--and {
  background:       rgba(90, 173, 107, 0.18);
  color:            rgba(90, 173, 107, 0.95);
  border-color:     rgba(90, 173, 107, 0.3);
}
.rgp-chip-op--and:hover {
  background:       rgba(90, 173, 107, 0.3);
}

.rgp-chip-op--or {
  background:       rgba(126, 191, 220, 0.18);
  color:            rgba(126, 191, 220, 0.95);
  border-color:     rgba(126, 191, 220, 0.3);
}
.rgp-chip-op--or:hover {
  background:       rgba(126, 191, 220, 0.3);
}

.rgp-chip-op--not {
  background:       rgba(192, 92, 92, 0.18);
  color:            rgba(192, 92, 92, 0.95);
  border-color:     rgba(192, 92, 92, 0.3);
}
.rgp-chip-op--not:hover {
  background:       rgba(192, 92, 92, 0.3);
}

/* Remove button */

.rgp-chip-remove {
  font-size:        11px;
  color:            rgba(255, 255, 255, 0.3);
  background:       none;
  border:           none;
  cursor:           pointer;
  padding:          0 2px;
  flex-shrink:      0;
  transition:       color 0.12s ease;
}
.rgp-chip-remove:hover {
  color:            rgba(192, 92, 92, 0.85);
}

/* ── Plain-English explanation ── */

.rgp-tray-explain {
  font-size:        11.5px;
  color:            rgba(255, 255, 255, 0.45);
  line-height:      1.5;
  margin:           2px 0 0;
  padding:          6px 0 0;
  border-top:       1px solid rgba(255, 255, 255, 0.06);
}

.rgp-tray-explain strong {
  color:            rgba(255, 255, 255, 0.75);
  font-weight:      500;
}

/* ── Action buttons ── */

.rgp-tray-actions {
  display:          flex;
  flex-wrap:        wrap;
  gap:              6px;
  padding-top:      6px;
  border-top:       1px solid rgba(255, 255, 255, 0.06);
}

.rgp-tray-btn {
  font-family:      'Inter', sans-serif;
  font-size:        10.5px;
  font-weight:      500;
  letter-spacing:   0.03em;
  padding:          4px 10px;
  border-radius:    3px;
  border:           1px solid transparent;
  cursor:           pointer;
  transition:       background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space:      nowrap;
}

.rgp-tray-btn--prompt {
  background:       rgba(201, 147, 42, 0.12);
  color:            rgba(201, 147, 42, 0.9);
  border-color:     rgba(201, 147, 42, 0.3);
}
.rgp-tray-btn--prompt:hover {
  background:       rgba(201, 147, 42, 0.22);
  border-color:     rgba(201, 147, 42, 0.6);
  color:            rgba(201, 147, 42, 1);
}

.rgp-tray-btn--json {
  background:       rgba(255, 255, 255, 0.04);
  color:            rgba(255, 255, 255, 0.4);
  border-color:     rgba(255, 255, 255, 0.1);
}
.rgp-tray-btn--json:hover {
  background:       rgba(255, 255, 255, 0.08);
  color:            rgba(255, 255, 255, 0.65);
}

.rgp-tray-btn--clear {
  background:       rgba(192, 92, 92, 0.08);
  color:            rgba(192, 92, 92, 0.65);
  border-color:     rgba(192, 92, 92, 0.2);
}
.rgp-tray-btn--clear:hover {
  background:       rgba(192, 92, 92, 0.18);
  color:            rgba(192, 92, 92, 0.9);
  border-color:     rgba(192, 92, 92, 0.4);
}

/* ── Mobile: tray becomes full-width ── */

@media (max-width: 600px) {
  #rgp-query-tray {
    right:    0;
    width:    100%;
    max-width:100%;
  }
  .rgp-tray-body {
    border-radius: 0;
    max-height:    50vh;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RGP DEEP RESEARCH PROMPT MODAL
   Full-screen overlay. z-index 1200 (above hover card and tray).
═══════════════════════════════════════════════════════════════════════════════ */

#rgp-prompt-modal {
  position:         fixed;
  inset:            0;
  z-index:          1200;
  background:       rgba(0, 0, 0, 0.75);
  display:          flex;
  align-items:      center;
  justify-content:  center;
  padding:          24px;
}

.rgp-prompt-modal-inner {
  background:       rgba(14, 12, 9, 0.98);
  border:           1px solid rgba(201, 147, 42, 0.4);
  border-radius:    6px;
  width:            100%;
  max-width:        680px;
  max-height:       80vh;
  display:          flex;
  flex-direction:   column;
  overflow:         hidden;
}

.rgp-prompt-modal-header {
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
  padding:          12px 16px;
  border-bottom:    1px solid rgba(255, 255, 255, 0.07);
  flex-shrink:      0;
}

.rgp-prompt-modal-title {
  font-family:      'Oswald', sans-serif;
  font-size:        13px;
  font-weight:      400;
  letter-spacing:   0.1em;
  text-transform:   uppercase;
  color:            rgba(201, 147, 42, 0.9);
}

.rgp-prompt-modal-close {
  background:       none;
  border:           none;
  color:            rgba(255, 255, 255, 0.35);
  font-size:        14px;
  cursor:           pointer;
  padding:          2px 4px;
  transition:       color 0.12s ease;
}
.rgp-prompt-modal-close:hover {
  color:            rgba(255, 255, 255, 0.75);
}

.rgp-prompt-modal-body {
  font-family:      'Inter', monospace;
  font-size:        12px;
  line-height:      1.65;
  color:            rgba(255, 255, 255, 0.75);
  padding:          16px;
  overflow-y:       auto;
  flex:             1;
  white-space:      pre-wrap;
  word-break:       break-word;
  margin:           0;
}

.rgp-prompt-modal-foot {
  display:          flex;
  align-items:      center;
  gap:              10px;
  padding:          10px 16px;
  border-top:       1px solid rgba(255, 255, 255, 0.07);
  flex-shrink:      0;
}

.rgp-prompt-copy-btn {
  font-family:      'Inter', sans-serif;
  font-size:        11px;
  font-weight:      500;
  padding:          5px 12px;
  background:       rgba(201, 147, 42, 0.12);
  color:            rgba(201, 147, 42, 0.9);
  border:           1px solid rgba(201, 147, 42, 0.3);
  border-radius:    3px;
  cursor:           pointer;
  transition:       background 0.12s ease;
}
.rgp-prompt-copy-btn:hover {
  background:       rgba(201, 147, 42, 0.22);
}

.rgp-prompt-copy-confirm {
  font-size:        11px;
  color:            rgba(90, 173, 107, 0.85);
}

/* ─── Modal header upgrade ──────────────────────────────────────────────────── */

.rgp-pm-header-left {
  display:          flex;
  flex-direction:   column;
  gap:              5px;
}

.rgp-pm-summary {
  display:          flex;
  flex-wrap:        wrap;
  gap:              5px;
}

.rgp-pm-summary-chip {
  font-family:      'Inter', sans-serif;
  font-size:        9px;
  font-weight:      600;
  letter-spacing:   0.06em;
  text-transform:   uppercase;
  padding:          2px 6px;
  border-radius:    2px;
  border:           1px solid transparent;
}
.rgp-pm-summary-chip--author  { background: rgba(100,149,237,0.12); color: rgba(100,149,237,0.9); border-color: rgba(100,149,237,0.25); }
.rgp-pm-summary-chip--topic   { background: rgba(90,200,120,0.10);  color: rgba(90,200,120,0.9);  border-color: rgba(90,200,120,0.25); }
.rgp-pm-summary-chip--claim   { background: rgba(220,120,80,0.12);  color: rgba(220,140,80,0.9);  border-color: rgba(220,120,80,0.25); }
.rgp-pm-summary-chip--book    { background: rgba(180,120,220,0.12); color: rgba(180,130,220,0.9); border-color: rgba(180,120,220,0.25); }
.rgp-pm-summary-chip--meta    { background: rgba(201,147,42,0.12);  color: rgba(201,147,42,0.9);  border-color: rgba(201,147,42,0.25); }
.rgp-pm-summary-chip--place   { background: rgba(160,160,160,0.12); color: rgba(180,180,180,0.9); border-color: rgba(160,160,160,0.25); }
.rgp-pm-summary-chip--mode    { background: rgba(255,255,255,0.06);  color: rgba(255,255,255,0.55); border-color: rgba(255,255,255,0.12); font-style: italic; }

/* ─── Tray mode selector ─────────────────────────────────────────────────────── */

.rgp-tray-mode-row {
  display:      flex;
  align-items:  center;
  gap:          6px;
  width:        100%;
  margin-bottom: 2px;
}

.rgp-tray-mode-label {
  font-size:    10px;
  color:        rgba(255,255,255,0.4);
  white-space:  nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rgp-tray-mode-select {
  flex:         1;
  font-family:  'Inter', sans-serif;
  font-size:    10.5px;
  padding:      3px 6px;
  background:   rgba(255,255,255,0.04);
  border:       1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  color:        rgba(255,255,255,0.75);
  cursor:       pointer;
  outline:      none;
}

.rgp-tray-mode-select:focus {
  border-color: rgba(201,147,42,0.4);
}

/* ─── Modal tabs ────────────────────────────────────────────────────────────── */

.rgp-pm-tabs {
  display:          flex;
  gap:              0;
  border-bottom:    1px solid rgba(255,255,255,0.07);
  flex-shrink:      0;
  padding:          0 16px;
}

.rgp-pm-tab {
  font-family:      'Inter', sans-serif;
  font-size:        11px;
  font-weight:      500;
  padding:          7px 14px;
  background:       none;
  border:           none;
  border-bottom:    2px solid transparent;
  color:            rgba(255,255,255,0.35);
  cursor:           pointer;
  transition:       color 0.12s ease, border-color 0.12s ease;
  margin-bottom:    -1px;
}
.rgp-pm-tab:hover {
  color:            rgba(255,255,255,0.65);
}
.rgp-pm-tab--active {
  color:            rgba(201,147,42,0.9);
  border-bottom-color: rgba(201,147,42,0.7);
}

/* ─── Pane container ────────────────────────────────────────────────────────── */

/* Override the original <pre> body to be a flex pane container */
.rgp-prompt-modal-body {
  padding:          0 !important;
  font-family:      inherit !important;
  font-size:        inherit !important;
  white-space:      normal !important;
}

.rgp-pm-pane {
  display:          none;
  overflow-y:       auto;
  padding:          16px 18px;
  height:           100%;
  box-sizing:       border-box;
}
.rgp-pm-pane--active {
  display:          block;
}

/* ─── Raw tab ───────────────────────────────────────────────────────────────── */

.rgp-pm-raw-pre {
  font-family:      'Courier New', monospace;
  font-size:        11.5px;
  line-height:      1.65;
  color:            rgba(255,255,255,0.65);
  white-space:      pre-wrap;
  word-break:       break-word;
  margin:           0;
}

/* ─── Formatted tab elements ────────────────────────────────────────────────── */

.rgp-pf-rule {
  border:           none;
  border-top:       1px solid rgba(255,255,255,0.08);
  margin:           10px 0;
}
.rgp-pf-rule--heavy {
  border-top:       1px solid rgba(201,147,42,0.25);
  margin:           14px 0 10px;
}

.rgp-pf-section {
  font-family:      'Oswald', sans-serif;
  font-size:        10px;
  font-weight:      400;
  letter-spacing:   0.14em;
  text-transform:   uppercase;
  color:            rgba(201,147,42,0.75);
  margin:           10px 0 4px;
}

.rgp-pf-section-num {
  font-family:      'Inter', sans-serif;
  font-size:        12px;
  font-weight:      600;
  color:            rgba(255,255,255,0.85);
  margin:           12px 0 4px;
  padding-left:     2px;
}

.rgp-pf-prose {
  font-family:      'Inter', sans-serif;
  font-size:        12px;
  line-height:      1.65;
  color:            rgba(255,255,255,0.6);
  margin:           3px 0;
}

.rgp-pf-sub {
  font-family:      'Inter', sans-serif;
  font-size:        11.5px;
  line-height:      1.6;
  color:            rgba(255,255,255,0.5);
  margin:           2px 0 2px 12px;
  padding-left:     6px;
  border-left:      2px solid rgba(255,255,255,0.1);
}

.rgp-pf-gap {
  height:           6px;
}

/* ─── Node chips in formatted view ─────────────────────────────────────────── */

.rgp-pf-node {
  display:          flex;
  align-items:      center;
  gap:              8px;
  padding:          4px 0;
}

.rgp-pf-chip {
  font-family:      'Inter', sans-serif;
  font-size:        9px;
  font-weight:      600;
  letter-spacing:   0.06em;
  text-transform:   uppercase;
  padding:          2px 6px;
  border-radius:    2px;
  border:           1px solid transparent;
  flex-shrink:      0;
  min-width:        44px;
  text-align:       center;
}
.rgp-pf-chip--author  { background: rgba(100,149,237,0.12); color: rgba(100,149,237,0.9); border-color: rgba(100,149,237,0.25); }
.rgp-pf-chip--topic   { background: rgba(90,200,120,0.10);  color: rgba(90,200,120,0.9);  border-color: rgba(90,200,120,0.25); }
.rgp-pf-chip--claim   { background: rgba(220,120,80,0.12);  color: rgba(220,140,80,0.9);  border-color: rgba(220,120,80,0.25); }
.rgp-pf-chip--book    { background: rgba(180,120,220,0.12); color: rgba(180,130,220,0.9); border-color: rgba(180,120,220,0.25); }
.rgp-pf-chip--meta    { background: rgba(201,147,42,0.12);  color: rgba(201,147,42,0.9);  border-color: rgba(201,147,42,0.25); }
.rgp-pf-chip--place   { background: rgba(160,160,160,0.12); color: rgba(180,180,180,0.9); border-color: rgba(160,160,160,0.25); }

.rgp-pf-label {
  font-family:      'Inter', sans-serif;
  font-size:        12px;
  color:            rgba(255,255,255,0.8);
}

/* ─── Evidence table hint ───────────────────────────────────────────────────── */

.rgp-pf-table-hint {
  font-family:      'Courier New', monospace;
  font-size:        10.5px;
  color:            rgba(255,255,255,0.35);
  margin:           4px 0;
  padding:          4px 8px;
  background:       rgba(255,255,255,0.03);
  border-radius:    3px;
}

/* ─── Footer line ───────────────────────────────────────────────────────────── */

.rgp-pf-footer {
  font-family:      'Inter', sans-serif;
  font-size:        10px;
  color:            rgba(255,255,255,0.25);
  margin:           8px 0 0;
  text-align:       center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RGP RELATIONAL EXPANSION — Right Deep Research Sidebar
   Checkpoint: rgp-sidebar-relational-expansion-1
   ─────────────────────────────────────────────────────────────────────────────
   Scope: #rgp-relational-expand and its children.
   Does NOT touch any other sidebar section, #ref-panel, or article content.
═══════════════════════════════════════════════════════════════════════════════ */

/* ── Section wrapper ─────────────────────────────────────────────────────────── */

#rgp-relational-expand {
  border-top:  1px solid rgba(201, 147, 42, 0.18);
  margin-top:  4px;
  padding-top: 2px;
}

/* ── Section heading ─────────────────────────────────────────────────────────── */

.rge-head {
  display:        flex !important;
  align-items:    center;
  gap:            6px;
  font-size:      10.5px !important;
  letter-spacing: 0.08em !important;
  color:          rgba(201, 147, 42, 0.9) !important;
  text-transform: uppercase !important;
}

/* ── Champion badge ──────────────────────────────────────────────────────────── */

.rge-champion-badge {
  font-size:      8.5px;
  font-weight:    700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          rgba(201, 147, 42, 0.7);
  background:     rgba(201, 147, 42, 0.09);
  border:         1px solid rgba(201, 147, 42, 0.22);
  border-radius:  2px;
  padding:        1px 5px;
  margin-left:    auto;
}

/* ── Body container ──────────────────────────────────────────────────────────── */

.rge-body {
  padding: 4px 0 2px;
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */

.rge-empty {
  padding: 8px 0 4px;
}

.rge-empty p {
  font-size:   11.5px;
  line-height: 1.5;
  color:       rgba(255, 255, 255, 0.32);
  margin:      0;
  font-style:  italic;
}

/* ── Collapsible sub-sections ────────────────────────────────────────────────── */

.rge-sub {
  margin:  3px 0;
  padding: 0;
}

.rge-sub-head {
  display:       flex;
  align-items:   center;
  gap:           6px;
  font-family:   'Inter', sans-serif;
  font-size:     10.5px;
  font-weight:   600;
  letter-spacing: 0.05em;
  color:         rgba(255, 255, 255, 0.55);
  cursor:        pointer;
  padding:       5px 2px 4px;
  border-radius: 3px;
  user-select:   none;
  list-style:    none;
  transition:    color 0.12s ease;
}

.rge-sub-head::-webkit-details-marker { display: none; }
.rge-sub-head::marker                  { display: none; }

.rge-sub-head::before {
  content:   '▸';
  font-size: 9px;
  color:     rgba(201, 147, 42, 0.5);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.rge-sub[open] > .rge-sub-head::before {
  content:   '▾';
}

.rge-sub-head:hover {
  color: rgba(255, 255, 255, 0.82);
}

.rge-sub-body {
  padding: 4px 0 4px 14px;
}

/* ── Count badge ─────────────────────────────────────────────────────────────── */

.rge-count {
  font-size:   9px;
  font-weight: 600;
  color:       rgba(201, 147, 42, 0.65);
  background:  rgba(201, 147, 42, 0.1);
  border:      1px solid rgba(201, 147, 42, 0.2);
  border-radius: 10px;
  padding:     1px 5px;
  letter-spacing: 0;
}

/* ── Node chips ──────────────────────────────────────────────────────────────── */

.rge-chip-row {
  display:    flex;
  flex-wrap:  wrap;
  gap:        4px 5px;
  padding:    2px 0;
}

.rge-chip {
  display:        inline-flex;
  align-items:    center;
  gap:            4px;
  font-family:    'Inter', sans-serif;
  font-size:      11px;
  color:          rgba(232, 226, 217, 0.82);
  background:     rgba(255, 255, 255, 0.04);
  border:         1px solid rgba(255, 255, 255, 0.1);
  border-radius:  3px;
  padding:        2px 7px 2px 5px;
  cursor:         default;
  transition:     background 0.12s ease, border-color 0.12s ease;
  max-width:      100%;
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
}

.rge-chip:hover {
  background:     rgba(255, 255, 255, 0.08);
  border-color:   rgba(255, 255, 255, 0.2);
}

/* Operator variants */
.rge-chip--or {
  border-color:  rgba(90, 173, 107, 0.3);
  background:    rgba(90, 173, 107, 0.06);
}
.rge-chip--not {
  border-color:  rgba(192, 92, 92, 0.35);
  background:    rgba(192, 92, 92, 0.07);
  color:         rgba(255, 180, 180, 0.75);
  text-decoration: line-through;
}

/* Counter-node — red-tinted */
.rge-chip--counter {
  border-color:  rgba(192, 92, 92, 0.28);
  background:    rgba(192, 92, 92, 0.06);
  color:         rgba(232, 200, 200, 0.8);
}
.rge-chip--counter:hover {
  background:    rgba(192, 92, 92, 0.12);
  border-color:  rgba(192, 92, 92, 0.45);
}

/* Medium-confidence dim */
.rge-conf-med {
  opacity: 0.72;
}

/* ── Type pill (Author / Book / Topic / Claim etc.) ──────────────────────────── */

.rge-pill {
  font-size:      8.5px;
  font-weight:    700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding:        1px 4px;
  border-radius:  2px;
  flex-shrink:    0;
  background:     rgba(201, 147, 42, 0.12);
  color:          rgba(201, 147, 42, 0.8);
  border:         1px solid rgba(201, 147, 42, 0.2);
}

/* ── Operator group labels (Required / Optional / Excluded) ──────────────────── */

.rge-op-label {
  font-size:      9.5px;
  font-weight:    700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding:        1px 5px;
  border-radius:  2px;
}

.rge-op-label--required {
  color:       rgba(100, 180, 255, 0.9);
  background:  rgba(100, 180, 255, 0.1);
  border:      1px solid rgba(100, 180, 255, 0.22);
}

.rge-op-label--optional {
  color:       rgba(90, 200, 110, 0.9);
  background:  rgba(90, 200, 110, 0.08);
  border:      1px solid rgba(90, 200, 110, 0.22);
}

.rge-op-label--excluded {
  color:       rgba(220, 100, 100, 0.9);
  background:  rgba(220, 100, 100, 0.08);
  border:      1px solid rgba(220, 100, 100, 0.22);
}

/* ── Book rows ───────────────────────────────────────────────────────────────── */

.rge-book-row {
  margin: 2px 0;
}

.rge-book-row .rge-chip {
  width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.4;
}

/* ── Prompt action buttons ───────────────────────────────────────────────────── */

.rge-prompt-row {
  display:     flex;
  flex-wrap:   wrap;
  gap:         5px;
  padding-top: 2px;
}

.rge-prompt-btn {
  display:        inline-flex;
  align-items:    center;
  gap:            4px;
  font-family:    'Inter', sans-serif;
  font-size:      10.5px;
  font-weight:    500;
  letter-spacing: 0.03em;
  color:          rgba(201, 147, 42, 0.85);
  background:     rgba(201, 147, 42, 0.08);
  border:         1px solid rgba(201, 147, 42, 0.22);
  border-radius:  3px;
  padding:        3px 9px;
  text-decoration: none;
  white-space:    nowrap;
  cursor:         pointer;
  transition:     background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.rge-prompt-btn:hover {
  background:     rgba(201, 147, 42, 0.18);
  border-color:   rgba(201, 147, 42, 0.5);
  color:          rgba(201, 147, 42, 1);
}

/* Clipboard variant — slightly muted to distinguish from link buttons */
.rge-prompt-btn--copy {
  background:     rgba(255, 255, 255, 0.04);
  border-color:   rgba(255, 255, 255, 0.14);
  color:          rgba(232, 226, 217, 0.7);
  cursor:         pointer;
}

.rge-prompt-btn--copy:hover {
  background:     rgba(255, 255, 255, 0.09);
  border-color:   rgba(255, 255, 255, 0.28);
  color:          rgba(232, 226, 217, 1);
}

/* Confirmed state — green flash for 2 s */
.rge-prompt-btn--copied {
  background:     rgba(90, 173, 107, 0.14) !important;
  border-color:   rgba(90, 173, 107, 0.45) !important;
  color:          rgba(90, 173, 107, 1)    !important;
}

/* ── Topic Family grouping ───────────────────────────────────────────────────── */

/* Wrapper: small indent to visually nest families inside "Topics & Claims" */
.rge-family-groups {
  padding-left: 0;
}

/* Individual family sub-section — slightly less margin than top-level subs */
.rge-family-groups .rge-sub {
  margin: 2px 0;
}

/* Family icon — small, decorative, no extra spacing needed */
.rge-family-icon {
  font-size:   11px;
  line-height: 1;
  flex-shrink: 0;
}

/* Family label pill */
.rge-family-label {
  font-size:      9.5px;
  font-weight:    600;
  letter-spacing: 0.05em;
  color:          rgba(201, 147, 42, 0.75);
}

/* "Other Topics" label — dimmer to de-emphasise */
.rge-family-label--other {
  color: rgba(255, 255, 255, 0.38);
  font-weight: 500;
}

/* Chip row inside a family — slightly tighter gap */
.rge-chip-row--family {
  gap: 3px 4px;
}

/* ── Mobile: hide relational section ────────────────────────────────────────── */

@media (max-width: 900px) {
  #rgp-relational-expand {
    /* Sidebar is a drawer on mobile — section still renders but compact */
    font-size: 12px;
  }
}

/* ─── Modal footer upgrade ──────────────────────────────────────────────────── */

.rgp-prompt-modal-foot {
  display:          flex;
  align-items:      center;
  flex-wrap:        wrap;
  gap:              8px;
  padding:          10px 16px;
  border-top:       1px solid rgba(255,255,255,0.07);
  flex-shrink:      0;
}

.rgp-pm-foot-divider {
  width:            1px;
  height:           16px;
  background:       rgba(255,255,255,0.12);
  margin:           0 2px;
}

.rgp-pm-foot-label {
  font-family:      'Inter', sans-serif;
  font-size:        10px;
  color:            rgba(255,255,255,0.3);
  letter-spacing:   0.05em;
}

/* ─── AI deep-link buttons ──────────────────────────────────────────────────── */

.rgp-pm-ai-btn {
  font-family:      'Inter', sans-serif;
  font-size:        11px;
  font-weight:      500;
  padding:          4px 10px;
  border-radius:    3px;
  border:           1px solid transparent;
  text-decoration:  none;
  cursor:           pointer;
  transition:       background 0.12s ease, border-color 0.12s ease;
  line-height:      1;
}
.rgp-pm-ai-btn--chatgpt {
  background:       rgba(16,163,127,0.10);
  color:            rgba(16,163,127,0.9);
  border-color:     rgba(16,163,127,0.25);
}
.rgp-pm-ai-btn--chatgpt:hover {
  background:       rgba(16,163,127,0.20);
  border-color:     rgba(16,163,127,0.45);
}
.rgp-pm-ai-btn--grok {
  background:       rgba(120,100,220,0.10);
  color:            rgba(140,120,220,0.9);
  border-color:     rgba(120,100,220,0.25);
}
.rgp-pm-ai-btn--grok:hover {
  background:       rgba(120,100,220,0.20);
  border-color:     rgba(120,100,220,0.45);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RGP SIDEBAR MIRROR
   Read-only tray view inside #research-sidebar.
   Desktop only — hidden below 1024px (one surface at a time on mobile).
   Does not add interactivity; all actions go through the bottom drawer.
═══════════════════════════════════════════════════════════════════════════════ */

/* Hidden on mobile — sidebar itself is collapsed, mirror redundant */
@media (max-width: 1023px) {
  #rgp-tray-mirror { display: none; }
}

.rgp-mirror-section {
  border-top:       1px solid rgba(255, 255, 255, 0.07);
  margin-top:       8px;
  padding-top:      12px;
}

.rgp-mirror-head {
  display:          flex;
  align-items:      center;
  gap:              6px;
}

.rgp-mirror-badge {
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  min-width:        16px;
  height:           16px;
  padding:          0 4px;
  border-radius:    8px;
  background:       rgba(201, 147, 42, 0.75);
  color:            #0e0c09;
  font-size:        10px;
  font-weight:      700;
  font-family:      'Inter', sans-serif;
  line-height:      1;
}

.rgp-mirror-body {
  margin-top:       8px;
  display:          flex;
  flex-direction:   column;
  gap:              5px;
}

.rgp-mirror-empty {
  font-family:      'Inter', sans-serif;
  font-size:        11.5px;
  color:            rgba(255, 255, 255, 0.3);
  font-style:       italic;
  line-height:      1.5;
  margin:           0;
}

/* Read-only chip — same visual as tray chip but no hover/cursor */
.rgp-mirror-chip {
  display:          flex;
  align-items:      center;
  gap:              6px;
  padding:          4px 6px;
  border-radius:    4px;
  background:       rgba(255, 255, 255, 0.04);
  border:           1px solid rgba(255, 255, 255, 0.07);
}

/* Operator badge in mirror — non-interactive (pointer-events off) */
.rgp-mirror-op {
  pointer-events:   none;
  cursor:           default;
  font-size:        9px;
  padding:          1px 5px;
}

/* "Open Tray ↓" button */
.rgp-mirror-open-btn {
  margin-top:       10px;
  width:            100%;
  font-family:      'Inter', sans-serif;
  font-size:        10.5px;
  font-weight:      500;
  letter-spacing:   0.04em;
  padding:          5px 10px;
  border-radius:    3px;
  border:           1px solid rgba(201, 147, 42, 0.25);
  background:       rgba(201, 147, 42, 0.07);
  color:            rgba(201, 147, 42, 0.75);
  cursor:           pointer;
  transition:       background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.rgp-mirror-open-btn:hover {
  background:       rgba(201, 147, 42, 0.15);
  color:            rgba(201, 147, 42, 1);
  border-color:     rgba(201, 147, 42, 0.5);
}
