/* Report viewer -- the migrated Desktop Report Reader.
 *
 * Scoped to #view-reports, every class prefixed rr-, so the reader's components
 * cannot collide with the dashboard's. It does NOT carry its own palette: the
 * tokens below alias the app's, so one theme switch moves the whole product and
 * the reader can never drift into a second look.
 *
 * No inline styles anywhere: the CSP is `style-src 'self'`, so anything dynamic
 * is a class, a data- attribute, or a CSSOM write.
 */

#view-reports {
  --rr-bg: var(--soft);
  --rr-panel: var(--white);
  --rr-panel-2: var(--surface-2);
  --rr-line: var(--line);
  --rr-line-2: var(--line);
  --rr-ink: var(--ink);
  --rr-muted: var(--muted);
  --rr-accent: var(--green);
  --rr-accent-soft: var(--green-soft);
  --rr-good: var(--green);
  --rr-good-soft: var(--green-soft);
  --rr-warn: var(--warn);
  --rr-warn-soft: var(--warn-soft);
  --rr-bad: var(--red);
  --rr-bad-soft: var(--red-soft);
  --rr-info: var(--blue);
  --rr-info-soft: var(--blue-soft);
  --rr-shadow: var(--shadow);
  --rr-radius: 10px;
  --rr-mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}

/* ---------------------------------------------------------------- layout */

.rr-shell { min-width: 0; }
.rr-main { min-width: 0; }

/* Scoped to the view, not to .rr-shell, so the picker and export dialog are
   covered too. The host makes every control width:100%, which would stretch a
   radio across its label -- hence the reset below. */
#view-reports input:not([type="checkbox"]):not([type="radio"]),
#view-reports select {
  padding: 7px 10px;
  color: var(--rr-ink);
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
}

#view-reports input[type="radio"],
#view-reports input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--rr-accent);
}

#view-reports input:focus-visible,
#view-reports select:focus-visible,
#view-reports button:focus-visible {
  outline: 3px solid var(--rr-accent-soft);
  outline-offset: 1px;
}

#view-reports label { display: block; gap: 0; font-weight: inherit; color: inherit; font-size: inherit; }

/* ------------------------------------------------------------- browsing
 *
 * There is exactly one run list in the product. It renders full width as the
 * landing state, and the same markup renders inside the picker overlay once a
 * run is open -- so switching runs never needs a second permanent column
 * alongside the app's own nav.
 */

.rr-browse-head {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.rr-browse-head h2 { margin: 0; font-size: 20px; }
.rr-browse-head p { margin: 4px 0 0; color: var(--rr-muted); font-size: 12.5px; }
.rr-browse-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.rr-browse-tools input[type="search"] { width: 220px; }

.rr-run-list.rr-browse-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 10px;
  align-items: start;
}

.rr-run-list.rr-browse-list .rr-group-head { grid-column: 1 / -1; }

.rr-run-list.rr-browse-list .rr-run-item {
  margin: 0;
  padding: 12px 14px;
  background: var(--rr-panel);
  border-color: var(--rr-line);
  box-shadow: var(--rr-shadow);
}

.rr-group-head {
  padding: 12px 2px 4px;
  color: var(--rr-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rr-run-item {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 9px 10px;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--rr-radius);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.rr-run-item:hover { border-color: var(--rr-accent); }

.rr-run-item.rr-active {
  background: var(--rr-accent-soft);
  border-color: var(--rr-accent);
}

.rr-ri-top { display: flex; align-items: baseline; gap: 8px; }

.rr-ri-app {
  flex: 1;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-ri-id { color: var(--rr-muted); font-family: var(--rr-mono); font-size: 11px; }

.rr-ri-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}

.rr-ri-when {
  margin-left: auto;
  color: var(--rr-muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* -------------------------------------------------------------- picker */

.rr-picker {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  /* Stretch would make an almost-empty panel full height; hug the content. */
  align-items: flex-start;
  justify-content: center;
  padding: 76px 20px 20px;
  background: rgba(2, 6, 5, .72);
}

.rr-picker-panel {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: 100%;
  background: var(--rr-panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  overflow: hidden;
}

.rr-picker-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rr-line);
}

.rr-picker-head input[type="search"] { flex: 1 1 auto; min-width: 0; width: auto; }
.rr-picker-head select { flex: 0 0 auto; width: auto; }

.rr-picker-body { flex: 0 1 auto; min-height: 0; padding: 6px 10px 10px; overflow: auto; }

.rr-picker-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--rr-line);
}

.rr-roots {
  margin-left: auto;
  overflow: hidden;
  color: var(--rr-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: var(--rr-ink);
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.rr-picker-btn:hover { border-color: var(--rr-accent); }
.rr-picker-btn .rr-caret { color: var(--rr-muted); }

.rr-runnav { display: inline-flex; gap: 2px; }

.rr-runnav button {
  width: 28px;
  height: 30px;
  color: var(--rr-muted);
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.rr-runnav button:hover:not(:disabled) { color: var(--rr-ink); border-color: var(--rr-accent); }
.rr-runnav button:disabled { opacity: .4; cursor: not-allowed; }

/* --------------------------------------------------------- run chrome */

.rr-run-head {
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--rr-line);
}

.rr-rh-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.rr-run-head h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }

.rr-rh-id {
  color: var(--rr-muted);
  font-family: var(--rr-mono);
  font-size: 12.5px;
}

.rr-rh-actions { display: flex; gap: 6px; margin-left: auto; }

/* The run's own state, beside its id: "live" while the harness is still
   writing into the folder, the stop state once it is not. */
.rr-live {
  padding: 2px 9px;
  border: 1px solid var(--rr-line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.rr-live.rr-on {
  color: var(--rr-info);
  background: var(--rr-info-soft);
  border-color: transparent;
  animation: rr-live-pulse 2s ease-in-out infinite;
}

.rr-live.rr-good { color: var(--rr-good); background: var(--rr-good-soft); border-color: transparent; }
.rr-live.rr-warn { color: var(--rr-warn); background: var(--rr-warn-soft); border-color: transparent; }
.rr-live.rr-bad { color: var(--rr-bad); background: var(--rr-bad-soft); border-color: transparent; }
.rr-live.rr-info { color: var(--rr-info); background: var(--rr-info-soft); border-color: transparent; }
.rr-live.rr-off { color: var(--rr-muted); }

@keyframes rr-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

@media (prefers-reduced-motion: reduce) {
  .rr-live.rr-on { animation: none; }
}

.rr-rh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.rr-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 2px;
  background: var(--rr-bg);
  border-bottom: 1px solid var(--rr-line);
}

.rr-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  color: var(--rr-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.rr-tab:hover { color: var(--rr-ink); }

.rr-tab.rr-active {
  color: var(--rr-accent);
  border-bottom-color: var(--rr-accent);
  font-weight: 600;
}

.rr-count {
  padding: 1px 6px;
  color: var(--rr-muted);
  background: var(--rr-panel-2);
  border-radius: 999px;
  font-size: 11px;
}

.rr-tab.rr-active .rr-count {
  color: var(--rr-accent);
  background: var(--rr-accent-soft);
}

.rr-panel { padding: 20px 2px 60px; max-width: 1400px; }

/* ------------------------------------------------------------ content */

.rr-card {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
  box-shadow: var(--rr-shadow);
}

.rr-card h2 { margin: 0 0 8px; font-size: 15px; }
.rr-card h3 { margin: 16px 0 6px; font-size: 13.5px; }
.rr-card > h3:first-child { margin-top: 0; }

.rr-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rr-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.rr-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.rr-spacer { flex: 1; }

.rr-callout {
  margin: 10px 0;
  padding: 10px 14px;
  background: var(--rr-panel-2);
  border-left: 4px solid var(--rr-info);
  border-radius: 8px;
}

.rr-callout .rr-ct { font-weight: 600; }
.rr-callout.rr-success { border-left-color: var(--rr-good); }
.rr-callout.rr-warning { border-left-color: var(--rr-warn); }
.rr-callout.rr-danger { border-left-color: var(--rr-bad); }

.rr-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.rr-metric {
  padding: 10px 12px;
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
}

.rr-mv { font-size: 22px; font-weight: 700; line-height: 1.1; }

.rr-ml {
  margin-top: 2px;
  color: var(--rr-muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rr-metric.rr-good .rr-mv { color: var(--rr-good); }
.rr-metric.rr-warn .rr-mv { color: var(--rr-warn); }
.rr-metric.rr-bad .rr-mv { color: var(--rr-bad); }

/* ------------------------------------------------------------- tables */

.rr-shell table.rr-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rr-shell table.rr-grid th {
  position: sticky;
  top: 0;
  padding: 8px;
  color: var(--rr-muted);
  background: var(--rr-panel-2);
  border-bottom: 1px solid var(--rr-line);
  font-size: 11px;
  letter-spacing: .05em;
  text-align: left;
  text-transform: uppercase;
}

.rr-shell table.rr-grid td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--rr-line-2);
  vertical-align: top;
  /* Raw event JSON and long window paths must wrap rather than stretch the
     table past the panel. */
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rr-shell table.rr-grid tr:hover td { background: var(--rr-panel-2); }
.rr-shell table.rr-grid tr.rr-hl td { background: var(--rr-accent-soft); }
.rr-shell table.rr-grid tr.rr-clickable { cursor: pointer; }

.rr-shell table.rr-kv { width: 100%; border-collapse: collapse; font-size: 13px; }

.rr-shell table.rr-kv th {
  width: 200px;
  padding: 6px 8px 6px 0;
  color: var(--rr-muted);
  font-weight: 600;
  text-align: left;
  vertical-align: top;
}

.rr-shell table.rr-kv td { padding: 6px 0; word-break: break-word; }

.rr-shell table.rr-kv tr + tr th,
.rr-shell table.rr-kv tr + tr td { border-top: 1px solid var(--rr-line-2); }

.rr-scroll-x { overflow-x: auto; }
.rr-scroll-y { max-height: 60vh; overflow-y: auto; }
.rr-obs-controls-table { max-height: 420px; }

.rr-shell ul.rr-clean,
.rr-shell ol.rr-clean { margin: 4px 0 8px; padding-left: 20px; }

.rr-shell ul.rr-clean li,
.rr-shell ol.rr-clean li { margin: 3px 0; }

/* ------------------------------------------------ buttons, pills, chips */

.rr-btn {
  padding: 7px 12px;
  color: var(--rr-ink);
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
  box-shadow: var(--rr-shadow);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.rr-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--rr-accent) 45%, var(--rr-line));
}

.rr-btn:disabled { opacity: .5; cursor: not-allowed; }
.rr-btn.rr-small { padding: 4px 9px; font-size: 12px; }
.rr-btn.rr-ghost { background: transparent; box-shadow: none; }

.rr-btn.rr-primary {
  color: #fff;
  background: var(--rr-accent);
  border-color: var(--rr-accent);
}

.rr-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  color: var(--rr-muted);
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.5;
  white-space: nowrap;
}

.rr-pill.rr-good { color: var(--rr-good); background: var(--rr-good-soft); border-color: transparent; }
.rr-pill.rr-warn { color: var(--rr-warn); background: var(--rr-warn-soft); border-color: transparent; }
.rr-pill.rr-bad { color: var(--rr-bad); background: var(--rr-bad-soft); border-color: transparent; }
.rr-pill.rr-info { color: var(--rr-info); background: var(--rr-info-soft); border-color: transparent; }

.rr-pill.rr-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
}

.rr-chip {
  display: inline-flex;
  gap: 5px;
  padding: 4px 9px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
  font-size: 12px;
}

.rr-chip b { font-weight: 600; }

.rr-filter-chip {
  display: inline-flex;
  gap: 5px;
  padding: 3px 10px;
  color: var(--rr-muted);
  background: transparent;
  border: 1px solid var(--rr-line);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.rr-filter-chip.rr-active {
  color: var(--rr-accent);
  background: var(--rr-accent-soft);
  border-color: var(--rr-accent);
  font-weight: 600;
}

#view-reports label { display: block; gap: 0; font-weight: inherit; color: inherit; font-size: inherit; }

.rr-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.rr-check.rr-small { font-size: 12px; }
.rr-check input { accent-color: var(--rr-accent); }

/* -------------------------------------------------------------- steps */

.rr-timeline { position: relative; padding-left: 22px; }

.rr-timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 9px;
  width: 2px;
  background: var(--rr-line);
}

.rr-step {
  position: relative;
  margin-bottom: 8px;
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
}

.rr-step::before {
  content: "";
  position: absolute;
  top: 16px;
  left: -22px;
  width: 10px;
  height: 10px;
  background: var(--rr-muted);
  border: 2px solid var(--rr-panel);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--rr-line);
}

.rr-step.rr-worked::before { background: var(--rr-good); }
.rr-step.rr-failed::before { background: var(--rr-bad); }
.rr-step.rr-uncertain::before { background: var(--rr-warn); }

.rr-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  color: inherit;
  background: none;
  border: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.rr-step-head:hover { background: var(--rr-panel-2); }

.rr-sn { min-width: 28px; color: var(--rr-muted); font-family: var(--rr-mono); font-size: 12px; }

.rr-st {
  max-width: 40%;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-ss {
  flex: 1;
  overflow: hidden;
  color: var(--rr-muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-caret { color: var(--rr-muted); transition: transform .12s; }
.rr-step.rr-open .rr-caret { transform: rotate(90deg); }

.rr-step-body { display: none; padding: 4px 14px 14px; }
.rr-step.rr-open .rr-step-body { display: block; }

.rr-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

.rr-shot-card {
  padding: 8px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
}

.rr-sc-label {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--rr-muted);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.rr-shot-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 4px;
  cursor: zoom-in;
}

.rr-change-bar {
  display: inline-block;
  width: 140px;
  height: 6px;
  vertical-align: middle;
  background: var(--rr-line);
  border-radius: 3px;
  overflow: hidden;
}

.rr-change-bar i { display: block; height: 100%; background: var(--rr-accent); }

/* ----------------------------------------------------------- findings */

.rr-finding { border-left: 4px solid var(--rr-info); }
.rr-finding.rr-high, .rr-finding.rr-critical { border-left-color: var(--rr-bad); }
.rr-finding.rr-medium { border-left-color: var(--rr-warn); }

.rr-fh { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.rr-fh h2 { margin: 0; }

/* ------------------------------------------------------- observations */

.rr-obs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; }

.rr-obs-list { max-height: calc(100vh - 220px); padding: 8px; overflow: auto; }

.rr-obs-item {
  display: block;
  width: 100%;
  margin-bottom: 3px;
  padding: 7px 9px;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.rr-obs-item:hover { background: var(--rr-panel-2); }

.rr-obs-item.rr-active {
  background: var(--rr-accent-soft);
  border-color: color-mix(in srgb, var(--rr-accent) 35%, transparent);
}

.rr-oi-title { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.rr-oi-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; color: var(--rr-muted); font-size: 11.5px; }

.rr-shot-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--rr-line);
  border-radius: 6px;
  overflow: hidden;
}

.rr-shot-wrap img { display: block; max-width: 100%; height: auto; cursor: zoom-in; }

.rr-box {
  position: absolute;
  border: 1px solid rgba(36, 87, 197, .75);
  background: rgba(36, 87, 197, .06);
  pointer-events: auto;
}

.rr-shot-wrap.rr-hide-boxes .rr-box { display: none; }
.rr-box.rr-disabled { border-style: dashed; opacity: .6; }
.rr-box.rr-credential { border-color: #1f8a4c; background: rgba(31, 138, 76, .08); }
.rr-box.rr-hl { border-color: #c0392b; background: rgba(192, 57, 43, .14); }

.rr-box-tag {
  position: absolute;
  top: -14px;
  left: -1px;
  padding: 0 4px;
  color: #fff;
  background: #1f8a4c;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}

/* ------------------------------------------------------------- events */

.rr-ev-type { font-family: var(--rr-mono); font-size: 11.5px; }

.rr-ev-detail {
  max-height: 320px;
  padding: 8px;
  overflow: auto;
  background: var(--rr-panel-2);
  border-radius: 6px;
  font-family: var(--rr-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
}

/* -------------------------------------------------------------- usage */

.rr-usage-chart { display: flex; align-items: flex-end; gap: 2px; height: 90px; margin: 8px 0; }

.rr-usage-chart i {
  flex: 1;
  min-width: 2px;
  background: var(--rr-accent);
  border-radius: 2px 2px 0 0;
}

.rr-usage-chart i.rr-vision { background: var(--rr-good); }

.rr-bar { display: inline-block; height: 10px; background: var(--rr-accent); border-radius: 2px; opacity: .85; }

/* ----------------------------------------------------------- markdown */

.rr-md h1 { font-size: 20px; }
.rr-md h2 { margin-top: 22px; font-size: 16px; }
.rr-md h3 { font-size: 14px; }

.rr-md pre {
  padding: 10px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 6px;
  overflow: auto;
}

.rr-md code { padding: 1px 4px; background: var(--rr-panel-2); border-radius: 4px; font-family: var(--rr-mono); }
.rr-md pre code { padding: 0; background: none; }

/* ------------------------------------------------------------- replay */

.rr-replay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
}

.rr-replay-bar p { flex: 1; margin: 0; color: var(--rr-muted); font-size: 12.5px; }

/* ----------------------------------------------------------- lightbox */

.rr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(6, 10, 16, .88);
}

.rr-lb-body { display: flex; gap: 14px; align-items: center; }

.rr-lb-body img {
  max-width: 92vw;
  max-height: 80vh;
  background: #fff;
  border-radius: 4px;
  object-fit: contain;
}

.rr-lb-body.rr-pair img { max-width: 46vw; }
.rr-lb-body figure { margin: 0; text-align: center; }
.rr-lb-body figcaption { margin-top: 6px; color: #cbd3de; font-size: 12px; }
.rr-lb-caption { color: #cbd3de; font-size: 13px; }

.rr-lb-close,
.rr-lb-nav {
  position: absolute;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 0;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.rr-lb-close:hover,
.rr-lb-nav:hover { background: rgba(255, 255, 255, .22); }

.rr-lb-close { top: 16px; right: 16px; }
.rr-lb-prev { left: 16px; }
.rr-lb-next { right: 16px; }

/* ------------------------------------------------------------- dialog */

#rr-export-dialog {
  width: min(760px, 94vw);
  padding: 0;
  color: var(--rr-ink);
  background: var(--rr-panel);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

#rr-export-dialog::backdrop { background: rgba(6, 10, 16, .5); }
#rr-export-dialog form { padding: 20px 22px; }
#rr-export-dialog h3 { margin: 0 0 14px; font-size: 16px; }

.rr-export-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; }

.rr-label {
  margin: 0 0 6px;
  color: var(--rr-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rr-choice-row { display: grid; gap: 6px; margin-bottom: 16px; }
.rr-check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }

.rr-dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.rr-dialog-actions .rr-spacer { flex: 1; }

/* -------------------------------------------------------------- toast */

.rr-toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 60;
  padding: 8px 14px;
  color: var(--rr-bg);
  background: var(--rr-ink);
  border-radius: 8px;
  box-shadow: var(--rr-shadow);
  font-size: 13px;
  transform: translateX(-50%);
}

/* ------------------------------------------------------------ helpers */

.rr-muted { color: var(--rr-muted); }
.rr-tiny { font-size: 11.5px; }
.rr-small { font-size: 12.5px; }
.rr-pad { padding: 14px; }
.rr-nowrap { white-space: nowrap; }
.rr-mono { font-family: var(--rr-mono); font-size: .92em; }
.rr-shell a { color: var(--rr-accent); }

.rr-empty { display: grid; place-items: center; min-height: 320px; text-align: center; }
.rr-empty-card { max-width: 480px; }
.rr-empty-card h2 { margin: 0 0 8px; font-size: 20px; }

.rr-hidden-note { margin-top: 8px; color: var(--rr-muted); font-size: 12px; }

/* ------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .rr-grid-2, .rr-grid-3 { grid-template-columns: 1fr; }
  .rr-obs-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .rr-shots { grid-template-columns: 1fr; }
  .rr-export-grid { grid-template-columns: 1fr; }
  .rr-browse-tools { width: 100%; margin-left: 0; }
  .rr-browse-tools input[type="search"] { flex: 1; width: auto; }
  .rr-run-list.rr-browse-list { grid-template-columns: 1fr; }
}

@media print {
  .rr-tabs, .rr-rh-actions, .rr-toolbar, .rr-replay-bar, .rr-picker { display: none; }
  .rr-panel { max-width: none; }
  .rr-step-body { display: block; }
}

/* ------------------------------------------------------------- journey
 *
 * The standalone journey export embeds this whole stylesheet (the viewer
 * fetches /report-viewer.css and inlines it), so the exported file and the
 * Journey tab are styled by exactly the same rules and cannot drift.
 */

.rr-jv { display: grid; gap: 12px; }

.rr-jv-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
}

.rr-jv-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
}

.rr-jv-crumb-start { color: var(--rr-muted); }
.rr-jv-crumb-sep { color: var(--rr-muted); }

.rr-jv-crumb {
  max-width: 190px;
  overflow: hidden;
  color: var(--rr-muted);
  background: none;
  border: 0;
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.rr-jv-crumb.rr-current { color: var(--rr-ink); font-weight: 600; }

.rr-jv-travel {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 999px;
}

.rr-jv-travel button {
  padding: 3px 8px;
  color: var(--rr-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.rr-jv-travel button:hover { color: var(--rr-ink); background: var(--rr-panel); }

.rr-jv-pos {
  min-width: 104px;
  color: var(--rr-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.rr-jv-modes {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
}

.rr-jv-mode {
  padding: 4px 12px;
  color: var(--rr-muted);
  background: none;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.rr-jv-mode.rr-active { color: #fff; background: var(--rr-accent); font-weight: 600; }

.rr-jv-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.rr-jv-filter-label {
  color: var(--rr-muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rr-jv-chip {
  padding: 3px 10px;
  color: var(--rr-muted);
  background: transparent;
  border: 1px solid var(--rr-line);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.rr-jv-chip.rr-active {
  color: var(--rr-accent);
  background: var(--rr-accent-soft);
  border-color: var(--rr-accent);
}

.rr-jv-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.rr-jv-hint { color: var(--rr-muted); font-size: 12px; }
.rr-jv-empty { padding: 30px; color: var(--rr-muted); text-align: center; }

.rr-jv-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.rr-jv-main { max-height: calc(100vh - 290px); overflow: auto; }

.rr-jv-side {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 290px);
  overflow: auto;
}

.rr-jv-rail { display: grid; gap: 2px; }
.rr-jv-visit { display: grid; gap: 2px; }
.rr-jv-visit.rr-future { opacity: .38; }

.rr-jv-connect { padding: 4px 0 4px 22px; border-left: 2px solid var(--rr-line); margin-left: 22px; }

.rr-jv-screen {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  color: inherit;
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: 11px;
  box-shadow: var(--rr-shadow);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.rr-jv-screen:hover { border-color: color-mix(in srgb, var(--rr-accent) 45%, var(--rr-line)); }

.rr-jv-visit.rr-selected .rr-jv-screen {
  box-shadow: 0 0 0 2px var(--rr-accent-soft), var(--rr-shadow);
  border-color: var(--rr-accent);
}

.rr-jv-num {
  width: 46px;
  color: var(--rr-muted);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.rr-jv-thumb {
  width: 104px;
  height: 64px;
  background: var(--rr-panel-2);
  border-radius: 7px;
  object-fit: cover;
  object-position: top left;
}

.rr-jv-thumb.rr-none {
  display: grid;
  place-items: center;
  color: var(--rr-muted);
  font-size: 10px;
}

.rr-jv-name { flex: 1; min-width: 0; font-size: 14px; }
.rr-jv-name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-jv-returned { margin-top: 2px; color: var(--rr-muted); font-size: 11.5px; }

.rr-jv-act {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 7px;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.rr-jv-act:hover { background: var(--rr-panel-2); }
.rr-jv-act-n { color: var(--rr-muted); font-family: var(--rr-mono); font-size: 11px; }
.rr-jv-act-verb { font-weight: 600; }
.rr-jv-act-target::before { content: "→ "; color: var(--rr-muted); }
.rr-jv-act-ms { color: var(--rr-muted); font-size: 11px; }

.rr-jv-stay { padding-left: 46px; }

.rr-jv-stay-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 2px 10px;
  color: var(--rr-muted);
  background: none;
  border: 1px dashed var(--rr-line);
  border-radius: 999px;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.rr-jv-stay-list { display: grid; gap: 1px; margin-top: 4px; }

/* The map viewport. It scrolls in both directions and the diagram inside it is
   sized by the CSSOM, because the page's CSP forbids a style attribute. */
.rr-jm-wrap {
  position: relative;
  overflow: auto;
  max-height: min(72vh, 760px);
  padding: 8px;
  background: var(--rr-panel);
  border: 1px solid var(--rr-line);
  border-radius: var(--rr-radius);
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
}

.rr-jm-wrap.rr-panning { cursor: grabbing; user-select: none; }
.rr-jm-wrap:focus-visible { outline: 2px solid var(--rr-accent); outline-offset: -2px; }

.rr-jm-canvas > svg { display: block; }

.rr-jm-zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 999px;
}

.rr-jm-zoom button {
  min-width: 26px;
  padding: 3px 8px;
  color: var(--rr-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.rr-jm-zoom button:hover { color: var(--rr-ink); background: var(--rr-panel); }
.rr-jm-zoom .rr-jm-level { min-width: 52px; font-variant-numeric: tabular-nums; }
.rr-jm-zoom .rr-jm-fit { font-size: 11.5px; }

/* Follow-along: the view chases the newest action until the reader takes over. */
.rr-jv-follow {
  padding: 4px 12px;
  color: var(--rr-muted);
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.rr-jv-follow:hover { color: var(--rr-ink); }

.rr-jv-follow.rr-active {
  color: var(--rr-info);
  background: var(--rr-info-soft);
  border-color: transparent;
  font-weight: 600;
}

.rr-jm-node { fill: var(--rr-panel-2); stroke: var(--rr-line); cursor: pointer; }
.rr-jm-node.rr-modal { stroke-dasharray: 4 3; }
.rr-jm-node.rr-selected { fill: var(--rr-accent-soft); stroke: var(--rr-accent); stroke-width: 2.5; }
.rr-jm-node.rr-dim { opacity: .35; }
.rr-jm-title { fill: var(--rr-ink); font-size: 11px; font-weight: 600; }
.rr-jm-sub { fill: var(--rr-muted); font-size: 9.5px; }
.rr-jm-edge { fill: none; stroke: var(--rr-line); stroke-width: 1.4; cursor: pointer; }
.rr-jm-edge.rr-back { stroke-dasharray: 4 4; }
.rr-jm-edge.rr-route { stroke: var(--rr-accent); stroke-width: 2.4; }
.rr-jm-edge.rr-dim { opacity: .3; }
.rr-jm-edge-label { fill: var(--rr-muted); font-size: 9px; }

.rr-jv-shot { display: block; width: 100%; height: auto; background: #fff; border-radius: 9px; }
.rr-jv-shot.rr-none { display: grid; place-items: center; min-height: 120px; padding: 20px; color: var(--rr-muted); background: var(--rr-panel-2); font-size: 12px; text-align: center; }

.rr-jv-inspect h3 { margin: 10px 0 4px; font-size: 15px; }
.rr-jv-inspect h4 { margin: 14px 0 4px; color: var(--rr-muted); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }

.rr-jv-grammar { display: grid; grid-template-columns: 70px 1fr; gap: 2px 8px; margin: 8px 0; font-size: 12.5px; }
.rr-jv-grammar dt { color: var(--rr-muted); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.rr-jv-grammar dd { margin: 0; }

.rr-jv-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 8px 0; font-size: 12.5px; }
.rr-jv-facts dt { color: var(--rr-muted); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.rr-jv-facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.rr-jv-item { padding: 6px 0; border-top: 1px solid var(--rr-line-2); font-size: 12.5px; }
.rr-jv-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rr-jv-item-sub { margin: 2px 0 0; color: var(--rr-muted); font-size: 11.5px; }
.rr-jv-ev-type { color: var(--rr-accent); font-family: var(--rr-mono); font-size: 11.5px; }

.rr-jv-bud { margin-top: 4px; }

.rr-jv-bud-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  color: inherit;
  background: var(--rr-panel-2);
  border: 1px solid var(--rr-line);
  border-radius: 8px;
  text-align: left;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.rr-jv-bud.rr-empty .rr-jv-bud-toggle { color: var(--rr-muted); opacity: .6; cursor: default; }
.rr-jv-bud-body { max-height: 280px; padding: 0 8px; overflow: auto; }

@media (max-width: 1180px) {
  .rr-jv-body { grid-template-columns: 1fr; }
  .rr-jv-side { position: static; max-height: none; }
  .rr-jv-main { max-height: none; }
}

@media (max-width: 640px) {
  .rr-jv-thumb { display: none; }
  .rr-jv-num { width: 34px; font-size: 18px; }
}
