/* agent-run.css — Carnegie-aligned styling for the AgentRun shell.
 *
 * Design rules pulled from carnegie-design-principles:
 *   - Flat surfaces; hairline dividers instead of nested cards.
 *   - Type hierarchy, not boxes. Mono for reasoning + patch log.
 *   - Token-driven: --air-*. Inputs ≥16px (n/a — no inputs here).
 *   - Mobile-first; tap targets ≥44px.
 *   - Don't compete with the bottom annotation dock — panel is in-flow.
 *   - No hardcoded #fff backgrounds — token-driven so dark mode flips it.
 */

.agentrun {
  font-family: var(--air-font-body, "DM Sans", system-ui, -apple-system, sans-serif);
  color: var(--air-color-text-primary, #0b1020);
  background: var(--c-surface, var(--air-surface-cream, #fbf8f3));
  border: 1px solid var(--air-divider, rgba(11, 16, 32, 0.08));
  border-radius: var(--r-card, 16px);
  padding: 16px;
  margin: 16px 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}
@media (min-width: 768px) {
  .agentrun { padding: 20px 24px; }
}

/* ── header ──────────────────────────────────────────────────────────── */

.agentrun-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--air-divider, rgba(11, 16, 32, 0.08));
}
.agentrun-title {
  margin: 0;
  font-family: var(--air-font-display, "Playfair Display", "EB Garamond", Georgia, serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-close {
  appearance: none;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--air-color-text-muted, #5e6473);
  padding: 8px 10px;
  margin: -8px -10px;
  border-radius: 8px;
  min-width: 32px;
  min-height: 32px;
}
.agentrun-close:hover {
  background: var(--air-divider, rgba(11, 16, 32, 0.06));
  color: var(--air-color-text-primary, #0b1020);
}

/* ── inherits banner ─────────────────────────────────────────────────── */

.agentrun-inherits {
  margin: 0 0 16px 0;
  padding: 10px 12px;
  background: var(--c-surface-soft, rgba(192, 160, 98, 0.08));
  border-left: 2px solid var(--c-accent, #c0a062);
  border-radius: 6px;
  font-size: 13px;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-inherits-summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.agentrun-inherits-summary::-webkit-details-marker { display: none; }
.agentrun-inherits-arrow {
  display: inline-block;
  margin-right: 4px;
  color: var(--c-accent, #c0a062);
  font-weight: 600;
}
.agentrun-inherits-item {
  display: inline-block;
  white-space: nowrap;
}
.agentrun-inherits-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--air-divider, rgba(11, 16, 32, 0.08));
  display: grid;
  gap: 10px;
}
.agentrun-inherits-block {
  display: grid;
  gap: 4px;
}
.agentrun-inherits-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--air-color-text-faint, #8a8f9c);
}
.agentrun-inherits-pre {
  margin: 0;
  font-family: var(--air-font-mono, ui-monospace, SFMono-Regular, "JetBrains Mono", monospace);
  font-size: 11px;
  line-height: 1.45;
  color: var(--air-color-text-muted, #5e6473);
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

/* ── steps stack ─────────────────────────────────────────────────────── */

.agentrun-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── agent card ──────────────────────────────────────────────────────── */

.agentrun-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--air-divider, rgba(11, 16, 32, 0.08));
}
.agentrun-card:last-child { border-bottom: none; }
.agentrun-card[data-status="queued"] { opacity: 0.55; }
.agentrun-card[data-status="error"] .agentrun-byline-name { color: var(--air-color-danger, #c0392b); }

.agentrun-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.agentrun-byline-left {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-byline-by {
  font-style: italic;
  color: var(--air-color-text-faint, #8a8f9c);
}
.agentrun-byline-name {
  font-family: var(--air-font-display, "Playfair Display", Georgia, serif);
  font-weight: 600;
  font-size: 16px;
  color: var(--air-color-text-primary, #0b1020);
  letter-spacing: -0.005em;
}
.agentrun-byline-sep { color: var(--air-color-text-faint, #c2c6d0); }
.agentrun-byline-model {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 12px;
}
.agentrun-byline-elapsed {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ── status pill ─────────────────────────────────────────────────────── */

.agentrun-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--air-font-body, "DM Sans", sans-serif);
  background: var(--air-divider, rgba(11, 16, 32, 0.06));
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.agentrun-pill[data-status="running"] {
  background: rgba(192, 160, 98, 0.18);
  color: #8a6a2a;
}
.agentrun-pill[data-status="running"] .agentrun-pill-dot {
  animation: agentrunPulse 1.2s ease-in-out infinite;
}
.agentrun-pill[data-status="done"] {
  background: rgba(34, 139, 80, 0.12);
  color: #1f7a4a;
}
.agentrun-pill[data-status="error"] {
  background: rgba(192, 57, 43, 0.12);
  color: var(--air-color-danger, #c0392b);
}
.agentrun-pill[data-status="aborted"] {
  background: rgba(11, 16, 32, 0.08);
  color: rgba(11, 16, 32, 0.55);
}
.agentrun-output-aborted {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(11, 16, 32, 0.04);
  color: rgba(11, 16, 32, 0.55);
  font-size: 13px;
}
.agentrun-pill[data-status="queued"] {
  background: transparent;
  color: var(--air-color-text-faint, #8a8f9c);
  border: 1px dashed var(--air-divider, rgba(11, 16, 32, 0.12));
}
@keyframes agentrunPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
.agentrun-restore {
  appearance: none;
  background: transparent;
  border: none;
  font: inherit;
  margin-left: 6px;
  padding: 0 4px;
  text-decoration: underline;
  cursor: pointer;
  color: currentColor;
  opacity: 0.85;
}
.agentrun-restore:hover { opacity: 1; }

/* ── reasoning lane ──────────────────────────────────────────────────── */

.agentrun-reasoning {
  margin: 8px 0;
  background: transparent;
}
.agentrun-reasoning-summary {
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--air-color-text-faint, #8a8f9c);
  padding: 4px 0;
  list-style: none;
}
.agentrun-reasoning-summary::-webkit-details-marker { display: none; }
.agentrun-reasoning-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 120ms ease;
}
.agentrun-reasoning[open] .agentrun-reasoning-summary::before {
  transform: rotate(90deg);
}
.agentrun-reasoning-pre {
  margin: 6px 0 0 0;
  padding: 10px 12px;
  font-family: var(--air-font-mono, ui-monospace, SFMono-Regular, "JetBrains Mono", monospace);
  font-size: 12px;
  line-height: 1.5;
  color: var(--air-color-text-muted, #5e6473);
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}

/* ── output lane ─────────────────────────────────────────────────────── */

.agentrun-output {
  margin-top: 10px;
}
.agentrun-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.agentrun-output-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--air-color-text-faint, #8a8f9c);
}
.agentrun-store {
  appearance: none;
  background: transparent;
  border: 1px solid var(--air-divider, rgba(11, 16, 32, 0.12));
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-store:hover {
  background: var(--air-divider, rgba(11, 16, 32, 0.06));
}
.agentrun-output-body {
  font-size: 13px;
  line-height: 1.5;
}
.agentrun-output-empty {
  font-style: italic;
  color: var(--air-color-text-faint, #8a8f9c);
  font-size: 12px;
}
.agentrun-output-pre {
  margin: 0;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--air-color-text-muted, #5e6473);
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  padding: 8px 10px;
  border-radius: 6px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.agentrun-output-error {
  padding: 10px 12px;
  background: rgba(192, 57, 43, 0.06);
  border-left: 2px solid var(--air-color-danger, #c0392b);
  border-radius: 4px;
  font-size: 12px;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-output-error strong {
  display: block;
  font-family: var(--air-font-mono, monospace);
  font-size: 11px;
  color: var(--air-color-danger, #c0392b);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* Patch log */
.agentrun-patch-log {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Patch card (Flash/Think edit) ─────────────────────────────────────
 * Replaces the old single-line .agentrun-patch-row. The legacy
 * #refine-edits panel used to show: layman caption + before→after word-diff
 * inline. Kenneth (2026-05-25) flagged that the unified shell lost the
 * caption + diff. This card brings both back inside the canonical surface.
 *
 * Visual rhythm:
 *   row 1: [Edit N] [status pill] [auto?]
 *   row 2: caption (layman explanation, body 13px)
 *   row 3: <details> Show diff — open by default for `ready`,
 *          closed by default for `no_match`. Body shows word-diff
 *          with seg-ins (green) / seg-del (red strikethrough).
 */
.agentrun-patch-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
}
.agentrun-patch-card[data-status="approved"] {
  background: color-mix(in srgb, #1f7a4a 5%, transparent);
  border-color: color-mix(in srgb, #1f7a4a 18%, transparent);
}
.agentrun-patch-card[data-status="rejected"] {
  background: color-mix(in srgb, #c0392b 4%, transparent);
  border-color: color-mix(in srgb, #c0392b 16%, transparent);
  opacity: 0.7;
}
.agentrun-patch-card[data-status="no_match"] {
  background: color-mix(in srgb, #c0392b 4%, transparent);
  border-color: color-mix(in srgb, #c0392b 14%, transparent);
  opacity: 0.85;
}

.agentrun-patch-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.agentrun-patch-id {
  font-weight: 700;
  font-size: 13px;
  color: var(--air-color-text-primary, #0b1020);
  font-family: inherit;       /* override mono inherited from .agentrun-patch-row earlier */
}
.agentrun-patch-status {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.agentrun-patch-status[data-status="ready"] {
  color: #b54708;
  background: color-mix(in srgb, #b54708 10%, transparent);
  border-color: color-mix(in srgb, #b54708 20%, transparent);
}
.agentrun-patch-status[data-status="approved"] {
  color: #027a48;
  background: color-mix(in srgb, #027a48 10%, transparent);
  border-color: color-mix(in srgb, #027a48 22%, transparent);
}
.agentrun-patch-status[data-status="rejected"] {
  color: #b42318;
  background: color-mix(in srgb, #b42318 8%, transparent);
  border-color: color-mix(in srgb, #b42318 18%, transparent);
}
.agentrun-patch-status[data-status="no_match"] {
  color: #b42318;
  background: color-mix(in srgb, #b42318 8%, transparent);
  border-color: color-mix(in srgb, #b42318 18%, transparent);
}
.agentrun-patch-auto-tag {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--air-color-text-faint, #8a8f9c);
  margin-left: auto;
  cursor: help;
}

.agentrun-patch-caption {
  font-size: 13px;
  line-height: 1.45;
  color: var(--air-color-text-primary, #0b1020);
}

.agentrun-patch-diff {
  font-size: 12px;
}
.agentrun-patch-diff > summary {
  cursor: pointer;
  list-style: none;
  color: var(--air-color-text-faint, #8a8f9c);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
}
.agentrun-patch-diff > summary::-webkit-details-marker { display: none; }
.agentrun-patch-diff > summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 120ms ease;
}
.agentrun-patch-diff[open] > summary::before {
  transform: rotate(90deg);
}
.agentrun-patch-diff-body {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--c-bg, transparent);
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
  border-radius: 6px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-patch-diff-body .seg-eq  { color: var(--air-color-text-muted, #5e6473); }
.agentrun-patch-diff-body .seg-del {
  background: rgba(197, 13, 13, 0.10);
  color: #8b0a0a;
  text-decoration: line-through;
  padding: 0 2px;
  border-radius: 2px;
}
.agentrun-patch-diff-body .seg-ins {
  background: rgba(12, 138, 62, 0.10);
  color: #0c5b2a;
  padding: 0 2px;
  border-radius: 2px;
}

.agentrun-patch-reason {
  font-size: 12px;
  color: var(--air-color-danger, #c0392b);
  font-style: italic;
}

/* Approve/Reject action row — appears only when patch is `ready`.
 * Demotion ladder per design rule #4: Reject is ghost, Approve is the
 * single primary action. */
.agentrun-patch-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  justify-content: flex-end;
}

/* Definition list (extractor structured output) */
.agentrun-dl {
  margin: 0;
  display: grid;
  gap: 4px;
}
.agentrun-dl-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed var(--air-divider, rgba(11, 16, 32, 0.08));
}
.agentrun-dl-row:last-child { border-bottom: none; }
.agentrun-dl-key {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--air-color-text-faint, #8a8f9c);
  word-break: break-word;
}
.agentrun-dl-val {
  margin: 0;
  font-size: 13px;
  color: var(--air-color-text-primary, #0b1020);
  word-break: break-word;
}
.agentrun-dl-empty {
  color: var(--air-color-text-faint, #c2c6d0);
}
.agentrun-dl-pre {
  margin: 0;
  font-family: var(--air-font-mono, monospace);
  font-size: 11px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  padding: 6px 8px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow: auto;
}
@media (max-width: 480px) {
  .agentrun-dl-row { grid-template-columns: 1fr; gap: 2px; }
}

/* Validator risks */
.agentrun-risks-head {
  font-size: 12px;
  color: var(--air-color-text-muted, #5e6473);
  margin-bottom: 8px;
  font-weight: 500;
}
.agentrun-risks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agentrun-risk {
  padding: 10px 12px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border-left: 2px solid var(--air-divider, rgba(11, 16, 32, 0.18));
  border-radius: 4px;
}
.agentrun-risk[data-sev="high"],
.agentrun-risk[data-sev="critical"] { border-left-color: var(--air-color-danger, #c0392b); }
.agentrun-risk[data-sev="medium"]   { border-left-color: #c0a062; }
.agentrun-risk[data-sev="low"]      { border-left-color: #8a8f9c; }
/* (.agentrun-risk-head moved below — see "Risk head row" block) */
/* ─── Risk pills (severity + area) ─────────────────────────────────────
 * UX audit 2026-05-25 (Kenneth: "pill on category tagging isn't very
 * aesthetic and different size, and not color coded").
 *
 * Treat severity and area as SIBLINGS — same pill shape, same height,
 * same typography. Both are tinted (soft fill + matching foreground).
 * Severity uses the canonical danger/warning/neutral palette; area uses
 * a 6-tone categorical palette tuned to be quieter than severity so the
 * eye lands on severity first.
 *
 * Token references stay soft so light + dark themes both work without
 * a separate dark-mode block (rule #11). All tones go through
 * color-mix() against the page background, so the tint never clashes.
 */
.agentrun-risk-sev,
.agentrun-risk-area {
  /* shared pill shape — exact-same vertical metrics */
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--air-font-mono, monospace);
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
  flex: 0 0 auto;
}

/* Severity tints — louder, anchors the eye.
 * Each declaration has an rgba() fallback BEFORE the color-mix() so older
 * browsers (or the rare browser without color-mix support) still render
 * a tinted pill instead of a transparent box. Modern browsers use the
 * color-mix() value (last-declared-wins).
 *
 * Bumped opacity 2026-05-25b: Kenneth ('still no color coding of pills')
 * — 12% over white reads as basically-white at small pill sizes. Going to
 * 22% fill / 38% border so the pill is unambiguously tinted at a glance. */
.agentrun-risk-sev[data-sev="high"],
.agentrun-risk-sev[data-sev="critical"] {
  color: #b42318;
  background: rgba(180, 35, 24, 0.22);
  background: color-mix(in srgb, #b42318 22%, transparent);
  border-color: rgba(180, 35, 24, 0.38);
  border-color: color-mix(in srgb, #b42318 38%, transparent);
}
.agentrun-risk-sev[data-sev="medium"] {
  color: #b54708;
  background: rgba(181, 71, 8, 0.22);
  background: color-mix(in srgb, #b54708 22%, transparent);
  border-color: rgba(181, 71, 8, 0.38);
  border-color: color-mix(in srgb, #b54708 38%, transparent);
}
.agentrun-risk-sev[data-sev="low"] {
  color: #475467;
  background: rgba(71, 84, 103, 0.18);
  background: color-mix(in srgb, #475467 18%, transparent);
  border-color: rgba(71, 84, 103, 0.32);
  border-color: color-mix(in srgb, #475467 32%, transparent);
}

/* Area tints — quieter palette (6-tone), one per known area.
 * Order chosen so semantically-related areas (pricing/unit_economics,
 * business_model/terms) read distinctly side-by-side.
 * Same rgba()-fallback-then-color-mix() pattern as severity above.
 * Slightly weaker than severity (16%/28% vs 22%/38%) so the eye still
 * lands on severity first. */
.agentrun-risk-area {
  /* default for unknown area — neutral slate */
  color: #475467;
  background: rgba(71, 84, 103, 0.16);
  background: color-mix(in srgb, #475467 16%, transparent);
  border-color: rgba(71, 84, 103, 0.28);
  border-color: color-mix(in srgb, #475467 28%, transparent);
}
.agentrun-risk-area[data-area="pricing"] {
  color: #92400e;   /* amber — money */
  background: rgba(146, 64, 14, 0.16);
  background: color-mix(in srgb, #92400e 16%, transparent);
  border-color: rgba(146, 64, 14, 0.28);
  border-color: color-mix(in srgb, #92400e 28%, transparent);
}
.agentrun-risk-area[data-area="unit_economics"] {
  color: #3538cd;   /* indigo — numbers */
  background: rgba(53, 56, 205, 0.16);
  background: color-mix(in srgb, #3538cd 16%, transparent);
  border-color: rgba(53, 56, 205, 0.28);
  border-color: color-mix(in srgb, #3538cd 28%, transparent);
}
.agentrun-risk-area[data-area="business_model"] {
  color: #027a48;   /* teal-green — strategy */
  background: rgba(2, 122, 72, 0.16);
  background: color-mix(in srgb, #027a48 16%, transparent);
  border-color: rgba(2, 122, 72, 0.28);
  border-color: color-mix(in srgb, #027a48 28%, transparent);
}
.agentrun-risk-area[data-area="terms"] {
  color: #344054;   /* slate — legal */
  background: rgba(52, 64, 84, 0.16);
  background: color-mix(in srgb, #344054 16%, transparent);
  border-color: rgba(52, 64, 84, 0.28);
  border-color: color-mix(in srgb, #344054 28%, transparent);
}
.agentrun-risk-area[data-area="partner_fit"],
.agentrun-risk-area[data-area="fit"] {
  color: #6941c6;   /* violet — audience/fit */
  background: rgba(105, 65, 198, 0.16);
  background: color-mix(in srgb, #6941c6 16%, transparent);
  border-color: rgba(105, 65, 198, 0.28);
  border-color: color-mix(in srgb, #6941c6 28%, transparent);
}
.agentrun-risk-area[data-area="risk_disclosure"],
.agentrun-risk-area[data-area="compliance"] {
  color: #c11574;   /* rose — compliance */
  background: rgba(193, 21, 116, 0.16);
  background: color-mix(in srgb, #c11574 16%, transparent);
  border-color: rgba(193, 21, 116, 0.28);
  border-color: color-mix(in srgb, #c11574 28%, transparent);
}

/* Risk head row — pills + title on the same baseline */
.agentrun-risk-head {
  display: flex;
  align-items: center;       /* pills + title centered vertically */
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.agentrun-risk-head .agentrun-risk-title {
  /* title wraps to next line on narrow viewports without breaking
   * the pill alignment */
  flex: 1 1 100%;
  margin-top: 2px;
}
@media (min-width: 640px) {
  .agentrun-risk-head .agentrun-risk-title {
    flex: 1 1 auto;
    margin-top: 0;
  }
}

/* Evidence reveal under each risk */
.agentrun-risk-evidence {
  margin-top: 6px;
  font-size: 12px;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-risk-evidence > summary {
  cursor: pointer;
  list-style: none;
  color: var(--air-color-text-faint, #8a8f9c);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.agentrun-risk-evidence > summary::-webkit-details-marker { display: none; }
.agentrun-risk-evidence > summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 120ms ease;
}
.agentrun-risk-evidence[open] > summary::before {
  transform: rotate(90deg);
}
.agentrun-risk-evidence blockquote {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--air-color-border-faint, rgba(0,0,0,0.08));
  background: var(--air-color-surface-2, rgba(0,0,0,0.03));
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.agentrun-risk-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-risk-detail {
  font-size: 12px;
  line-height: 1.5;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-revision {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--air-divider, rgba(11, 16, 32, 0.08));
}
.agentrun-revision > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--air-color-text-muted, #5e6473);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.agentrun-revision-pre {
  margin: 8px 0 0 0;
  font-family: var(--air-font-mono, monospace);
  font-size: 11px;
  line-height: 1.55;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  padding: 10px 12px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

/* ════════════════════════════════════════════════════════════════════════
 * Sense-check (CFO) full output — summary, verdicts, suggested revision
 * Kenneth 2026-05-25: "the original amazing summary of suggestions from
 * Sense Check for the full output of verdict + edit suggestions are gone".
 * Restored inside the CFO step OUTPUT (renderStructuredValidator).
 * ════════════════════════════════════════════════════════════════════════ */

/* Top-line verdict banner */
.agentrun-csc-summary {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border-left: 3px solid var(--c-accent, #c0a062);
  border-radius: 6px;
}
.agentrun-csc-summary-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--air-color-text-muted, #5e6473);
  margin-bottom: 6px;
}
.agentrun-csc-summary-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--air-color-text-primary, #0b1020);
}

/* Two verdict cards (Unit econ + Partner fit) — sit side-by-side ≥640px */
.agentrun-csc-verdicts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 640px) {
  .agentrun-csc-verdicts {
    grid-template-columns: 1fr 1fr;
  }
}
.agentrun-csc-verdict-card {
  padding: 10px 12px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
  border-radius: 8px;
}
.agentrun-csc-verdict-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.agentrun-csc-verdict-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-csc-verdict-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.agentrun-csc-verdict-chip[data-verdict="viable"],
.agentrun-csc-verdict-chip[data-verdict="fits"] {
  color: #027a48;
  background: rgba(2, 122, 72, 0.18);
  background: color-mix(in srgb, #027a48 18%, transparent);
  border-color: rgba(2, 122, 72, 0.32);
  border-color: color-mix(in srgb, #027a48 32%, transparent);
}
.agentrun-csc-verdict-chip[data-verdict="shaky"] {
  color: #b54708;
  background: rgba(181, 71, 8, 0.18);
  background: color-mix(in srgb, #b54708 18%, transparent);
  border-color: rgba(181, 71, 8, 0.32);
  border-color: color-mix(in srgb, #b54708 32%, transparent);
}
.agentrun-csc-verdict-chip[data-verdict="broken"],
.agentrun-csc-verdict-chip[data-verdict="mismatch"] {
  color: #b42318;
  background: rgba(180, 35, 24, 0.20);
  background: color-mix(in srgb, #b42318 20%, transparent);
  border-color: rgba(180, 35, 24, 0.36);
  border-color: color-mix(in srgb, #b42318 36%, transparent);
}
.agentrun-csc-verdict-chip[data-verdict="unknown"] {
  color: #475467;
  background: rgba(71, 84, 103, 0.14);
  background: color-mix(in srgb, #475467 14%, transparent);
  border-color: rgba(71, 84, 103, 0.26);
  border-color: color-mix(in srgb, #475467 26%, transparent);
}
.agentrun-csc-verdict-dl {
  margin: 0;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 10px;
  font-size: 12px;
  line-height: 1.5;
}
.agentrun-csc-verdict-dl dt {
  color: var(--air-color-text-faint, #8a8f9c);
  font-weight: 500;
}
.agentrun-csc-verdict-dl dd {
  margin: 0;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-csc-mismatches {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}
.agentrun-csc-mismatches li {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 2px;
}

/* Suggested revision block */
.agentrun-csc-revision {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--air-divider, rgba(11, 16, 32, 0.08));
}
.agentrun-csc-revision-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.agentrun-csc-revision-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-csc-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--air-color-bg, transparent);
  border: 1px solid var(--air-color-border, rgba(0, 0, 0, 0.16));
  color: var(--air-color-text-primary, #0b1020);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 80ms ease, border-color 80ms ease;
}
.agentrun-csc-download:hover {
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border-color: var(--air-color-border-strong, rgba(0, 0, 0, 0.28));
}
.agentrun-csc-download:active {
  transform: translateY(1px);
}

.agentrun-csc-revision-headline {
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border-radius: 6px;
}
.agentrun-csc-revision-headline dt {
  font-weight: 600;
  color: var(--air-color-text-muted, #5e6473);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  align-self: center;
}
.agentrun-csc-revision-headline dd {
  margin: 0;
  color: var(--air-color-text-primary, #0b1020);
}

.agentrun-csc-diff-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--air-color-text-muted, #5e6473);
  margin-bottom: 8px;
}
.agentrun-csc-diff-counts {
  font-weight: 500;
  color: var(--air-color-text-faint, #8a8f9c);
  letter-spacing: 0.04em;
  margin-left: 4px;
  text-transform: none;
}
.agentrun-csc-term-diffs {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agentrun-csc-term-diff {
  padding: 10px 12px;
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
  border-radius: 8px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.02));
  transition: opacity 120ms ease, background 120ms ease;
}
/* Approved/rejected status changes the card chrome itself so the user
 * can scan a long term-diff list and see at a glance which ones they've
 * already reviewed. */
.agentrun-csc-term-diff[data-status="approved"] {
  background: rgba(2, 122, 72, 0.05);
  background: color-mix(in srgb, #027a48 5%, transparent);
  border-color: rgba(2, 122, 72, 0.24);
  border-color: color-mix(in srgb, #027a48 24%, transparent);
}
.agentrun-csc-term-diff[data-status="rejected"] {
  opacity: 0.55;
  background: rgba(94, 100, 115, 0.05);
  background: color-mix(in srgb, #5e6473 5%, transparent);
}

.agentrun-csc-term-diff-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.agentrun-csc-term-diff-status-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.agentrun-csc-term-diff-status-pill[data-status="pending"] {
  color: #5e6473;
  background: rgba(94, 100, 115, 0.10);
  background: color-mix(in srgb, #5e6473 10%, transparent);
  border-color: rgba(94, 100, 115, 0.20);
  border-color: color-mix(in srgb, #5e6473 20%, transparent);
}
.agentrun-csc-term-diff-status-pill[data-status="approved"] {
  color: #027a48;
  background: rgba(2, 122, 72, 0.16);
  background: color-mix(in srgb, #027a48 16%, transparent);
  border-color: rgba(2, 122, 72, 0.32);
  border-color: color-mix(in srgb, #027a48 32%, transparent);
}
.agentrun-csc-term-diff-status-pill[data-status="rejected"] {
  color: #5e6473;
  background: rgba(94, 100, 115, 0.14);
  background: color-mix(in srgb, #5e6473 14%, transparent);
  border-color: rgba(94, 100, 115, 0.26);
  border-color: color-mix(in srgb, #5e6473 26%, transparent);
}

.agentrun-csc-term-diff-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 640px) {
  .agentrun-csc-term-diff-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.agentrun-csc-term-diff-col {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
}
.agentrun-csc-term-diff-col[data-col="was"] {
  background: rgba(180, 35, 24, 0.06);
  background: color-mix(in srgb, #b42318 6%, transparent);
  border: 1px solid rgba(180, 35, 24, 0.16);
  border: 1px solid color-mix(in srgb, #b42318 16%, transparent);
}
.agentrun-csc-term-diff-col[data-col="now"] {
  background: rgba(2, 122, 72, 0.06);
  background: color-mix(in srgb, #027a48 6%, transparent);
  border: 1px solid rgba(2, 122, 72, 0.16);
  border: 1px solid color-mix(in srgb, #027a48 16%, transparent);
}
.agentrun-csc-term-diff-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.agentrun-csc-term-diff-col[data-col="was"] .agentrun-csc-term-diff-label { color: #8b0a0a; }
.agentrun-csc-term-diff-col[data-col="now"] .agentrun-csc-term-diff-label { color: #027a48; }
.agentrun-csc-term-diff-text {
  color: var(--air-color-text-primary, #0b1020);
  word-break: break-word;
}
.agentrun-csc-term-diff-text em {
  font-style: italic;
  color: var(--air-color-text-faint, #8a8f9c);
}
.agentrun-csc-term-diff-why {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-csc-term-diff-why-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--air-color-text-faint, #8a8f9c);
  margin-right: 4px;
}

/* Per-row Approve / Reject / Undo cluster.
 * Demotion ladder (rule #4): Approve is primary, Reject is ghost.
 * Once a decision is made the card flips to a single Undo ghost button. */
.agentrun-csc-term-diff-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Footer Apply CTA — primary action for the whole term-diff section.
 * Sits below the term-diff list with a status string on the left. */
.agentrun-csc-apply-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-top: 4px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
  border-radius: 8px;
}
.agentrun-csc-apply-status {
  font-size: 12px;
  color: var(--air-color-text-muted, #5e6473);
  font-weight: 500;
}
.agentrun-csc-apply-btn[disabled],
.agentrun-csc-apply-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
@media (max-width: 480px) {
  .agentrun-csc-apply-row {
    flex-direction: column;
    align-items: stretch;
  }
  .agentrun-csc-apply-btn {
    width: 100%;
  }
}

.agentrun-csc-fullrewrite {
  margin-top: 8px;
}
.agentrun-csc-fullrewrite > summary {
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--air-color-text-faint, #8a8f9c);
  list-style: none;
  user-select: none;
}
.agentrun-csc-fullrewrite > summary::-webkit-details-marker { display: none; }
.agentrun-csc-fullrewrite > summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 120ms ease;
}
.agentrun-csc-fullrewrite[open] > summary::before {
  transform: rotate(90deg);
}
.agentrun-csc-fullrewrite-pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 11px;
  line-height: 1.55;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
  color: var(--air-color-text-primary, #0b1020);
}

/* ── handoff arrow ───────────────────────────────────────────────────── */

.agentrun-handoff {
  padding: 6px 0;
  margin-left: 8px;
}
.agentrun-handoff-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--air-color-text-muted, #5e6473);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.agentrun-handoff-row::-webkit-details-marker { display: none; }
.agentrun-handoff-arrow {
  font-size: 16px;
  line-height: 1;
  color: var(--c-accent, #c0a062);
  font-weight: 600;
}
.agentrun-handoff-label {
  font-style: italic;
}
.agentrun-handoff-toggle {
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--air-color-text-faint, #8a8f9c);
  margin-left: 6px;
}
.agentrun-handoff-pre {
  margin: 8px 0 0 24px;
  font-family: var(--air-font-mono, monospace);
  font-size: 11px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  padding: 8px 10px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
  color: var(--air-color-text-muted, #5e6473);
}

/* ════════════════════════════════════════════════════════════════════════
 * NEW COMPONENT 1 CHROME — phase chip, elapsed pill, tokens, cost,
 * inline progress bar, reasoning ticker, download button.
 *
 * All these sit in the byline row alongside the existing By/name/model
 * elements. On mobile the byline-right cluster wraps below the left.
 * ════════════════════════════════════════════════════════════════════════ */

.agentrun-byline {
  flex-wrap: wrap;
  gap: 8px 12px;
}
.agentrun-byline-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}
.agentrun-byline-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.agentrun-byline-elapsed,
.agentrun-byline-tokens,
.agentrun-byline-cost {
  font-family: var(--air-font-mono, ui-monospace, "JetBrains Mono", monospace);
  font-size: 11px;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-byline-elapsed {
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.04));
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.agentrun-byline-elapsed[data-state="running"] {
  background: rgba(11, 16, 32, 0.06);
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-byline-elapsed[data-state="warn"] {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}
.agentrun-byline-elapsed[data-state="danger"] {
  background: rgba(220, 38, 38, 0.16);
  color: #991b1b;
  animation: agentrun-pulse-danger 1.6s ease-in-out infinite;
}
.agentrun-byline-elapsed[data-state="done"] {
  background: rgba(12, 138, 62, 0.16);
  color: #0c8a3e;
}
.agentrun-byline-elapsed[data-state="error"] {
  background: rgba(220, 38, 38, 0.16);
  color: #991b1b;
}
@keyframes agentrun-pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Phase chip — Connecting…/Thinking…/Writing…/Finalising… */
.agentrun-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.04));
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-phase::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.agentrun-phase[data-phase-state="queued"] {
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.04));
  color: var(--air-color-text-muted, #94a3b8);
}
.agentrun-phase[data-phase-state="connecting"] {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}
.agentrun-phase[data-phase-state="thinking"] {
  background: rgba(168, 85, 247, 0.14);
  color: #6b21a8;
}
.agentrun-phase[data-phase-state="thinking"]::before,
.agentrun-phase[data-phase-state="writing"]::before,
.agentrun-phase[data-phase-state="finalizing"]::before {
  animation: agentrun-pulse-dot 1.4s ease-in-out infinite;
}
.agentrun-phase[data-phase-state="writing"] {
  background: rgba(12, 138, 62, 0.14);
  color: #0c8a3e;
}
.agentrun-phase[data-phase-state="finalizing"] {
  background: rgba(53, 48, 182, 0.14);
  color: #3530b6;
}
.agentrun-phase[data-phase-state="done"] {
  background: rgba(12, 138, 62, 0.14);
  color: #0c8a3e;
}
.agentrun-phase[data-phase-state="error"] {
  background: rgba(220, 38, 38, 0.16);
  color: #991b1b;
}
@keyframes agentrun-pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50%      { opacity: 1.0; transform: scale(1.15); }
}

/* Download interim output button (icon-only, 32x32) */
.agentrun-download {
  appearance: none;
  background: transparent;
  border: 1px solid var(--air-divider, rgba(11, 16, 32, 0.12));
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: var(--air-color-text-muted, #5e6473);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.agentrun-download:hover {
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.04));
  border-color: var(--air-divider, rgba(11, 16, 32, 0.2));
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-download[hidden] { display: none !important; }

/* Inline progress bar (replaces legacy #llm-stream-bar) */
.agentrun-bar {
  height: 3px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.06));
  border-radius: 9999px;
  overflow: hidden;
  margin: 8px 0 12px;
}
.agentrun-bar[hidden] { display: none !important; }
.agentrun-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg,
    var(--c-accent, #c0a062) 0%,
    #0c8a3e 100%);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reasoning ticker — single-line headline above the <details> */
.agentrun-ticker {
  font-family: var(--air-font-mono, ui-monospace, "JetBrains Mono", monospace);
  font-size: 11px;
  line-height: 1.45;
  color: var(--air-color-text-muted, #5e6473);
  margin: 0 0 8px;
  padding: 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px dashed var(--air-divider, rgba(11, 16, 32, 0.08));
  opacity: 0.85;
}
.agentrun-ticker[hidden] { display: none !important; }

/* ════════════════════════════════════════════════════════════════════════
 * COMPONENT 2 — Findings (Edits/Risks)
 * ════════════════════════════════════════════════════════════════════════ */

.agentrun-c1,
.agentrun-c2,
.agentrun-c3 {
  border-top: 1px solid var(--air-divider, rgba(11, 16, 32, 0.08));
  margin-top: 16px;
  padding-top: 16px;
}
.agentrun-c1 {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.agentrun-c-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.agentrun-c-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--air-color-text-primary, #0b1020);
}
.agentrun-c-stats,
.agentrun-c-hint {
  font-size: 11px;
  color: var(--air-color-text-muted, #5e6473);
}

.agentrun-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--air-divider, rgba(11, 16, 32, 0.08));
  margin-bottom: 12px;
}
.agentrun-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--air-color-text-muted, #5e6473);
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.agentrun-tab.is-active {
  color: var(--air-color-text-primary, #0b1020);
  border-bottom-color: var(--air-color-text-primary, #0b1020);
  font-weight: 600;
}
.agentrun-tab-count {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.06));
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-tab.is-active .agentrun-tab-count {
  background: rgba(11, 16, 32, 0.1);
  color: var(--air-color-text-primary, #0b1020);
}

.agentrun-findings-list[hidden] { display: none !important; }
.agentrun-findings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agentrun-findings-empty {
  font-size: 12px;
  color: var(--air-color-text-muted, #94a3b8);
  padding: 14px 0;
  text-align: center;
}

.agentrun-finding {
  padding: 12px 0;
  border-bottom: 1px solid var(--air-divider, rgba(11, 16, 32, 0.06));
}
.agentrun-finding:last-child { border-bottom: none; }
.agentrun-finding-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.agentrun-finding-sev {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.agentrun-finding-sev[data-sev="high"]   { background: rgba(220, 38, 38, 0.14); color: #991b1b; }
.agentrun-finding-sev[data-sev="medium"] { background: rgba(245, 158, 11, 0.16); color: #92400e; }
.agentrun-finding-sev[data-sev="low"]    { background: rgba(53, 71, 110, 0.10); color: #475569; }
.agentrun-finding-sev[data-sev="auto-approved"],
.agentrun-finding-sev[data-sev="auto_approved"] { background: rgba(12, 138, 62, 0.14); color: #0c8a3e; }
.agentrun-finding-sev[data-sev="needs-review"],
.agentrun-finding-sev[data-sev="needs_review"]  { background: rgba(245, 158, 11, 0.16); color: #92400e; }
.agentrun-finding-sev[data-sev="rejected"] { background: rgba(100, 116, 139, 0.14); color: #475569; }
.agentrun-finding-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--air-color-text-primary, #0b1020);
  line-height: 1.4;
}
.agentrun-finding-status {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--air-color-text-muted, #94a3b8);
  flex-shrink: 0;
}
.agentrun-finding[data-status="approved"] .agentrun-finding-status,
.agentrun-finding[data-status="auto-approved"] .agentrun-finding-status,
.agentrun-finding[data-status="auto_approved"] .agentrun-finding-status {
  color: #0c8a3e;
}
.agentrun-finding[data-status="rejected"] .agentrun-finding-status {
  color: #991b1b;
}
.agentrun-finding-detail {
  font-size: 12px;
  line-height: 1.5;
  color: var(--air-color-text-muted, #5e6473);
  margin-top: 4px;
}
.agentrun-finding-diff summary {
  margin-top: 6px;
  cursor: pointer;
  font-size: 11px;
  color: var(--air-color-text-muted, #5e6473);
  user-select: none;
}
.agentrun-finding-diff pre {
  margin: 6px 0 0 0;
  padding: 8px 10px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 11px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.03));
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
  color: var(--air-color-text-primary, #0b1020);
}
/* New: render diff body as inline HTML with seg-ins / seg-del coloring.
 * Used when bridgeFindings supplies pre-rendered word-diff HTML so the
 * Findings card matches the legacy #refine-edits panel visual. */
.agentrun-finding-diff-body {
  margin: 6px 0 0;
  padding: 8px 10px;
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 12px;
  line-height: 1.55;
  background: var(--c-bg, transparent);
  border: 1px solid var(--air-color-border-faint, rgba(0, 0, 0, 0.06));
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
  color: var(--air-color-text-muted, #5e6473);
}
.agentrun-finding-diff-body .seg-eq  { color: var(--air-color-text-muted, #5e6473); }
.agentrun-finding-diff-body .seg-del {
  background: rgba(197, 13, 13, 0.10);
  color: #8b0a0a;
  text-decoration: line-through;
  padding: 0 2px;
  border-radius: 2px;
}
.agentrun-finding-diff-body .seg-ins {
  background: rgba(12, 138, 62, 0.10);
  color: #0c5b2a;
  padding: 0 2px;
  border-radius: 2px;
}
.agentrun-finding-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════════════════════════════════
 * COMPONENT 3 — Refinement rounds
 * ════════════════════════════════════════════════════════════════════════ */

.agentrun-rounds-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.agentrun-round {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--air-divider, rgba(11, 16, 32, 0.06));
}
.agentrun-round:last-child { border-bottom: none; }
.agentrun-round[data-active="true"] {
  background: var(--c-surface-soft, rgba(192, 160, 98, 0.06));
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 8px;
  border-left: 3px solid var(--c-accent, #c0a062);
}

.agentrun-round-idx {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.05));
  color: var(--air-color-text-muted, #5e6473);
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.agentrun-round[data-active="true"] .agentrun-round-idx {
  background: var(--air-color-text-primary, #0b1020);
  color: #fff;
}
.agentrun-round-body {
  min-width: 0;
}
.agentrun-round-label {
  font-size: 13px;
  line-height: 1.4;
  color: var(--air-color-text-primary, #0b1020);
  display: flex;
  align-items: center;
  gap: 6px;
}
.agentrun-round-mode {
  font-size: 11px;
  opacity: 0.7;
}
.agentrun-round-meta {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 10px;
  color: var(--air-color-text-muted, #94a3b8);
  margin-top: 2px;
}
.agentrun-round-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.agentrun-round-current {
  font-family: var(--air-font-mono, ui-monospace, monospace);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--air-color-text-primary, #0b1020);
  color: #fff;
}
.agentrun-icon-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--air-divider, rgba(11, 16, 32, 0.12));
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--air-color-text-muted, #5e6473);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.agentrun-icon-btn:hover {
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.04));
  color: var(--air-color-text-primary, #0b1020);
}

/* ════════════════════════════════════════════════════════════════════════
 * Skeleton placeholders (live > static — rule #5)
 * ════════════════════════════════════════════════════════════════════════ */

.agentrun-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}
.agentrun-skel-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.agentrun-skel-key {
  flex-shrink: 0;
  width: 90px;
  height: 10px;
  border-radius: 4px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.08));
  animation: agentrun-shimmer 1.5s ease-in-out infinite;
}
.agentrun-skel-val {
  flex: 1;
  height: 10px;
  border-radius: 4px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.06));
  animation: agentrun-shimmer 1.5s ease-in-out infinite 0.2s;
}
.agentrun-skel-val.short { max-width: 30%; }
.agentrun-skel-val.long  { max-width: 80%; }
.agentrun-skel-risk {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
}
.agentrun-skel-sev {
  flex-shrink: 0;
  width: 48px;
  height: 16px;
  border-radius: 9999px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.08));
  animation: agentrun-shimmer 1.5s ease-in-out infinite;
}
.agentrun-skel-title {
  flex: 1;
  height: 12px;
  border-radius: 4px;
  background: var(--c-surface-soft, rgba(11, 16, 32, 0.06));
  animation: agentrun-shimmer 1.5s ease-in-out infinite 0.2s;
}
.agentrun-skel-title.long { max-width: 70%; }
@keyframes agentrun-shimmer {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 0.35; }
}

/* ════════════════════════════════════════════════════════════════════════
 * Mobile collapse — 375px first
 * ════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .agentrun { padding: 14px; margin: 12px 0; }
  .agentrun-byline-left {
    width: 100%;
    font-size: 12px;
  }
  .agentrun-byline-right {
    width: 100%;
    justify-content: space-between;
  }
  .agentrun-byline-elapsed,
  .agentrun-byline-tokens,
  .agentrun-byline-cost {
    font-size: 10px;
  }
  .agentrun-finding-actions { gap: 8px; }
  .agentrun-finding-actions .air-btn { min-height: 36px; }
  .agentrun-round {
    grid-template-columns: 24px 1fr;
    grid-template-rows: auto auto;
  }
  .agentrun-round-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* ── dark-mode token re-pointing removed 2026-05-26 ─────────────────────── */
/* The base styles use var(--air-*) tokens that already flip in dark mode
 * via air-design-tokens.css. The old block here had a `For safety` rule
 * whose selector was stripped by the dark-mode removal script, leaving
 * a malformed comment + orphan `{ ... }` that broke CSS parsing for the
 * entire following section. Removed entirely — no dark mode anywhere. */

/* "Digesting [X]…" prominent headline — the loud UX while we wait for the
   LLM's first reasoning tokens. Rotates as new context_consumed SSE events
   arrive. Hidden until first event, hidden again on context_consumed_done. */
.agentrun-context-digesting {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 6px;
  padding: 12px 14px;
  border-radius: 10px;
  /* Stronger gold tint + dark navy border + clear top-to-bottom hint of
     activity. Previous 0.18-alpha gold was washed out on white surface
     (Kenneth 2026-05-26: "barely see prompt digesting", "contrast too low"). */
  background: linear-gradient(90deg, rgba(192,160,98,0.45), rgba(192,160,98,0.18));
  border: 1px solid rgba(192,160,98,0.55);
  font-size: 15px; font-weight: 600;
  color: #0b1020;
  position: relative;
  overflow: hidden;
}
.agentrun-context-digesting[hidden] { display: none !important; }
.agentrun-context-digesting::after {
  /* subtle moving shine to signal "in progress" */
  content: '';
  position: absolute; top: 0; bottom: 0; left: -40%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: agentrun-digesting-shine 1600ms linear infinite;
  pointer-events: none;
}
@keyframes agentrun-digesting-shine {
  0%   { left: -40%; }
  100% { left: 110%; }
}
.agentrun-context-digesting-spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(11,16,32,0.18);
  border-top-color: rgba(11,16,32,0.78);
  animation: agentrun-digesting-spin 700ms linear infinite;
  flex: 0 0 14px;
}
@keyframes agentrun-digesting-spin {
  to { transform: rotate(360deg); }
}
.agentrun-context-digesting-label {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.005em;
  color: #0b1020;
}
.agentrun-context-digesting-verb {
  font-family: inherit;
  font-weight: 700;
  margin-right: 2px;
  color: #0b1020;
}
.agentrun-context-digesting-name {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700;
  background: rgba(11,16,32,0.92);
  color: #f5e6c0;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  /* retrigger this animation each time the name text changes */
}
.agentrun-context-digesting.is-fresh .agentrun-context-digesting-name {
  animation: agentrun-digesting-name-pop 320ms cubic-bezier(0.2,0.7,0.3,1);
}
@keyframes agentrun-digesting-name-pop {
  0%   { opacity: 0; transform: translateY(2px) scale(0.98); }
  60%  { opacity: 1; transform: translateY(-1px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.agentrun-context-digesting-dots {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  margin-left: 4px;
  vertical-align: baseline;
}
.agentrun-context-digesting-dots .dot {
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.25;
  animation: agentrun-digesting-dot 1200ms ease-in-out infinite;
}
.agentrun-context-digesting-dots .dot:nth-child(1) { animation-delay: 0ms; }
.agentrun-context-digesting-dots .dot:nth-child(2) { animation-delay: 200ms; }
.agentrun-context-digesting-dots .dot:nth-child(3) { animation-delay: 400ms; }
@keyframes agentrun-digesting-dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 1.00; transform: translateY(-2px); }
}

/* Context registry pills — populated from SSE phase=context_ready inside
   each AgentRun step card. Streams in one-at-a-time as the LLM "consumes"

   Design (2026-05-26 Kenneth feedback "very busy and very confusing"):
   - ONE neutral background for all pills (no rainbow of bundle colors)
   - Left-edge stripe = TIER (the thing that actually drives LLM behavior)
   - Small 6px dot = BUNDLE (subordinate grouping signal)
   - Tier color: red=hot, amber=warm, blue=cold, hidden=off
   - Bundle color: set via --pill-bundle-color custom property */
.agentrun-context-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 4px;
  align-items: center;
  min-height: 22px;
}
.agentrun-context-pills[hidden] { display: none !important; }
.agentrun-context-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  color: #0b1020;
  background: rgba(11,16,32,0.10);
  border-left: 3px solid var(--pill-tier-color, #8a8a8a);
  white-space: nowrap;
  line-height: 1.5;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  /* stream-in animation — staggered via --pill-delay set in JS */
  opacity: 0;
  transform: translateY(3px);
  animation: agentrun-pill-stream 280ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  animation-delay: var(--pill-delay, 0ms);
}
@keyframes agentrun-pill-stream {
  0%   { opacity: 0; transform: translateY(3px); }
  60%  { opacity: 1; transform: translateY(-1px); }
  100% { opacity: 1; transform: translateY(0); }
}
.agentrun-context-pill[data-tier="hot"]  { --pill-tier-color: #d63a3a; }
.agentrun-context-pill[data-tier="warm"] { --pill-tier-color: #f39c12; }
.agentrun-context-pill[data-tier="cold"] { --pill-tier-color: #3498db; }
.agentrun-context-pill[data-tier="off"]  { display: none; }
.agentrun-context-pill[data-wired="false"] { opacity: 0.45; font-style: italic; }
.agentrun-context-pill[data-empty="true"] { opacity: 0.55; }
.agentrun-context-pill[data-phase="building"] {
  border-left-style: dashed;
  color: rgba(11,16,32,0.55);
}
.agentrun-context-pill[data-phase="error"] {
  background: rgba(214,58,58,0.12);
  border-left-color: #d63a3a;
  color: #b3261e;
}
/* Confirmed-consumed pills (server-detected presence in assembled prompt).
   The MOST-RECENT one carries data-state="digesting" — subtle pulse + bold
   label until the next consumed event arrives or the done event fires. */
.agentrun-context-pill[data-phase="consumed"] {
  border-left-color: var(--pill-bundle-color, #8a8a8a);
}
.agentrun-context-pill[data-phase="consumed"][data-state="digesting"] {
  background: rgba(192,160,98,0.10);  /* gold tint while active */
  color: rgba(11,16,32,0.92);
  font-weight: 600;
  animation: agentrun-pill-stream 280ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards,
             agentrun-pill-digesting 1200ms ease-in-out infinite alternate;
}
.agentrun-context-pill[data-phase="consumed"][data-state="digesting"] .agentrun-context-pill-label code {
  font-family: inherit;
  font-weight: 600;
  background: rgba(11,16,32,0.06);
  padding: 0 4px;
  border-radius: 3px;
}
.agentrun-context-pill[data-phase="consumed"][data-state="done"] {
  opacity: 0.82;
}
@keyframes agentrun-pill-digesting {
  0%   { opacity: 0.85; }
  100% { opacity: 1.00; }
}
.agentrun-context-pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pill-bundle-color, #8a8a8a);
  flex: 0 0 6px;
}
.agentrun-context-pill-label {
  font-weight: 500;
}
.agentrun-context-pill-count {
  font-size: 10px;
  color: rgba(11,16,32,0.45);
  font-variant-numeric: tabular-nums;
}
.agentrun-context-pills-meta {
  font-size: 11px; color: #6b7180;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  animation: agentrun-pill-stream 240ms ease-out forwards;
  animation-delay: var(--pill-delay, 0ms);
}

.agentrun-context-inspect {
  margin: 4px 0 8px;
  border: 1px solid rgba(11,16,32,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.72);
}
.agentrun-context-inspect[hidden] { display: none !important; }
.agentrun-context-inspect-summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.agentrun-context-inspect-body {
  padding: 0 10px 10px;
  font-size: 12px;
  color: #334155;
}
.agentrun-context-inspect-head,
.agentrun-context-inspect-memory {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 8px;
}
.agentrun-context-inspect code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: rgba(11,16,32,0.06);
  border-radius: 4px;
  padding: 1px 4px;
}
.agentrun-context-inspect-chip {
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(148,163,184,0.16);
  color: #475569;
  font-weight: 600;
}
.agentrun-context-inspect-chip[data-loaded="true"] {
  background: rgba(34,197,94,0.12);
  color: #166534;
}

/* Context budget bar — surfaces budget_used_pct so the user can trim uploads/
   refs before sources get budget_dropped silently. Level thresholds:
   ok (<70%), warn (70-89%), critical (≥90%). */
.agentrun-context-inspect-budget {
  margin: 4px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(11,16,32,0.04);
  border: 1px solid rgba(11,16,32,0.08);
}
.agentrun-context-inspect-budget[data-level="warn"]     { background: rgba(234,179,8,0.08);  border-color: rgba(234,179,8,0.30); }
.agentrun-context-inspect-budget[data-level="critical"] { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.30); }
.agentrun-context-budget-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12px;
}
.agentrun-context-budget-head strong { color: #0b1020; }
.agentrun-context-budget-num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600;
  color: #1e293b;
}
.agentrun-context-inspect-budget[data-level="warn"]     .agentrun-context-budget-num { color: #854d0e; }
.agentrun-context-inspect-budget[data-level="critical"] .agentrun-context-budget-num { color: #991b1b; }
.agentrun-context-budget-head small {
  color: #64748b;
  font-weight: 400;
}
.agentrun-context-budget-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(11,16,32,0.08);
  overflow: hidden;
}
.agentrun-context-budget-bar-fill {
  height: 100%;
  background: #22c55e;
  transition: width 200ms ease;
}
.agentrun-context-budget-bar[data-level="warn"]     .agentrun-context-budget-bar-fill { background: #eab308; }
.agentrun-context-budget-bar[data-level="critical"] .agentrun-context-budget-bar-fill { background: #ef4444; }
.agentrun-context-inspect-session {
  margin: 6px 0 8px;
  color: #64748b;
}
.agentrun-context-inspect-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.agentrun-context-inspect-grid ul {
  margin: 4px 0 0;
  padding-left: 16px;
}
.agentrun-context-inspect-grid li {
  margin: 2px 0;
}
.agentrun-context-inspect-grid li[data-state="loaded"] span { color: #166534; font-weight: 700; }
.agentrun-context-inspect-grid li[data-state="empty"] span { color: #64748b; }
.agentrun-context-inspect-grid small { color: #64748b; }
@media (max-width: 720px) {
  .agentrun-context-inspect-grid { grid-template-columns: 1fr; }
}

/* hidden guard (rule #10) */
.agentrun[hidden] { display: none !important; }

/* ─── Memory-proposal footer (👍/👎 + free-text rule) ───────────────── */
/* Hidden until completeStep activates it on a step with agentSlug set.
   The footer sits below the OUTPUT lane inside .agentrun-output so it's
   visually anchored to the step it's about. Skip is first-class — the
   form can be dismissed without POSTing. */
.agentrun-memory-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(11,16,32,0.08);
  border-radius: 8px;
  background: rgba(232, 93, 117, 0.04);  /* coral tint — matches Agent bundle */
}
.agentrun-memory-foot[hidden] { display: none; }

.agentrun-memory-vote {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agentrun-memory-thumb {
  appearance: none;
  border: 1px solid rgba(11,16,32,0.12);
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.agentrun-memory-thumb:hover { background: rgba(232, 93, 117, 0.10); }
.agentrun-memory-thumb:active { transform: scale(0.96); }
.agentrun-memory-thumb.active {
  background: rgba(232, 93, 117, 0.18);
  border-color: rgba(232, 93, 117, 0.55);
}
.agentrun-memory-prompt {
  font-size: 12px;
  color: rgba(11,16,32,0.62);
  margin-left: 4px;
}

.agentrun-memory-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agentrun-memory-form[hidden] { display: none; }
.agentrun-memory-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: rgba(11,16,32,0.72);
}
.agentrun-memory-kind,
.agentrun-memory-text {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid rgba(11,16,32,0.16);
  border-radius: 6px;
  background: #fff;
  color: #0b1020;
  width: 100%;
  box-sizing: border-box;
}
.agentrun-memory-text { resize: vertical; min-height: 56px; }
.agentrun-memory-text:focus,
.agentrun-memory-kind:focus {
  outline: 2px solid rgba(232, 93, 117, 0.45);
  outline-offset: 1px;
  border-color: rgba(232, 93, 117, 0.55);
}
.agentrun-memory-count {
  font-size: 11px;
  color: rgba(11,16,32,0.45);
  font-variant-numeric: tabular-nums;
  align-self: flex-end;
}
.agentrun-memory-count[data-state="warn"] { color: #c2410c; font-weight: 500; }

.agentrun-memory-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.agentrun-memory-submit,
.agentrun-memory-skip {
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(11,16,32,0.16);
}
.agentrun-memory-submit {
  background: #0b1020;
  color: #fff;
  border-color: #0b1020;
}
.agentrun-memory-submit:hover:not(:disabled) { background: #1a2240; }
.agentrun-memory-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.agentrun-memory-skip {
  background: #fff;
  color: rgba(11,16,32,0.7);
}
.agentrun-memory-skip:hover:not(:disabled) { background: rgba(11,16,32,0.04); }
.agentrun-memory-skip:disabled { opacity: 0.5; cursor: not-allowed; }

.agentrun-memory-status {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(11,16,32,0.04);
  color: rgba(11,16,32,0.72);
}
.agentrun-memory-status[hidden] { display: none; }
.agentrun-memory-status[data-tone="pending"] {
  background: rgba(11,16,32,0.06);
  color: rgba(11,16,32,0.72);
}
.agentrun-memory-status[data-tone="ok"] {
  background: rgba(34,197,94,0.10);
  color: #166534;
}
.agentrun-memory-status[data-tone="error"] {
  background: rgba(220,38,38,0.10);
  color: #991b1b;
}
.agentrun-memory-status[data-tone="idle"] {
  background: rgba(11,16,32,0.03);
  color: rgba(11,16,32,0.55);
  font-style: italic;
}
.agentrun-memory-status a {
  color: inherit;
  text-decoration: underline;
}
