/* PRØBitY live review.
   Progress geometry matches AUTOMATA run-spine.css (Psych-Report-Writing-App):
   padding, bar heights, segment gap, nested cards that spawn and collapse.
   Colour and type are the AUTOMATA house tokens (brand.css): Montserrat,
   Source Serif 4, IBM Plex Mono, vermilion #E8553F on the dark paper.
   Everything is class-based so a later pass can restyle without touching the script. */

#probitySpine { grid-column: 1 / -1; min-width: 0; }
#probitySpine .rsp {
  --al-surface: #17161A;
  --al-paper: #0E0D10;
  --al-mist: #1B191E;
  --al-line: #34303A;
  --al-ink: #EDE9EA;
  --al-muted: #A8A0A6;
  --al-charcoal: #D6D0D3;
  --al-red: #E8553F;
  --al-red-deep: #B8321F;
  --al-vermilion: #F07A3A;
  --al-ok: #2F7D55;
  --al-head: Montserrat, "Helvetica Neue", Arial, sans-serif;
  --al-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --al-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  margin: 0;
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, #221F26, #17161A);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 18px 40px -28px rgba(0, 0, 0, .85);
  font-family: var(--al-head);
  color: var(--al-ink);
}

#probitySpine .rsp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#probitySpine .rsp-brand { display: flex; align-items: center; gap: 8px; }
#probitySpine .rsp-pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--al-red); box-shadow: 0 0 8px var(--al-red);
  animation: rsp-pulse 1.4s ease-in-out infinite;
}
#probitySpine .rsp-logo-title {
  font-family: var(--al-mono);
  font-size: 13px; font-weight: 800; letter-spacing: .2em; color: #fff;
}
#probitySpine .red-a { color: var(--al-red); -webkit-text-fill-color: var(--al-red); }
#probitySpine .rsp-pct {
  font: 600 22px/1 var(--al-mono);
  font-variant-numeric: tabular-nums; color: var(--al-ink);
}
#probitySpine .rsp-eye {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 0;
  font-family: var(--al-mono);
  font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--al-red);
}
#probitySpine .rsp-eye .probity {
  font-family: "Automata Montserrat", Montserrat, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600; font-size: 14px; letter-spacing: -.02em; text-transform: none; color: var(--al-ink);
}
#probitySpine .rsp-pill {
  margin-left: auto;
  font-family: var(--al-head);
  letter-spacing: .08em;
  border: 1px solid var(--al-line);
  border-radius: 2px;
  padding: 3px 8px;
  color: var(--al-muted);
}
#probitySpine .rsp[data-state="done"] .rsp-pill {
  color: var(--al-ok);
  border-color: color-mix(in srgb, var(--al-ok) 55%, var(--al-line));
}
#probitySpine .rsp[data-state="stopped"] .rsp-pill { color: var(--al-vermilion); }
#probitySpine .rsp-bar {
  position: relative; height: 9px; margin-top: 9px; border-radius: 9px; overflow: hidden;
  background: var(--al-mist);
}
#probitySpine .rsp-fill {
  display: block; height: 100%; width: calc(var(--w, 0) * 1%); border-radius: 9px;
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--al-red), var(--al-red-deep));
}
#probitySpine .rsp-bar.rsp-run > .rsp-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(255,255,255,0) 32%, rgba(255,255,255,.45) 50%, rgba(255,255,255,0) 68%);
  background-size: 230% 100%; animation: rsp-sheen 2.6s linear infinite;
}
@keyframes rsp-sheen { from { background-position: 130% 0; } to { background-position: -130% 0; } }
#probitySpine .rsp[data-state="done"] .rsp-fill { background: var(--al-ok); }
#probitySpine .rsp[data-state="done"] .rsp-fill::after { animation: none; opacity: 0; }
#probitySpine .rsp-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px;
  font: 500 14px/1.5 var(--al-mono); color: var(--al-muted);
}
#probitySpine .rsp-now { min-width: 0; overflow-wrap: anywhere; }
#probitySpine .rsp-stages { margin-top: 10px; display: grid; gap: 9px; }
#probitySpine .rsp-stage { opacity: .45; transition: opacity .6s ease; }
#probitySpine .rsp-stage[data-state="run"],
#probitySpine .rsp-stage[data-state="done"] { opacity: 1; }
#probitySpine .rsp-stage-row { display: flex; align-items: center; gap: 8px; }
#probitySpine .rsp-stage-title {
  margin: 0; font: 600 14px/1.3 var(--al-head); color: var(--al-ink);
}
#probitySpine .rsp-stage-state {
  margin-left: auto; font: 500 14px/1 var(--al-mono); color: var(--al-muted);
}
#probitySpine .rsp-stage[data-state="done"] .rsp-stage-state { color: var(--al-ok); }
#probitySpine .rsp-stage[data-state="run"] .rsp-stage-state { color: var(--al-red); }
#probitySpine .rsp-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--al-line); transition: background .4s ease;
}
#probitySpine .rsp-stage[data-state="run"] .rsp-dot {
  background: var(--al-red); animation: rsp-pulse 1.5s ease-in-out infinite;
}
#probitySpine .rsp-stage[data-state="done"] .rsp-dot { background: var(--al-ok); }
@keyframes rsp-pulse { 50% { transform: scale(1.4); } }

#probitySpine .rsp-segment-bar {
  display: grid; gap: 5px; height: 7px; margin-top: 6px; width: 100%;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
}
#probitySpine .rsp-seg-cell {
  background: var(--al-mist); border-radius: 999px; overflow: hidden; position: relative;
}
#probitySpine .rsp-seg-fill {
  display: block; height: 100%; width: calc(var(--w, 0) * 1%); border-radius: 999px;
  background: linear-gradient(90deg, var(--al-red), var(--al-red-deep));
}
#probitySpine .rsp-seg-cell.is-done .rsp-seg-fill { background: var(--al-ok); }

#probitySpine .rsp-nested {
  display: flex; flex-direction: column; gap: 6px; margin-top: 6px;
  transition: opacity .35s ease, max-height .35s ease, margin .35s ease;
}
#probitySpine .rsp-nested.is-collapse {
  opacity: 0; max-height: 0; margin-top: 0; overflow: hidden; pointer-events: none;
}
#probitySpine .rsp-sub {
  background: var(--al-paper);
  border: 1px solid var(--al-line); border-radius: 2px;
  padding: 6px 10px; display: flex; flex-direction: column; gap: 4px;
  animation: rsp-sub-in .3s ease-out both;
}
@keyframes rsp-sub-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
#probitySpine .rsp-sub.is-done { border-color: color-mix(in srgb, var(--al-ok) 40%, transparent); }
#probitySpine .rsp-sub-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 14px; font-weight: 500;
}
#probitySpine .rsp-sub-title { display: flex; align-items: center; gap: 6px; color: var(--al-ink); min-width: 0; }
#probitySpine .rsp-sub-name { overflow-wrap: anywhere; }
#probitySpine .rsp-sub-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--al-red); flex: none; }
#probitySpine .rsp-sub.is-done .rsp-sub-dot { background: var(--al-ok); }
#probitySpine .rsp-sub-tag {
  font: 600 14px/1 var(--al-mono); color: var(--al-muted); white-space: nowrap;
}
#probitySpine .rsp-sub.is-done .rsp-sub-tag { color: var(--al-ok); }
#probitySpine .rsp-sub-track {
  height: 3.5px; background: rgba(255, 255, 255, .08); border-radius: 999px; overflow: hidden;
}
#probitySpine .rsp-sub-fill {
  display: block; height: 100%; width: calc(var(--w, 0) * 1%); border-radius: 999px;
  background: linear-gradient(90deg, var(--al-red), var(--al-red-deep));
}
#probitySpine .rsp-sub.is-done .rsp-sub-fill { background: var(--al-ok); }
#probitySpine .rsp-more,
#probitySpine .rsp-sum {
  margin: 0; font: 500 14px/1.4 var(--al-mono); color: var(--al-muted);
}
#probitySpine .rsp-sum { color: var(--al-ok); margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  #probitySpine .rsp-bar.rsp-run > .rsp-fill::after,
  #probitySpine .rsp-stage[data-state="run"] .rsp-dot,
  #probitySpine .rsp-pip,
  #probitySpine .rsp-sub { animation: none; }
  #probitySpine .rsp-nested { transition: none; }
}

/* ---------- the report, written while the checks run ---------- */
#review.rv-report {
  --al-surface: #17161A;
  --al-paper: #0E0D10;
  --al-mist: #1B191E;
  --al-line: #34303A;
  --al-ink: #EDE9EA;
  --al-muted: #A8A0A6;
  --al-charcoal: #D6D0D3;
  --al-red: #E8553F;
  --al-red-deep: #B8321F;
  --al-vermilion: #F07A3A;
  --al-ok: #2F7D55;
  --al-head: Montserrat, "Helvetica Neue", Arial, sans-serif;
  --al-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --al-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  margin-top: 22px;
  font-family: var(--al-serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--al-ink);
}
#review.rv-report h1,
#review.rv-report h2,
#review.rv-report h3 {
  font-family: var(--al-head);
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  color: var(--al-ink);
  letter-spacing: -0.015em;
}
#review.rv-report .red-a { color: var(--red, #E8553F); -webkit-text-fill-color: var(--red, #E8553F); }
#review.rv-report .rv-kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 0 0 8px;
  font: 700 14px/1.3 var(--al-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--al-red);
}
#review.rv-report .rv-kicker .probity {
  font-family: "Automata Montserrat", Montserrat, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600; font-size: 15px; letter-spacing: -.02em; text-transform: none; color: var(--al-ink);
}
#review.rv-report .rv-by { color: var(--al-muted); letter-spacing: .12em; }
#review.rv-report .rv-title {
  font-weight: 700; font-size: clamp(26px, 4vw, 34px); line-height: 1.15; margin: 0 0 8px;
}
#review.rv-report .rv-state {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 14px; padding: 4px 10px; border-radius: 2px;
  border: 1px solid var(--al-line);
  font: 700 14px/1.3 var(--al-head); letter-spacing: .08em; text-transform: uppercase; color: var(--al-muted);
}
#review.rv-report.is-updating .rv-state { color: var(--al-vermilion); border-color: color-mix(in srgb, var(--al-vermilion) 45%, var(--al-line)); }
#review.rv-report.is-final .rv-state { color: var(--al-ok); border-color: color-mix(in srgb, var(--al-ok) 50%, var(--al-line)); }
#review.rv-report .rv-state i {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block;
}
#review.rv-report.is-updating .rv-state i { animation: rsp-pulse 1.4s ease-in-out infinite; }
#review.rv-report .rv-disclaimer,
#review.rv-report .rv-sub { color: var(--al-muted); font-size: 14.5px; margin: 0 0 14px; }
#review.rv-report .rv-section { margin: 8px 0; }
#review.rv-report .rv-section[hidden] { display: none; }
#review.rv-report .rv-section h3 {
  font-family: var(--al-head);
  font-size: 22px; font-weight: 700; letter-spacing: 0; text-transform: none;
  color: var(--al-ink); margin: 18px 0 8px;
}
#review.rv-report .rv-card {
  background: transparent; border: 0; border-radius: 0; padding: 0 0 8px;
}
#review.rv-report.is-updating .rv-section.is-fresh .rv-card,
#review.rv-report.is-updating .rv-section.is-fresh .rv-finding {
  animation: rv-fresh .45s ease;
}
@keyframes rv-fresh { from { background-color: color-mix(in srgb, var(--al-red) 16%, transparent); } }
#review.rv-report .rv-groups { display: grid; gap: 4px; }
#review.rv-report .rv-findings,
#review.rv-report .rv-requests,
#review.rv-report .rv-list { list-style: none; margin: 0; padding: 0; }
#review.rv-report .rv-finding { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
#review.rv-report .rv-cite { color: var(--muted, #A8A0A6); font: 500 14px/1.4 var(--al-mono); }
#review.rv-report .rv-table-wrap { overflow-x: auto; }
#review.rv-report table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
#review.rv-report th,
#review.rv-report td {
  text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--al-line);
}
#review.rv-report th {
  font: 600 14px/1.3 var(--al-head); letter-spacing: .04em; text-transform: uppercase; color: var(--al-muted);
}
#review.rv-report .rv-letter {
  background: transparent; color: inherit; border-radius: 0; padding: 0;
  font: 20px/1.5 var(--al-serif);
}
#review.rv-report .rv-letter h3 { font: 700 22px/1.2 var(--al-head); color: inherit; text-transform: none; letter-spacing: 0; }
#review.rv-report .rv-letter p { margin: 0 0 12px; }
#review.rv-report .rv-requests li { margin: 7px 0; }
#review.rv-report .rv-line {
  display: inline-block; border-bottom: 1px solid #555; min-width: 9em; height: 1.1em; vertical-align: text-bottom;
}
#review.rv-report .rv-line-date { min-width: 7em; }
#review.rv-report .rv-sign { margin-top: 28px; }

@media (max-width: 720px) {
  #probitySpine .rsp { padding: 14px 12px 16px; }
  #probitySpine .rsp-top { align-items: flex-start; }
  #probitySpine .rsp-pct { font-size: 18px; }
  #probitySpine .rsp-stage-row { align-items: flex-start; }
  #probitySpine .rsp-stage-title { font-size: 14px; }
  #review.rv-report { font-size: 18px; }
  #review.rv-report .rv-title { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  #review.rv-report.is-updating .rv-state i,
  #review.rv-report.is-updating .rv-section.is-fresh .rv-card,
  #review.rv-report.is-updating .rv-section.is-fresh .rv-finding { animation: none; }
}

@media print {
  #probitySpine { display: none !important; }
  #review.rv-report { color: #111; background: #fff; }
  #review.rv-report .rv-state,
  #review.rv-report .rv-kicker,
  #review.rv-report .rv-cite,
  #review.rv-report th { color: #333; font-size: 9pt; }
  #review.rv-report .rv-finding,
  #review.rv-report .rv-card { background: #fff; border-color: #ccc; }
}
