/* ChiefLab Run Viewer — agent-first single-page app.
   Loaded only via signed reviewUrl from a *_diagnose tool result.
   Per-operator accent color is set at runtime via --op-color. */

:root {
  --bg: #0a0a0b;
  --bg-elev: #141416;
  --bg-elev-2: #1c1c20;
  --border: #232328;
  --border-strong: #2f2f36;
  --text: #f5f5f5;
  --text-secondary: #b8b8bf;
  --text-muted: #6b6b73;
  --op-color: #ff6b4a;            /* default; runtime override per operator */
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.viewer-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--op-color); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; }

/* Header */
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* P65 — header padding aligns the brand + breadcrumb with the
     centered 1200px room shell below. Without max(), the brand
     sat at the absolute page edge (padding-left: 32px) while the
     content column started ~80px in on wider viewports — the
     breadcrumb looked orphaned in the top-left of the screenshot.
     calc((100vw - 1200px) / 2 + 32px) puts the padding equal to
     "page gutter + 32px content padding," collapsing to 32px when
     the viewport is narrower than 1200px.
     P66 — header is NOT sticky. The sidebar already stays visible
     while scrolling (it has its own sticky), and a sticky brand bar
     adds visual noise without functional value. The brand + run-id
     scroll away with the page. */
  padding: 18px max(32px, calc((100vw - 1200px) / 2 + 32px));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.viewer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.viewer-brand:hover { text-decoration: none; color: var(--text); }
.viewer-brand img { display: block; }
.viewer-brand-divider { color: var(--text-muted); font-weight: 400; }
.viewer-brand-label { color: var(--text-secondary); font-weight: 500; font-size: 14px; }

.viewer-header-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Main */
.viewer-main {
  flex: 1;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

/* P63 — when the viewer-run shell is visible (i.e. we have an actual
   approved-link landing, not the empty/error states), widen the outer
   page main so the two-column shell has room to breathe. The shell
   needs ~1080px+ to render the sidebar + main without cramping. */
body.viewer-body:has(.viewer-run:not(.hidden)) .viewer-main {
  max-width: 1200px;
}
@supports not selector(:has(*)) {
  /* Fallback for browsers without :has() — slightly wider always. */
  .viewer-main { max-width: 1080px; }
}

@media (max-width: 720px) {
  .viewer-header { padding: 14px 20px; }
  .viewer-main { padding: 32px 20px 60px; }
}

/* States: loading, empty, error */
.viewer-loading,
.viewer-empty,
.viewer-error {
  text-align: left;
  padding: 32px 0;
  color: var(--text-secondary);
}

.viewer-loading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.viewer-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--op-color);
  border-radius: 50%;
  animation: viewer-spin 0.8s linear infinite;
}
@keyframes viewer-spin { to { transform: rotate(360deg); } }

.viewer-empty h1,
.viewer-error h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.viewer-code {
  margin: 16px 0;
  padding: 16px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  overflow-x: auto;
}
.viewer-code code { background: transparent; padding: 0; color: inherit; }

.viewer-muted {
  color: var(--text-muted);
  font-size: 14px;
}

/* Run rendering */
.viewer-run-head {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.viewer-eyebrow {
  display: inline-block;
  color: var(--op-color);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  margin-bottom: 14px;
}

.viewer-run-head h1 {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 16px;
}

.viewer-run-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  color: var(--text-muted);
  font-size: 12px;
}
.viewer-run-meta .mono { color: var(--text-secondary); }
.viewer-run-meta strong { color: var(--text); font-weight: 500; }
.viewer-run-meta .status-awaiting_approval { color: var(--op-color); }
.viewer-run-meta .status-approved { color: #22c55e; }
.viewer-run-meta .status-rejected { color: #ef4444; }
.viewer-dot { padding: 0 8px; color: var(--border-strong); }

/* Sections */
.viewer-section { margin-bottom: 40px; }

.viewer-section-h {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Action card */
.viewer-action-card {
  padding: 22px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 12px;
  /* P65 — grid items have a default min-width: auto that prevents
     them from shrinking below their content width. A long line in
     a <pre> child blew the card past its 1fr column. Force the
     card to honor its grid track. */
  min-width: 0;
  overflow: hidden;
}

.viewer-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.viewer-action-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.viewer-risk {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.viewer-risk-low { background: rgba(34, 197, 94, 0.12); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.35); }
.viewer-risk-medium { background: rgba(245, 166, 35, 0.12); color: #f5a623; border: 1px solid rgba(245, 166, 35, 0.35); }
.viewer-risk-high { background: rgba(239, 68, 68, 0.12); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.35); }

.viewer-action-desc {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.55;
}

.viewer-action-meta {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.viewer-action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* P78 — Operator Intelligence Brief panel. Renders launchPack.brief
   as a structured "What ChiefLab understood" card at the top of the
   Launch Room. Identity row + offer paragraph + channels chosen +
   channels skipped (with strategic reasoning). */
.viewer-operator-brief {
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-1, #0d0d10);
  border-radius: var(--radius-md, 12px);
  padding: 20px 24px;
  margin-bottom: 18px;
}
.viewer-brief-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.viewer-brief-h {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #e4e6eb);
  letter-spacing: -0.01em;
}
.viewer-brief-confidence {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text-muted, #8b8d93);
}
.viewer-brief-confidence-high { color: #34d399; border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.08); }
.viewer-brief-confidence-medium { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); }
.viewer-brief-confidence-low { color: #94a3b8; }
.viewer-brief-identity {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 18px;
  margin-bottom: 14px;
}
.viewer-brief-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.viewer-brief-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #8b8d93);
}
.viewer-brief-value {
  font-size: 14px;
  color: var(--text, #e4e6eb);
}
.viewer-brief-offer {
  grid-column: 1 / -1;
  margin-top: 6px;
}
.viewer-brief-offer p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text, #e4e6eb);
  line-height: 1.5;
}
.viewer-brief-channels, .viewer-brief-skipped {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}
.viewer-brief-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #8b8d93);
  margin-bottom: 6px;
}
.viewer-brief-channels ul, .viewer-brief-skipped ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.viewer-brief-channels li, .viewer-brief-skipped li {
  font-size: 13px;
  line-height: 1.45;
  padding: 4px 0;
  color: var(--text, #e4e6eb);
}
.viewer-brief-channels strong, .viewer-brief-skipped strong {
  text-transform: capitalize;
  color: var(--text, #e4e6eb);
  font-weight: 600;
  margin-right: 4px;
}
.viewer-brief-skipped li {
  color: var(--text-muted, #8b8d93);
}

/* P78 — Jobs-centric "On approval" line. Surfaces P70 executionMatrix
   approvalEffect under each channel card so the reviewer knows exactly
   what happens when they click Approve. Color hints by mode. */
.viewer-action-effect {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text, #e4e6eb);
}
.viewer-action-effect[data-mode="oauth_connector"],
.viewer-action-effect[data-mode="api_key_connector"],
.viewer-action-effect[data-mode="native_api"] {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.06);
}
.viewer-action-effect[data-mode="manual_handoff"] {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.06);
}
.viewer-action-effect[data-mode="blocked"] {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}
.viewer-action-effect-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted, #8b8d93);
}

/* P72 — Visual asset preview inside a channel card. The reviewer
   sees the actual rendered image (Gemini PNG or branded SVG)
   inline, with its own Download + Regenerate controls. */
.viewer-action-media-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 10px;
}
.viewer-action-media {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md, 12px);
  background: var(--bg-elev-1, #0d0d10);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.viewer-action-media img {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}
.viewer-action-media-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 4px;
  font-size: 12px;
  color: var(--text-muted, #8b8d93);
}
.viewer-action-media-mode {
  font-weight: 600;
  color: var(--text, #e4e6eb);
}
.viewer-action-media-status {
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: #fbbf24;
}
/* P104 — explicit per-status colors. Pending = amber (default),
   approved = green, rejected = red. The colored chip lets the
   reviewer scan a row of channel cards and instantly see which
   visuals still need attention. */
.viewer-action-media-status-pending { color: #fbbf24; }
.viewer-action-media-status-approved { color: #34d399; }
.viewer-action-media-status-rejected { color: #f87171; }
.viewer-action-media-buttons {
  display: flex;
  gap: 8px;
  padding: 8px 14px 14px;
}
.viewer-action-media-buttons .viewer-btn {
  padding: 7px 14px;
  font-size: 13px;
}

.viewer-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.viewer-btn:hover:not(:disabled) {
  border-color: var(--op-color);
  color: var(--op-color);
}
.viewer-btn:disabled { opacity: 0.6; cursor: wait; }

.viewer-btn-primary {
  background: var(--op-color);
  border-color: var(--op-color);
  color: var(--bg);
}
.viewer-btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  color: var(--bg);
}

.viewer-action-confirm {
  margin: 12px 0 0;
  color: #22c55e;
  font-size: 12px;
}
.viewer-action-error {
  margin: 12px 0 0;
  color: #ef4444;
  font-size: 12px;
}

/* Section sub copy — between section header and content. Explains
   what the section is for so reviewers know what to do. */
.viewer-section-sub {
  margin: -4px 0 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 70ch;
}
.viewer-section-assets { margin-top: 36px; }
.viewer-section-assets .viewer-section-h {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-weight: 600;
}

/* Asset cards — collapsed by default (rendered as <details>). The
   reviewer's job is to approve actions, not read 12 walls of generated
   working notes. Each asset shows a one-line summary; click to expand. */
.viewer-asset-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.viewer-asset-card[open] {
  background: var(--bg-elev);
}
.viewer-asset-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.viewer-asset-summary::-webkit-details-marker { display: none; }
.viewer-asset-summary:hover {
  background: var(--bg-elev-2);
}
.viewer-asset-summary-text {
  flex: 1;
  min-width: 0;
}
.viewer-asset-summary-text h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.viewer-asset-summary-text .viewer-asset-kind {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.viewer-asset-chevron {
  display: inline-block;
  width: 20px;
  text-align: center;
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 180ms ease;
}
.viewer-asset-card[open] .viewer-asset-chevron {
  transform: rotate(90deg);
}
.viewer-asset-card .viewer-asset-body {
  padding: 0 26px 22px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 0;
}
.viewer-asset-summary .viewer-btn-copy {
  font-size: 11px;
  padding: 5px 10px;
}

.viewer-asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.viewer-asset-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.viewer-asset-type {
  color: var(--text-muted);
  background: var(--bg-elev-2);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.viewer-asset-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.viewer-asset-body h2,
.viewer-asset-body h3,
.viewer-asset-body h4,
.viewer-asset-body h5 {
  color: var(--text);
  margin-top: 22px;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.viewer-asset-body h2 { font-size: 18px; }
.viewer-asset-body h3 { font-size: 15px; }
.viewer-asset-body h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.viewer-asset-body h5 { font-size: 12px; color: var(--text-muted); }
.viewer-asset-body p { margin: 0 0 12px; }
.viewer-asset-body ul,
.viewer-asset-body ol { margin: 0 0 14px; padding-left: 22px; }
.viewer-asset-body li { margin-bottom: 6px; }
.viewer-asset-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-elev-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--op-color);
}
.viewer-asset-body strong { color: var(--text); font-weight: 600; }
.viewer-asset-body em { font-style: italic; color: var(--text-muted); }

.viewer-asset-image {
  margin: 16px 0;
  text-align: center;
}
.viewer-asset-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Footer */
.viewer-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
}
.viewer-footer .mono { font-size: 11px; }
.viewer-footer-meta { margin: 0 0 14px; }
.viewer-footer-cta {
  margin: 0;
  padding: 12px 18px;
  display: inline-block;
  background: rgba(255, 107, 74, 0.06);
  border: 1px solid rgba(255, 107, 74, 0.2);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
}
.viewer-footer-cta strong { color: #ff6b4a; font-weight: 600; }
.viewer-footer-cta a { color: var(--text-secondary); border-bottom: 1px solid transparent; transition: color 0.15s ease, border-color 0.15s ease; }
.viewer-footer-cta a:hover { color: #ff6b4a; border-bottom-color: rgba(255, 107, 74, 0.4); }
.viewer-footer a { color: var(--text-muted); }
.viewer-footer a:hover { color: var(--op-color); }

/* ── Preflight (action pre-flight panel) ───────────────────────────── */
.viewer-preflight {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.viewer-preflight-low { border-left: 3px solid #6b7280; }
.viewer-preflight-medium { border-left: 3px solid #f59e0b; background: rgba(245, 158, 11, 0.05); }
.viewer-preflight-high { border-left: 3px solid #ef4444; background: rgba(239, 68, 68, 0.06); }
.viewer-preflight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.viewer-preflight-badge {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
}
.viewer-preflight-medium .viewer-preflight-badge { color: #f59e0b; }
.viewer-preflight-high .viewer-preflight-badge { color: #ef4444; }
.viewer-preflight-cost {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elev-2);
  padding: 2px 8px;
  border-radius: 4px;
}
.viewer-preflight-warnings,
.viewer-preflight-gates {
  margin: 6px 0 0;
  padding-left: 18px;
  list-style: disc;
}
.viewer-preflight-warnings li {
  margin-bottom: 4px;
  color: var(--text-secondary);
}
.viewer-preflight-gates li {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.viewer-preflight-recs {
  margin-top: 8px;
  font-size: 12px;
}
.viewer-preflight-recs summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.viewer-preflight-recs summary:hover { color: var(--text-secondary); }
.viewer-preflight-recs ul {
  margin-top: 6px;
  padding-left: 18px;
  list-style: disc;
  color: var(--text-secondary);
}
.viewer-preflight-recs li { margin-bottom: 4px; }

/* ── Asset card differentiation by kind ────────────────────────────── */
.viewer-asset-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px;
}
.viewer-asset-head-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.viewer-asset-head-right {
  flex-shrink: 0;
}
.viewer-asset-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-elev-2);
  color: var(--op-color);
  font-size: 14px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-asset-kind {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 2px;
}
.viewer-asset-positioning .viewer-asset-icon { color: #ff6b4a; border-color: rgba(255, 107, 74, 0.3); }
.viewer-asset-launchAngle .viewer-asset-icon { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }
.viewer-asset-brand .viewer-asset-icon { color: #a855f7; border-color: rgba(168, 85, 247, 0.3); }
.viewer-asset-social .viewer-asset-icon { color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); }
.viewer-asset-email .viewer-asset-icon { color: #06b6d4; border-color: rgba(6, 182, 212, 0.3); }
.viewer-asset-landing .viewer-asset-icon { color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }
.viewer-asset-ad .viewer-asset-icon { color: #ec4899; border-color: rgba(236, 72, 153, 0.3); }
.viewer-asset-evidence .viewer-asset-icon { color: #94a3b8; }
.viewer-asset-approvalSummary .viewer-asset-icon { color: #22c55e; }
.viewer-asset-plan .viewer-asset-icon { color: #94a3b8; }

/* ── Copy-to-agent button + ghost button ───────────────────────────── */
.viewer-btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 10px;
  letter-spacing: 0.04em;
  text-transform: none;
}
.viewer-btn-ghost:hover:not(:disabled) {
  border-color: var(--op-color);
  color: var(--op-color);
}
.viewer-btn-copy {
  font-family: var(--font-mono);
}

/* ── Reject form (capture rejection feedback as memory) ────────────── */
.viewer-reject-form {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.viewer-reject-prompt {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.viewer-reject-textarea {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 70px;
}
.viewer-reject-textarea:focus {
  outline: none;
  border-color: var(--op-color);
}
.viewer-reject-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* ── Closed-loop launch timeline ───────────────────────────────────── */
.viewer-launch-timeline {
  margin-bottom: 8px;
}

.viewer-stages {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  .viewer-stages {
    grid-template-columns: repeat(2, 1fr);
  }
}

.viewer-stage {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.viewer-stage-pending {
  opacity: 0.55;
}

.viewer-stage-done {
  border-color: rgba(34, 197, 94, 0.3);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.05) 0%, transparent 100%), var(--bg-elev);
}

.viewer-stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.viewer-stage-done .viewer-stage-num {
  background: #22c55e;
  border-color: #22c55e;
  color: #0a0a0b;
}

.viewer-stage-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.viewer-stage-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.viewer-stage-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

/* Results block */
.viewer-results {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.viewer-results-waiting {
  background: rgba(255, 255, 255, 0.015);
}

.viewer-results-h {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.viewer-results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 540px) {
  .viewer-results-grid { grid-template-columns: repeat(2, 1fr); }
}

.viewer-results-cell {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viewer-results-num {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.viewer-results-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.viewer-results-footnote {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

.viewer-results-brief {
  margin-top: 14px;
  font-size: 13px;
}

.viewer-results-brief summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  user-select: none;
  padding: 4px 0;
}
.viewer-results-brief summary:hover { color: var(--op-color, var(--accent)); }

.viewer-results-brief-body {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.viewer-results-brief-body h2,
.viewer-results-brief-body h3,
.viewer-results-brief-body h4 {
  font-size: 13px;
  margin: 14px 0 6px;
  color: var(--text);
}
.viewer-results-brief-body h2:first-child,
.viewer-results-brief-body h3:first-child,
.viewer-results-brief-body h4:first-child { margin-top: 0; }
.viewer-results-brief-body ul {
  padding-left: 18px;
  margin: 6px 0;
}
.viewer-results-brief-body li { margin-bottom: 4px; }
.viewer-results-brief-body p { margin: 6px 0; }

/* P15 — Approval truth + sticky bottom action bar (mobile-first) */

.viewer-action-card { padding-bottom: 16px; }
.viewer-action-card[data-status="approved"],
.viewer-action-card[data-status="executed"],
.viewer-action-card[data-status="executed_manually"],
.viewer-action-card[data-status="published"] {
  border-left-color: var(--ok, #22c55e);
}
.viewer-action-card[data-status="rejected"],
.viewer-action-card[data-status="failed"] {
  border-left-color: var(--danger, #f43f5e);
  opacity: 0.7;
}

.viewer-action-headline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.viewer-action-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.viewer-action-select input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.viewer-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  font-weight: 500;
  border: 1px solid;
}
.viewer-status-pending {
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.32);
}
.viewer-status-approved {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.32);
}
.viewer-status-executed {
  background: rgba(34, 197, 94, 0.08);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.32);
}
.viewer-status-rejected {
  background: rgba(244, 63, 94, 0.08);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.32);
}
/* P60 — blocked actions (needs product context / clarification / live URL).
   Distinct color so reviewers don't misread "blocked" as "pending." */
.viewer-status-blocked {
  background: rgba(168, 85, 247, 0.08);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.32);
}

/* P60 — blocked-action note rendered in place of the approve buttons. */
.viewer-action-blocked {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(168, 85, 247, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.24);
  border-radius: 8px;
}
.viewer-action-blocked-headline {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a855f7;
  margin: 0 0 6px;
}
.viewer-action-blocked-body {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 10px;
}
.viewer-action-blocked-foot {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}
.viewer-action-blocked-foot code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 4px;
  color: #c084fc;
}
/* P103 — Technical details collapsible under blocked cards. The raw
   failed draft / brief is preserved here for debugging; the main blocked
   note stays quiet and human. */
.viewer-action-blocked-tech {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(168, 85, 247, 0.18);
}
.viewer-action-blocked-tech > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.viewer-action-blocked-tech > summary:hover {
  color: var(--text);
}
.viewer-action-blocked-tech-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 8px;
  line-height: 1.5;
}
.viewer-action-blocked-tech pre {
  font-size: 12px;
  line-height: 1.45;
  padding: 10px 12px;
  background: rgba(168, 85, 247, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.16);
  border-radius: 6px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
}
.viewer-bulk-blocked { color: #a855f7; }
/* P105 — Publishing targets panel. Collapsed by default; expands to
   show per-channel target fields (LinkedIn account, X account, email
   from + list). Quiet color until expanded so it doesn't compete
   with the main review section. */
.viewer-publishing-targets {
  margin: 14px 0 18px;
}
.viewer-pt-details {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
}
.viewer-pt-details > summary {
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  user-select: none;
}
.viewer-pt-details > summary:hover {
  background: var(--bg-elev-3, rgba(255,255,255,0.02));
}
.viewer-pt-title {
  font-weight: 600;
  color: var(--text);
}
.viewer-pt-status {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
}
.viewer-pt-body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border-strong);
}
.viewer-pt-help {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 12px 0;
}
.viewer-pt-loading {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 12px 0;
}
.viewer-pt-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.viewer-pt-field { display: flex; flex-direction: column; gap: 4px; }
.viewer-pt-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.viewer-pt-field input {
  appearance: none;
  background: var(--bg-elev-1, rgba(0,0,0,0.2));
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}
.viewer-pt-field input:focus {
  outline: none;
  border-color: var(--op-color);
}
.viewer-pt-field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 2px 0 0;
}
.viewer-pt-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.viewer-pt-result {
  font-size: 12px;
  color: var(--text-muted);
}
/* P60 — secondary prep-task count (prepare_assets, evidence review, etc.)
   rendered after the primary "drafted N channel posts" line. Quieter
   color so the channel count stays dominant. */
.viewer-wjh-prep {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.92em;
}

/* P60 — Launch plan summary at the top of the Launch Room. Renders
   product / goal / target customer / channels / status counts /
   measurement plan BEFORE the action cards. */
.viewer-launch-plan {
  padding: 20px 22px;
  margin-bottom: 20px;
  background: rgba(255, 107, 74, 0.04);
  border: 1px solid rgba(255, 107, 74, 0.18);
  border-radius: 10px;
}
.viewer-launch-plan-disclaimer {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.viewer-launch-plan-header {
  margin-bottom: 16px;
}
.viewer-launch-plan-headline {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.viewer-plan-product-divider {
  color: var(--text-muted);
  font-weight: 400;
}
.viewer-plan-product-url {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
}
.viewer-plan-product-url:hover {
  color: var(--text);
}
.viewer-launch-plan-goal {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
}
.viewer-launch-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 22px;
  margin: 0;
}
.viewer-launch-plan-field {
  margin: 0;
}
.viewer-launch-plan-field-wide {
  grid-column: 1 / -1;
}
.viewer-launch-plan-field dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.viewer-launch-plan-field dd {
  font-size: 13.5px;
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}
.viewer-plan-pill {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  margin-right: 5px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  font-weight: 500;
}
.viewer-plan-pill-pending  { background: rgba(245, 158, 11, 0.10); color: #f59e0b; border-color: rgba(245, 158, 11, 0.32); }
.viewer-plan-pill-blocked  { background: rgba(168, 85, 247, 0.10); color: #a855f7; border-color: rgba(168, 85, 247, 0.32); }
.viewer-plan-pill-approved { background: rgba(59, 130, 246, 0.10); color: #3b82f6; border-color: rgba(59, 130, 246, 0.32); }
.viewer-plan-pill-published{ background: rgba(34, 197, 94, 0.10);  color: #22c55e; border-color: rgba(34, 197, 94, 0.32); }
.viewer-plan-pill-rejected { background: rgba(244, 63, 94, 0.10);  color: #f43f5e; border-color: rgba(244, 63, 94, 0.32); }

/* P61 — channel purpose line under the action card header.
   One short sentence telling the reviewer what the channel is for. */
.viewer-action-purpose {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: -6px 0 12px;
  line-height: 1.5;
}

/* P61 — high-severity translated risk line. Visible by default,
   above the Technical details disclosure. */
.viewer-preflight-risk {
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(244, 63, 94, 0.06);
  border-left: 3px solid #f43f5e;
  border-radius: 4px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

/* P61 — Technical details disclosure wraps the full preflight block.
   Default state: closed; reviewers in human-mode don't see it.
   Operators / agents inspecting a run open the disclosure. */
.viewer-technical-details {
  margin: 14px 0 0;
  font-size: 12.5px;
}
.viewer-technical-summary {
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 0;
  list-style: none;
}
.viewer-technical-summary::-webkit-details-marker { display: none; }
.viewer-technical-summary::before {
  content: "▸ ";
  font-size: 0.85em;
}
.viewer-technical-details[open] > .viewer-technical-summary::before {
  content: "▾ ";
}
.viewer-technical-summary:hover { color: var(--text); }
.viewer-technical-details > .viewer-preflight {
  margin-top: 8px;
}

/* P61 — collapsed long-draft preview hint shown in the summary line. */
.viewer-preview-hint {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.9em;
}
.viewer-action-preview-short {
  margin-top: 8px;
  /* P65 — same overflow contract as .viewer-action-preview. The
     short preview was a new element in P64 and didn't inherit the
     pre-wrap / word-break rules — long draft lines blew the card
     past its grid column. */
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.viewer-action-preview-short > summary {
  cursor: default;
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0;
  list-style: none;
}
.viewer-action-preview-short > summary::-webkit-details-marker { display: none; }
.viewer-action-preview-short > pre {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* P65 — defensive: any pre inside an action card wraps + clips. */
.viewer-action-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.viewer-action-outcome {
  margin: 6px 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

.viewer-action-preview {
  margin: 12px 0 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.viewer-action-preview > summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
}
.viewer-action-preview pre {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.viewer-bulk-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: none;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
  flex-direction: column;
  gap: 10px;
}
.viewer-bulk-actions.active { display: flex; }
.viewer-bulk-summary {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.viewer-bulk-summary strong {
  color: var(--text);
  font-weight: 600;
}
.viewer-bulk-selected { color: var(--accent); }
.viewer-bulk-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.viewer-bulk-buttons .viewer-btn {
  flex: 1 1 auto;
  min-height: 44px;
  font-size: 14px;
}

@media (min-width: 720px) {
  .viewer-bulk-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
  }
  .viewer-bulk-buttons { flex: 0 0 auto; }
  .viewer-bulk-buttons .viewer-btn { flex: 0 0 auto; min-height: auto; }
}

/* Reserve space at bottom of run viewer so the sticky bar doesn't
   cover the last action card. */
body:has(.viewer-bulk-actions.active) .viewer-main {
  padding-bottom: 200px;
}

/* ── P21.1: What just happened summary ─────────────────────────────── */
.viewer-what-just-happened {
  margin-bottom: 20px;
}
.viewer-wjh-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.viewer-wjh-line {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}
.viewer-wjh-state {
  color: var(--text-muted, #8a8a8a);
}

/* ── P21.1: Manual-fallback inline brief on action cards ──────────── */
.viewer-fallback {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.viewer-fallback-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.viewer-fallback-link {
  font-weight: 400;
  font-size: 12px;
  color: var(--accent, #00bcd4);
  text-decoration: none;
}
.viewer-fallback-link:hover { text-decoration: underline; }
.viewer-fallback-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.viewer-fallback-snippet {
  display: inline-block;
  color: var(--text-muted, #8a8a8a);
}
.viewer-fallback-body summary,
.viewer-fallback-firstcomment summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.viewer-fallback-body pre,
.viewer-fallback-firstcomment pre {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-base, #0a0a0a);
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  max-height: 320px;
  overflow: auto;
}
.viewer-fallback-checklist {
  margin: 4px 0 0 0;
  padding-left: 20px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted, #8a8a8a);
}
.viewer-fallback-checklist li {
  margin-bottom: 4px;
}
.viewer-btn-tertiary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted, #8a8a8a);
}

/* ─── P64 — classified error page CTAs + render-failure fallback ──── */
.viewer-error-ctas {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.viewer-error-cta {
  display: inline-block;
  width: fit-content;
  padding: 10px 18px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}
.viewer-error-cta.viewer-btn-primary {
  background: var(--op-color);
  color: #0a0a0b;
  border-color: var(--op-color);
}
.viewer-error-cta.viewer-btn-primary:hover {
  filter: brightness(1.06);
  text-decoration: none;
}
.viewer-error-cta.viewer-btn-secondary {
  background: transparent;
  color: var(--text);
}
.viewer-error-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}
.viewer-error-hint strong {
  color: var(--text-secondary);
  font-weight: 500;
}
.viewer-error-runid {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

/* P64 — single-action render-failure fallback card. Used when one
   specific action card's render throws but the rest of the launch
   should still appear. */
.viewer-action-card-fallback {
  opacity: 0.85;
  border-style: dashed;
}

/* ─── P63 — Launch Room shell ─────────────────────────────────────
   Structure:
     viewer-run-head        (eyebrow + h1)
     viewer-loop-strip      (timeline at the top)
     viewer-shell           (grid: 280px sidebar + 1fr main)
       viewer-sidebar       (sticky, holds plan card)
       viewer-room-main     (wjh + review section + assets disclosure)
     viewer-footer
   Mobile: shell collapses to a single column; sidebar renders FIRST
   (so the launch identity stays above the cards). Sticky bulk-approve
   bar still works in both layouts.
─────────────────────────────────────────────────────────────────── */

.viewer-loop-strip {
  margin: 20px 0 24px;
}
.viewer-loop-strip:empty {
  display: none;
}
.viewer-loop-strip .viewer-launch-timeline {
  margin-bottom: 0;
}

.viewer-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.viewer-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  /* P63 — Launch identity card sits in the sidebar. The launch plan
     card already has its own background + border via .viewer-launch-plan;
     no extra chrome needed here. */
}
.viewer-sidebar > .viewer-launch-plan {
  margin: 0;
  padding: 22px 22px 18px;
}
.viewer-sidebar > .viewer-launch-plan .viewer-launch-plan-grid {
  grid-template-columns: 1fr;
  gap: 14px 0;
}
.viewer-sidebar > .viewer-launch-plan .viewer-launch-plan-field-wide {
  grid-column: 1;
}
.viewer-sidebar > .viewer-launch-plan .viewer-launch-plan-headline {
  font-size: 18px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.viewer-sidebar > .viewer-launch-plan .viewer-plan-product-divider {
  display: none;
}
.viewer-sidebar > .viewer-launch-plan .viewer-plan-product-url {
  font-size: 12px;
}
.viewer-sidebar > .viewer-launch-plan .viewer-launch-plan-disclaimer {
  font-size: 10.5px;
}

.viewer-room-main {
  min-width: 0;  /* allow grid item to shrink for inner overflow-x scroll */
}
.viewer-room-main > .viewer-wjh-slot:empty {
  display: none;
}
.viewer-room-main > .viewer-wjh-slot > .viewer-what-just-happened {
  margin-top: 0;
  margin-bottom: 20px;
}
.viewer-room-main > .viewer-section {
  margin-bottom: 28px;
}
.viewer-room-main > .viewer-section-review > .viewer-section-header {
  margin-bottom: 14px;
}
.viewer-room-main > .viewer-section-review > .viewer-section-header > .viewer-section-h {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.viewer-room-main > .viewer-section-review > .viewer-section-header > .viewer-section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* P63 — tighter action cards. Less padding, smaller gaps,
   no excessive border noise. */
.viewer-room-main .viewer-action-card {
  margin-bottom: 14px;
}

/* Assets / working notes disclosure. */
.viewer-assets-details {
  margin: 32px 0 0;
}
.viewer-assets-body {
  padding-top: 12px;
}

/* P63 — wider tablet breakpoint: collapse to single column. Sidebar
   renders FIRST so the launch identity is still on top of the cards
   on phones / narrow tablets. */
@media (max-width: 960px) {
  .viewer-shell {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .viewer-sidebar {
    position: static;
    order: 0;
  }
  .viewer-room-main {
    order: 1;
  }
  .viewer-sidebar > .viewer-launch-plan .viewer-launch-plan-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .viewer-sidebar > .viewer-launch-plan .viewer-launch-plan-headline {
    font-size: 20px;
    flex-direction: row;
    flex-wrap: wrap;
  }
}
