/* ═══════════════════════════════════════════════════════════════════════════
   reading-pm.css — rooms, trades, changes, the item drawer, the viewer hotspots and the
   block appended to a plan-reading question row (js/reading-pm.js).
   lane cc-impl-2 · 2026-10-10 · NEW FILE. css/styles.css is FROZEN, so this is a separate
   sheet and MUST load AFTER css/reading.css, whose .rdg- atoms it reuses. Every rule here
   is prefixed .rpm- and every colour is a design token (`:root` is the DARK palette,
   `:root.light` a CLASS on <html> overrides it). Nothing outside .rpm- is styled.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── the card ──────────────────────────────────────────────────────────────── */
.rpm-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.rpm-none { margin: 10px 0; font-size: 13px; font-weight: 600; color: var(--green); }
.rpm-select {
  font: inherit; font-size: 12px; padding: 3px 8px; max-width: 46ch;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--rdg-line, var(--gray-300)); border-radius: 6px;
}
.rpm-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rpm-list { list-style: none; margin: 4px 0 8px; padding: 0; font-size: 12.5px; }
.rpm-list li { margin: 4px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.rpm-cites { margin-left: auto; }
.rpm-sec { margin: 10px 0 0; }
.rpm-detail { margin: 6px 0; font-size: 12.5px; overflow-wrap: anywhere; }
.rpm-fact-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }

/* changes */
.rpm-changes { list-style: none; margin: 4px 0 10px; padding: 0; }
.rpm-change {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  padding: 7px 10px; margin: 0 0 5px; border: 1px solid var(--rdg-line, var(--gray-300));
  border-radius: var(--radius-sm, 8px); background: var(--surface); font-size: 12.5px;
}
.rpm-ch-text { flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
.rpm-old { color: var(--red); text-decoration: line-through; text-decoration-thickness: 1px; }
.rpm-new { color: var(--text); font-weight: 600; }
.rpm-ch-added .rpm-new { color: var(--green); }
.rpm-ch-removed .rpm-old { text-decoration: line-through; }
.rpm-kind-added { color: var(--green); border-color: var(--green); }
.rpm-kind-removed, .rpm-kind-sheet_removed { color: var(--red); border-color: var(--red); }
.rpm-kind-changed, .rpm-kind-moved { color: var(--yellow); border-color: var(--yellow); }
.rpm-kind-sheet_added { color: var(--green); border-color: var(--green); }

/* trades */
.rpm-trades { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.rpm-trade {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 500;
  padding: 4px 10px; border: 1px solid var(--rdg-line, var(--gray-300)); border-radius: 999px;
  background: var(--surface); color: var(--text-secondary);
}
.rpm-trade:hover { border-color: var(--primary); color: var(--text); }
.rpm-trade-on { border-color: var(--primary); color: var(--text); font-weight: 600; }
.rpm-trade:focus-visible, .rpm-node:focus-visible, .rpm-dclose:focus-visible, .rpm-select:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.rpm-n-warn { color: var(--yellow); }

/* ── a linked item (the cross-link chip) ───────────────────────────────────── */
.rpm-node {
  appearance: none; cursor: pointer; font: inherit; font-size: 11.5px; line-height: 18px; text-align: left;
  max-width: 52ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 8px; border: 1px solid var(--rdg-line, var(--gray-300)); border-radius: 5px;
  background: var(--surface); color: var(--text);
}
.rpm-node:hover { border-color: var(--primary); color: var(--primary); }
.rpm-k-issue, .rpm-k-question { border-left: 2px solid var(--yellow); }
.rpm-k-change { border-left: 2px solid var(--primary); }
.rpm-k-space { font-weight: 600; }
.rpm-related { margin: 2px 0 0; }
.rpm-rel-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 5px 0; }
.rpm-rel-row .rdg-label { flex: 0 0 132px; margin-right: 0; }

/* ── the drawer ────────────────────────────────────────────────────────────── */
.rpm-drawer {
  position: fixed; top: 52px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px));
  z-index: 10050;                       /* above the plan viewer (10000) */
  display: flex; flex-direction: column;
  background: var(--dark-bg); color: var(--text); font-family: var(--font);
  border: 1px solid var(--gray-300); border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-md);
  --rdg-rule: var(--gray-200); --rdg-line: var(--gray-300);
}
.rpm-dhead { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px 4px; }
.rpm-dtitle { flex: 1 1 auto; min-width: 0; }
.rpm-dname { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.rpm-dclose {
  appearance: none; flex: none; cursor: pointer; background: none; border: 0; padding: 2px 4px;
  font: inherit; font-size: 13px; color: var(--text-secondary);
}
.rpm-dclose:hover { color: var(--text); }
.rpm-drawer > .rpm-acts { padding: 6px 14px 8px; border-bottom: 1px solid var(--rdg-rule); }
.rpm-drawer > .rdg-note { padding: 6px 14px 0; margin: 0; }
.rpm-dbody { flex: 1 1 auto; overflow-y: auto; padding: 10px 14px 16px; font-size: 13px; line-height: 1.5; }
.rpm-dbody .rdg-facts { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.rpm-dbody .rdg-h4 { margin-top: 14px; }

/* ── crops ─────────────────────────────────────────────────────────────────── */
.rpm-crop-slot { margin: 6px 0; font-size: 11.5px; }
.rpm-crop {
  display: block; max-width: 100%; height: auto; cursor: pointer;
  border: 1px solid var(--rdg-line, var(--gray-300)); border-radius: 6px; background: #fff;
}

/* ── the block appended to a plan-reading question row ─────────────────────── */
.rpm-qx { margin: 6px 0 4px; padding: 6px 0 2px 9px; border-left: 2px solid var(--primary); }
.rpm-qx-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.rpm-qx .rdg-chip, .rpm-qx .rdg-tag, .rpm-qx .rdg-btn { --rdg-line: var(--gray-300); }
.rpm-qx .rdg-chip {
  display: inline-flex; align-items: baseline; gap: 5px; max-width: 52ch; padding: 1px 7px;
  border: 1px solid var(--gray-300); border-radius: 5px; background: var(--surface);
  font: inherit; font-size: 11.5px; line-height: 18px; color: var(--text); cursor: pointer;
}
.rpm-qx .rdg-chip:hover { border-color: var(--primary); color: var(--primary); }
.rpm-qx .rdg-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rpm-qx .rdg-chip-sheet { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.rpm-qx .rdg-chip-text { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpm-qx .rdg-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.rpm-qx .rdg-muted { color: var(--text-secondary); }
.rpm-qx .rdg-tag {
  display: inline-block; padding: 0 6px; border: 1px dashed var(--gray-300); border-radius: 4px;
  font-size: 10.5px; font-weight: 600; line-height: 17px; color: var(--text-secondary); white-space: nowrap;
}
.rpm-qx .rdg-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 500; padding: 4px 11px;
  border: 1px solid var(--gray-300); border-radius: 6px; background: var(--surface); color: var(--text);
}
.rpm-qx .rdg-btn:hover { border-color: var(--primary); color: var(--primary); }
.rpm-qx .rdg-btn-quiet { border-color: transparent; background: none; color: var(--text-secondary); }
@keyframes rpm-row-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 3px var(--primary); } }
.rpm-row-pulse { animation: rpm-row-pulse 1.3s ease-in-out 2; border-radius: 6px; }

/* ── the viewer layer: rooms and issues are clickable where they are printed ── */
.rpm-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rpm-hot { pointer-events: all; cursor: pointer; fill: transparent; stroke: transparent; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rpm-hot-room:hover { stroke: var(--primary); fill: rgba(20, 184, 166, .14); }
.rpm-hot-issue { stroke: var(--yellow); stroke-dasharray: 3 2; fill: rgba(245, 158, 11, .06); }
.rpm-hot-issue.rpm-sev-HIGH, .rpm-hot-issue.rpm-sev-CRITICAL { stroke: var(--red); fill: rgba(239, 68, 68, .06); }
.rpm-hot-issue:hover { stroke-dasharray: none; fill: rgba(245, 158, 11, .2); }
@keyframes rpm-pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .25; } }
.rpm-pulse {
  pointer-events: none; fill: rgba(20, 184, 166, .10); stroke: var(--primary); stroke-width: 2.5;
  vector-effect: non-scaling-stroke; animation: rpm-pulse .9s ease-in-out 5;
}
.rpm-pop-actions { margin-top: 6px; }

@media (max-width: 720px) {
  .rpm-drawer { top: 8px; right: 8px; bottom: 8px; }
  .rpm-rel-row .rdg-label { flex-basis: 100%; }
}
