/* Refract UI v4 — CLI Lab: 4-step command pipeline + simulated output workbench
   Type floor: no text below 13px (0.8125rem). Contrast: every text colour >= 4.5:1. */

:root {
  --rcw-paper: #fcfaf5;
  --rcw-card: rgba(255, 255, 255, 0.88);
  --rcw-card-strong: rgba(255, 255, 255, 0.96);
  --rcw-ink: #162032;
  --rcw-ink-soft: #435066;
  --rcw-muted: #52627A;
  --rcw-border: rgba(22, 32, 50, 0.12);
  --rcw-border-strong: rgba(22, 32, 50, 0.22);

  --rcw-sky: #0369A1;
  --rcw-sky-soft: rgba(56, 189, 248, 0.16);
  --rcw-teal: #0F766E;
  --rcw-teal-soft: rgba(45, 212, 191, 0.18);
  --rcw-amber: #A3590D;
  --rcw-amber-soft: rgba(251, 191, 36, 0.2);
  --rcw-rose: #e11d48;
  --rcw-rose-soft: rgba(251, 113, 133, 0.18);
  --rcw-violet: #7c3aed;
  --rcw-violet-soft: rgba(167, 139, 250, 0.18);

  --rcw-fs-xs: 0.8125rem;  /* 13px — the floor */
  --rcw-fs-sm: 0.875rem;   /* 14px */
  --rcw-fs-md: 0.9375rem;  /* 15px */

  --rcw-sans: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --rcw-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  --rcw-shadow: 0 14px 36px -18px rgba(22, 32, 50, 0.18), 0 2px 8px rgba(22, 32, 50, 0.05);
}

.rcw-workbench *,
.rcw-workbench *::before,
.rcw-workbench *::after {
  box-sizing: border-box;
}

/* Visually hidden but announced (robust clip pattern) */
.rcw-vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Author display rules must never beat the hidden attribute */
.rcw-workbench [hidden] {
  display: none !important;
}

/* Workbench Shell */
.rcw-workbench {
  position: relative;
  overflow: visible;
  background: radial-gradient(ellipse 200px 130px at 42% 100%, rgba(251, 191, 36, .12), transparent),
    linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(250, 246, 238, 0.9));
  border: 1.5px solid var(--rcw-border);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--rcw-shadow);
  backdrop-filter: blur(10px);
  font-family: var(--rcw-sans);
  color: var(--rcw-ink);
}

.rcw-wash {
  position: absolute;
  border-radius: 999px;
  filter: blur(42px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.rcw-wash-sky {
  width: 340px;
  height: 220px;
  top: -70px;
  left: -60px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45), transparent 72%);
}

.rcw-wash-mint {
  width: 360px;
  height: 240px;
  top: -50px;
  right: -70px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.42), transparent 72%);
}

.rcw-workbench > *:not(.rcw-wash) {
  position: relative;
  z-index: 1;
}

.rcw-workbench > .rcw-vh {
  position: absolute !important;
}

/* Header */
.rcw-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.rcw-heading {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--rcw-ink);
}

.rcw-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rcw-meta-pill {
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--rcw-border);
  background: var(--rcw-card-strong);
  white-space: nowrap;
}

.rcw-meta-pill.is-teal {
  color: #0f766e;
  background: rgba(204, 251, 241, 0.7);
  border-color: rgba(13, 148, 136, 0.25);
}

.rcw-meta-pill.is-sky {
  color: #0369a1;
  background: rgba(224, 242, 254, 0.75);
  border-color: rgba(2, 132, 199, 0.24);
}

/* ---------- Command filter (type to narrow the 18 commands) ---------- */
.rcw-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 14px;
}

.rcw-filter-label {
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  color: var(--rcw-ink);
  white-space: nowrap;
}

.rcw-filter-input {
  appearance: none;
  flex: 1 1 260px;
  min-width: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--rcw-border-strong);
  background: #ffffff;
  color: var(--rcw-ink);
  font: inherit;
  font-size: var(--rcw-fs-sm);
  font-weight: 600;
}

.rcw-filter-input::placeholder {
  color: var(--rcw-muted);
  font-weight: 500;
}

.rcw-filter-input:focus-visible {
  outline: 2.5px solid var(--rcw-sky);
  outline-offset: 2px;
}

/* Keep one cross-filler look: the native cancel button duplicates "Clear" */
.rcw-filter-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.rcw-filter-clear {
  appearance: none;
  border: 1px solid var(--rcw-border-strong);
  background: #ffffff;
  color: var(--rcw-ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.14s ease, color 0.14s ease;
}

.rcw-filter-clear:hover {
  border-color: var(--rcw-sky);
  color: var(--rcw-sky);
}

.rcw-filter-clear:focus-visible {
  outline: 2.5px solid var(--rcw-sky);
  outline-offset: 2px;
}

.rcw-filter-count {
  min-height: 1.3em;
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-muted);
}

/* ---------- 4-step command pipeline (replaces the old flat 11-tab grid) ----------
   >= 1101px : 4 columns, one line per command (name left, purpose right)
   581-1100  : 2 x 2 steps
   <= 580    : one row per step, compact command chips (purpose shown in the stage) */
.rcw-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.rcw-step {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--rcw-border);
}

/* Flow chevron in the gap between steps */
.rcw-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 21px;
  right: -14px;
  width: 9px;
  height: 9px;
  border-top: 2px solid rgba(3, 105, 161, 0.5);
  border-right: 2px solid rgba(3, 105, 161, 0.5);
  transform: rotate(45deg);
  pointer-events: none;
}

.rcw-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 0 2px;
}

.rcw-step-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0369A1, #0F766E);
  color: #ffffff;
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  line-height: 1;
}

.rcw-step-title {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--rcw-ink);
  white-space: nowrap;
}

.rcw-step-hint {
  margin-left: auto;
  font-size: var(--rcw-fs-xs);
  font-weight: 600;
  color: var(--rcw-muted);
  white-space: nowrap;
}

.rcw-step-cmds {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rcw-cmd-btn {
  appearance: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--rcw-border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--rcw-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.rcw-cmd-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(3, 105, 161, 0.45);
  background: #ffffff;
}

.rcw-cmd-btn:focus-visible {
  outline: 2.5px solid var(--rcw-sky);
  outline-offset: 2px;
}

.rcw-cmd-btn.is-active,
.rcw-cmd-btn[aria-selected="true"] {
  border-color: var(--rcw-sky);
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.95), rgba(204, 251, 241, 0.8));
  box-shadow: 0 8px 18px -12px rgba(2, 132, 199, 0.6), inset 3px 0 0 var(--rcw-sky);
}

.rcw-cmd-btn .rcw-cmd-name {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-md);
  font-weight: 800;
  color: var(--rcw-ink);
  background: none;
  border: 0;
  padding: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}

.rcw-cmd-btn.is-active .rcw-cmd-name,
.rcw-cmd-btn[aria-selected="true"] .rcw-cmd-name {
  color: #075985;
}

.rcw-cmd-sub {
  font-size: var(--rcw-fs-xs);
  font-weight: 600;
  color: var(--rcw-ink-soft);
}

/* Command Bar Card */
.rcw-cmd-card {
  background: var(--rcw-card-strong);
  border: 1.5px solid var(--rcw-border);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.rcw-cmd-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.rcw-cmd-purpose {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  flex: 1 1 420px;
}

.rcw-step-badge {
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.2), rgba(45, 212, 191, 0.22));
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.24);
  white-space: nowrap;
}

.rcw-cmd-desc {
  margin: 0;
  font-size: var(--rcw-fs-md);
  font-weight: 600;
  line-height: 1.5;
  color: var(--rcw-ink-soft);
}

.rcw-cmd-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rcw-scenario-switch {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  background: #f3efe6;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--rcw-border);
  gap: 3px;
}

.rcw-preset-chip {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.rcw-preset-chip:hover {
  color: var(--rcw-ink);
}

.rcw-preset-chip:focus-visible {
  outline: 2.5px solid var(--rcw-sky);
  outline-offset: 1px;
}

.rcw-preset-chip.is-active {
  background: #ffffff;
  color: var(--rcw-sky);
  box-shadow: 0 2px 6px rgba(22, 32, 50, 0.09);
}

.rcw-action-btn,
.rcw-copy-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: var(--rcw-fs-sm);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.rcw-action-btn {
  background: #ffffff;
  color: var(--rcw-ink);
  border: 1px solid var(--rcw-border-strong);
}

.rcw-action-btn:hover {
  border-color: var(--rcw-sky);
  color: var(--rcw-sky);
}

.rcw-copy-btn {
  border: 1px solid rgba(2, 132, 199, 0.35);
  background: linear-gradient(135deg, #0369A1, #0F766E);
  color: #ffffff;
  box-shadow: 0 6px 14px -8px rgba(2, 132, 199, 0.65);
}

.rcw-copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px -8px rgba(2, 132, 199, 0.7);
}

.rcw-copy-btn.is-copied {
  background: linear-gradient(135deg, #0F766E, #047857);
}

.rcw-action-btn:focus-visible,
.rcw-copy-btn:focus-visible,
.rcw-mini-copy:focus-visible {
  outline: 2.5px solid var(--rcw-sky);
  outline-offset: 2px;
}

/* Command Code Line (a <code>, so ui-shell does not inject a second Copy button) */
.rcw-cmd-line-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(135deg, #f7f4ec, #eef6fb);
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-x: auto;
}

.rcw-prompt-sigil {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-md);
  font-weight: 800;
  line-height: 1.6;
  color: var(--rcw-teal);
  user-select: none;
}

.rcw-cmd-line-wrap .rcw-cmd-code {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-md);
  font-weight: 500;
  line-height: 1.6;
  color: var(--rcw-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-variant-ligatures: none;
}

.rcw-tok-bin {
  color: #0369a1;
  font-weight: 800;
}

.rcw-tok-sub {
  color: #0f766e;
  font-weight: 800;
}

.rcw-tok-flag {
  color: #6d28d9;
  font-weight: 700;
}

.rcw-tok-val {
  color: #9a4a0b;
  font-weight: 600;
}

.rcw-tok-op {
  color: var(--rcw-muted);
}

/* Flags + Hover [?] Hint Tooltips */
.rcw-flags-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed rgba(22, 32, 50, 0.12);
}

.rcw-flags-label {
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-muted);
}

.rcw-flags-label kbd {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-xs);
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid var(--rcw-border-strong);
  background: #ffffff;
  color: var(--rcw-ink);
}

.rcw-flags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rcw-hint-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  background: #faf7f0;
  border: 1px solid var(--rcw-border);
  border-radius: 999px;
  padding: 3px 5px 3px 6px;
  font-size: var(--rcw-fs-xs);
}

.rcw-hint-pill code {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-ink);
  background: none;
  border: 0;
  padding: 0 0 0 4px;
  overflow-wrap: anywhere;
}

.rcw-hint-trigger {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(2, 132, 199, 0.35);
  background: rgba(224, 242, 254, 0.9);
  color: #0369a1;
  font-family: var(--rcw-sans);
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.rcw-hint-trigger:hover {
  background: #ffffff;
  border-color: var(--rcw-sky);
}

.rcw-hint-trigger:focus-visible {
  outline: 2px solid var(--rcw-sky);
  outline-offset: 2px;
}

.rcw-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(4px);
  width: min(320px, 80vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--rcw-ink);
  border: 1.5px solid rgba(2, 132, 199, 0.32);
  box-shadow: 0 14px 28px -10px rgba(22, 32, 50, 0.25);
  font-family: var(--rcw-sans);
  font-size: var(--rcw-fs-xs);
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

/* The first pill in a row opens rightwards, and the last opens leftwards, so tooltips stay inside the workbench */
.rcw-flags-list > .rcw-hint-pill:first-child .rcw-tooltip {
  left: 0;
  transform: translateY(4px);
}

.rcw-flags-list > .rcw-hint-pill:last-child:not(:first-child) .rcw-tooltip {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.rcw-tooltip strong {
  display: block;
  margin-bottom: 3px;
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-xs);
  color: var(--rcw-sky);
}

/* Scannable provider bullets inside a flag tooltip (--target): one mono chip
   per provider so the hint reads in 2 seconds instead of one 100-word run-on. */
.rcw-tooltip.has-bullets {
  width: min(400px, 88vw);
}

.rcw-tooltip-list {
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
  max-height: min(240px, 38vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rcw-tooltip-list:focus-visible,
.rcw-terminal-body:focus-visible {
  outline: 2px solid var(--rcw-sky);
  outline-offset: -2px;
}

.rcw-tooltip-list li {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  line-height: 1.45;
}

.rcw-tooltip-list li code {
  flex: none;
  margin: 0;
  padding: 1px 6px;
  border-radius: 7px;
  border: 1px solid rgba(2, 132, 199, 0.24);
  background: var(--rcw-sky-soft);
  color: var(--rcw-sky);
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.rcw-tooltip-list li span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* A click-pinned tooltip is interactive so a long provider list can scroll. */
.rcw-hint-pill.is-open:not(.is-dismissed) .rcw-tooltip {
  pointer-events: auto;
}

.rcw-hint-pill:not(.is-dismissed):hover .rcw-tooltip,
.rcw-hint-pill:not(.is-dismissed):focus-within .rcw-tooltip,
.rcw-hint-pill.is-open:not(.is-dismissed) .rcw-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.rcw-flags-list > .rcw-hint-pill:first-child:not(.is-dismissed):hover .rcw-tooltip,
.rcw-flags-list > .rcw-hint-pill:first-child:not(.is-dismissed):focus-within .rcw-tooltip,
.rcw-flags-list > .rcw-hint-pill.is-open:first-child:not(.is-dismissed) .rcw-tooltip,
.rcw-flags-list > .rcw-hint-pill:last-child:not(:first-child):not(.is-dismissed):hover .rcw-tooltip,
.rcw-flags-list > .rcw-hint-pill:last-child:not(:first-child):not(.is-dismissed):focus-within .rcw-tooltip,
.rcw-flags-list > .rcw-hint-pill.is-open:last-child:not(:first-child):not(.is-dismissed) .rcw-tooltip {
  transform: translateY(0);
}

.rcw-hint-pill.is-dismissed .rcw-tooltip {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Split Simulated Output Grid */
.rcw-output-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 16px;
}

.rcw-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--rcw-card-strong);
  border: 1.5px solid var(--rcw-border);
  border-radius: 18px;
  overflow: hidden;
  min-height: 360px;
}

.rcw-pane-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 10px;
  padding: 11px 15px;
  background: linear-gradient(90deg, rgba(247, 243, 234, 0.95), rgba(235, 246, 252, 0.92));
  border-bottom: 1px solid var(--rcw-border);
}

.rcw-pane-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 220px;
}

.rcw-window-dots {
  display: inline-flex;
  flex: none;
  gap: 5px;
}

.rcw-window-dots i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: block;
}

.rcw-window-dots i.is-rose { background: #fb7185; }
.rcw-window-dots i.is-amber { background: #fbbf24; }
.rcw-window-dots i.is-teal { background: #2dd4bf; }

.rcw-pane-title {
  min-width: 0;
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--rcw-ink);
}

.rcw-pane-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rcw-exit-pill {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.rcw-exit-pill.is-ok {
  background: var(--rcw-teal-soft);
  color: #0f766e;
  border: 1px solid rgba(13, 148, 136, 0.3);
}

.rcw-exit-pill.is-fail {
  background: var(--rcw-rose-soft);
  color: #be123c;
  border: 1px solid rgba(225, 29, 72, 0.34);
}

.rcw-mini-copy {
  appearance: none;
  border: 1px solid var(--rcw-border-strong);
  background: #ffffff;
  color: var(--rcw-ink-soft);
  border-radius: 999px;
  padding: 4px 11px;
  font: inherit;
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.rcw-mini-copy:hover {
  border-color: var(--rcw-sky);
  color: var(--rcw-sky);
}

.rcw-visual-kicker {
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-sky);
  background: var(--rcw-sky-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Bright Paper Terminal Body */
.rcw-terminal-body {
  flex: 1;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fffefb 0%, #f9f6ef 100%);
  font-family: var(--rcw-mono);
  font-size: 0.90625rem;
  line-height: 1.6;
  color: #1e293b;
  overflow-x: auto;
  font-variant-ligatures: none;
}

.rcw-term-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 1px 0;
  animation: rcwFadeSlide 0.22s ease both;
}

.rcw-terminal-body > .rcw-term-line:nth-child(2) { animation-delay: 32ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(3) { animation-delay: 64ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(4) { animation-delay: 96ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(5) { animation-delay: 128ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(6) { animation-delay: 160ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(7) { animation-delay: 192ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(8) { animation-delay: 224ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(9) { animation-delay: 256ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(10) { animation-delay: 288ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(11) { animation-delay: 320ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(12) { animation-delay: 352ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(13) { animation-delay: 384ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(14) { animation-delay: 416ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(15) { animation-delay: 448ms; }
.rcw-terminal-body > .rcw-term-line:nth-child(n+16) { animation-delay: 480ms; }

.rcw-clipboard-sink {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

/* Tables and tab-separated listings keep their columns and scroll sideways */
.rcw-term-line.is-pre {
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 4;
}

.rcw-nw {
  white-space: nowrap;
}

/* Muted terminal lines: #4A5870 holds >= 4.5:1 AA across the paper gradient (#fffefb -> #f9f6ef) */
.rcw-term-line.is-dim { color: #4A5870; }
.rcw-term-line.is-head { color: #0369a1; font-weight: 800; }
.rcw-term-line.is-ok { color: #0f766e; font-weight: 700; }
.rcw-term-line.is-warn { color: #9a4a0b; font-weight: 700; }
.rcw-term-line.is-bad { color: #be123c; font-weight: 800; }
.rcw-term-line.is-accent { color: #6d28d9; font-weight: 700; }
.rcw-term-line.is-prompt {
  margin-top: 6px;
  color: #0f766e;
  font-weight: 800;
}

@keyframes rcwFadeSlide {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Right Visual Breakdown Body */
.rcw-visual-body {
  flex: 1;
  min-width: 0;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Visual Subcomponents */
.rcw-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rcw-mini-stat {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--rcw-border);
  background: #fcfaf4;
}

.rcw-mini-stat.is-teal { background: rgba(204, 251, 241, 0.45); border-color: rgba(13, 148, 136, 0.25); }
.rcw-mini-stat.is-amber { background: rgba(254, 243, 199, 0.6); border-color: rgba(217, 119, 6, 0.25); }
.rcw-mini-stat.is-rose { background: rgba(255, 228, 230, 0.65); border-color: rgba(225, 29, 72, 0.25); }
.rcw-mini-stat.is-sky { background: rgba(224, 242, 254, 0.6); border-color: rgba(2, 132, 199, 0.25); }

.rcw-mini-k {
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--rcw-muted);
}

.rcw-mini-v {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--rcw-ink);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.rcw-mini-ci {
  font-size: 0.90625rem;
  line-height: 1.4;
  color: var(--rcw-ink-soft);
}

/* Trace cards for scan & diff */
.rcw-case-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rcw-case-card {
  border-radius: 12px;
  border: 1px solid var(--rcw-border);
  padding: 10px 12px;
  background: #ffffff;
}

.rcw-case-card.is-bad {
  border-color: rgba(225, 29, 72, 0.34);
  background: rgba(255, 241, 242, 0.7);
}

.rcw-case-card.is-warn {
  border-color: rgba(217, 119, 6, 0.34);
  background: rgba(255, 251, 235, 0.78);
}

.rcw-case-card.is-ok {
  border-color: rgba(13, 148, 136, 0.3);
  background: rgba(240, 253, 250, 0.7);
}

.rcw-case-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 4px;
}

.rcw-case-id {
  font-family: var(--rcw-mono);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--rcw-ink);
  overflow-wrap: anywhere;
}

.rcw-pill {
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.rcw-pill.is-bad { background: var(--rcw-rose-soft); color: #be123c; }
.rcw-pill.is-warn { background: var(--rcw-amber-soft); color: #92400e; }
.rcw-pill.is-ok { background: var(--rcw-teal-soft); color: #0f766e; }
.rcw-pill.is-sky { background: var(--rcw-sky-soft); color: #0369a1; }

.rcw-case-axes {
  font-size: 0.90625rem;
  line-height: 1.5;
  color: var(--rcw-ink-soft);
}

/* 2x2 Guardrail Scorecard Grid (report) */
.rcw-matrix-2x2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.rcw-quad {
  min-width: 0;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--rcw-border);
}

.rcw-quad.q-safe,
.rcw-attr-cell.q-safe { background: rgba(240, 253, 250, 0.82); border-color: rgba(13, 148, 136, 0.3); }
.rcw-quad.q-alarm,
.rcw-attr-cell.q-alarm { background: rgba(255, 251, 235, 0.85); border-color: rgba(217, 119, 6, 0.32); }
.rcw-quad.q-caught,
.rcw-attr-cell.q-caught { background: rgba(240, 249, 255, 0.85); border-color: rgba(2, 132, 199, 0.3); }
.rcw-quad.q-leak,
.rcw-attr-cell.q-leak { background: rgba(255, 241, 242, 0.88); border-color: rgba(225, 29, 72, 0.36); }

.rcw-quad-k {
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--rcw-ink-soft);
}

.rcw-quad-val {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--rcw-ink);
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}

.rcw-quad-sub {
  font-size: var(--rcw-fs-xs);
  line-height: 1.4;
  color: var(--rcw-ink-soft);
}

/* Detect-vs-Complete attribution table (matrix): model weights x outer guardrail */
.rcw-attr {
  display: grid;
  gap: 8px;
}

.rcw-attr-row {
  display: grid;
  grid-template-columns: minmax(84px, 0.62fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.rcw-attr-corner {
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  line-height: 1.3;
  color: var(--rcw-muted);
  white-space: nowrap;
}

.rcw-attr-colhead {
  align-self: end;
  text-align: center;
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--rcw-ink-soft);
}

.rcw-attr-rowhead {
  display: flex;
  align-items: center;
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  line-height: 1.3;
  color: var(--rcw-ink);
}

.rcw-attr-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--rcw-border);
}

.rcw-attr-code {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(22, 32, 50, 0.14);
  color: var(--rcw-ink);
}

.rcw-attr-val {
  margin-top: 4px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--rcw-ink);
  font-variant-numeric: tabular-nums;
}

.rcw-attr-k {
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  color: var(--rcw-ink);
}

.rcw-attr-sub {
  font-size: var(--rcw-fs-xs);
  line-height: 1.35;
  color: var(--rcw-ink-soft);
}

.rcw-phi-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(237, 233, 254, 0.55);
  border: 1px solid rgba(124, 58, 237, 0.22);
  font-size: var(--rcw-fs-sm);
  font-weight: 700;
  color: var(--rcw-ink-soft);
}

.rcw-phi-line strong {
  font-family: var(--rcw-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: #5b21b6;
}

.rcw-visual-note {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border-left: 3px solid #d97706;
  background: rgba(254, 243, 199, 0.45);
  font-size: var(--rcw-fs-sm);
  line-height: 1.5;
  color: var(--rcw-ink-soft);
}

/* Certainty Range Bar */
.rcw-ci-box {
  border-radius: 12px;
  border: 1px solid var(--rcw-border);
  background: #faf8f2;
  padding: 10px 12px;
}

.rcw-ci-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rcw-ci-row + .rcw-ci-row {
  margin-top: 9px;
}

.rcw-ci-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 10px;
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-ink);
}

.rcw-ci-meta span:last-child {
  font-family: var(--rcw-mono);
  font-variant-numeric: tabular-nums;
}

.rcw-ci-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}

.rcw-ci-svg {
  display: block;
  width: 100%;
  height: 10px;
}

.rcw-ci-track-bg {
  fill: rgba(22, 32, 50, 0.08);
}

.rcw-ci-band-rect {
  fill: #0e8fa3;
  fill-opacity: 0.55;
}

.rcw-ci-point-rect {
  fill: var(--rcw-ink);
}

/* CI Gate Card */
.rcw-gate-banner {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1.5px solid;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.rcw-gate-banner.is-fail {
  background: rgba(255, 228, 230, 0.75);
  border-color: rgba(225, 29, 72, 0.42);
  color: #9f1239;
}

.rcw-gate-banner.is-pass {
  background: rgba(204, 251, 241, 0.7);
  border-color: rgba(13, 148, 136, 0.38);
  color: #115e59;
}

.rcw-gate-title {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.3;
}

.rcw-gate-sub {
  font-size: 0.90625rem;
  line-height: 1.5;
}

.rcw-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(22, 32, 50, 0.2);
  background: #ffffff;
}

.rcw-badge-svg {
  display: block;
  flex: none;
}

.rcw-badge-meta {
  font-size: var(--rcw-fs-xs);
  line-height: 1.45;
  color: var(--rcw-ink-soft);
}

/* GitHub PR SARIF Annotation Mockup */
.rcw-pr-card {
  border: 1.5px solid rgba(22, 32, 50, 0.16);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.rcw-pr-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
  padding: 9px 12px;
  background: #f4f7fb;
  border-bottom: 1px solid var(--rcw-border);
  font-size: var(--rcw-fs-xs);
  font-weight: 700;
  color: var(--rcw-ink);
}

.rcw-alert-list {
  list-style: none;
  margin: 0;
  padding: 2px 12px;
}

.rcw-alert-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(22, 32, 50, 0.12);
}

.rcw-alert-row:last-child {
  border-bottom: 0;
}

.rcw-alert-row .rcw-pill {
  min-width: 4.6rem;
  text-align: center;
}

.rcw-alert-name {
  font-size: var(--rcw-fs-sm);
  font-weight: 700;
  color: var(--rcw-ink);
}

.rcw-alert-probe {
  flex-basis: 100%;
  font-family: var(--rcw-mono);
  font-size: 0.90625rem;
  line-height: 1.4;
  color: var(--rcw-ink-soft);
  overflow-wrap: anywhere;
}

.rcw-pr-annotation {
  margin: 8px 12px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 4px solid var(--rcw-rose);
  background: #fff7f8;
  border-top: 1px solid rgba(225, 29, 72, 0.22);
  border-right: 1px solid rgba(225, 29, 72, 0.22);
  border-bottom: 1px solid rgba(225, 29, 72, 0.22);
}

.rcw-pr-ann-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: var(--rcw-fs-xs);
  font-weight: 800;
  color: #be123c;
}

.rcw-pr-ann-msg {
  font-size: 0.90625rem;
  line-height: 1.5;
  color: var(--rcw-ink);
  margin: 0;
  overflow-wrap: anywhere;
}

/* SPRT log-likelihood-ratio chart (inline SVG, styled here so it stays CSP-safe) */
.rcw-sprt-card {
  margin: 0;
  padding: 12px 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--rcw-border);
  background: #ffffff;
  min-width: 0;
}

.rcw-sprt-cap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.rcw-sprt-title {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--rcw-ink);
}

.rcw-sprt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.rcw-sprt-legend-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--rcw-fs-xs);
  color: var(--rcw-ink-soft);
}

.rcw-sprt-key {
  flex: none;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.rcw-sprt-key.is-fail { background: #e11d48; }
.rcw-sprt-key.is-pass { background: #0d9488; }

.rcw-sprt-legend-note {
  color: var(--rcw-muted);
}

.rcw-sprt-chart {
  width: 100%;
  min-height: 210px;
}

.rcw-sprt-svg {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
  border-radius: 8px;
}

.rcw-sprt-svg:focus-visible {
  outline: 2.5px solid var(--rcw-sky);
  outline-offset: 3px;
}

.rcw-sprt-zone.is-fail { fill: rgba(225, 29, 72, 0.07); }
.rcw-sprt-zone.is-pass { fill: rgba(13, 148, 136, 0.08); }

.rcw-sprt-axis {
  stroke: rgba(22, 32, 50, 0.28);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.rcw-sprt-bound {
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.rcw-sprt-bound.is-fail { stroke: #be123c; }
.rcw-sprt-bound.is-pass { stroke: #0f766e; }

.rcw-sprt-baseline,
.rcw-sprt-xtick {
  stroke: rgba(22, 32, 50, 0.35);
  stroke-width: 1;
}

.rcw-sprt-tick {
  font-family: var(--rcw-mono);
  font-size: var(--rcw-fs-sm);
  font-weight: 600;
  fill: #435066;
}

.rcw-sprt-axis-title {
  font-family: var(--rcw-sans);
  font-size: var(--rcw-fs-sm);
  font-weight: 600;
  fill: #52627A;
}

.rcw-sprt-zone-label {
  font-family: var(--rcw-sans);
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.rcw-sprt-zone-label.is-fail { fill: #be123c; }
.rcw-sprt-zone-label.is-pass { fill: #0f766e; }

.rcw-sprt-path {
  fill: none;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: rcwDraw 0.9s ease-out 0.1s forwards;
}

.rcw-sprt-path.is-fail { stroke: #e11d48; }
.rcw-sprt-path.is-pass { stroke: #0d9488; }

.rcw-sprt-dot {
  stroke: #ffffff;
  stroke-width: 2;
  animation: rcwFadeIn 0.3s ease 0.85s both;
}

.rcw-sprt-dot.is-fail { fill: #e11d48; }
.rcw-sprt-dot.is-pass { fill: #0d9488; }

.rcw-sprt-end-label {
  font-family: var(--rcw-sans);
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  stroke-linejoin: round;
  animation: rcwFadeIn 0.3s ease 0.85s both;
}

.rcw-sprt-end-label.is-fail { fill: #be123c; }
.rcw-sprt-end-label.is-pass { fill: #0f766e; }

.rcw-sprt-cross {
  stroke: #162032;
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.rcw-sprt-cross.is-on {
  opacity: 0.65;
}

.rcw-sprt-hit {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}

.rcw-sprt-readout {
  margin: 6px 0 0;
  min-height: 2.9em;
  font-size: 0.90625rem;
  line-height: 1.45;
  color: var(--rcw-ink-soft);
  font-variant-numeric: tabular-nums;
}

@keyframes rcwDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes rcwFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Global Flag Glossary Strip */
.rcw-glossary-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rcw-border);
}

.rcw-glossary-heading {
  font-size: var(--rcw-fs-sm);
  font-weight: 800;
  color: var(--rcw-ink-soft);
}

.rcw-more-cmds {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: 0.90625rem;
  line-height: 1.6;
  color: var(--rcw-muted);
}

/* Trailing next-step links: one spaced button row with a clear primary. */
.rcw-next-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 2rem;
}

.rcw-next-row .rcw-next-primary {
  gap: 0.4em; /* inline-flex drops the space before the arrow span */
  color: #0F766E;
  border-color: var(--seafoam);
  background: linear-gradient(135deg, var(--seafoam-wash), rgba(255, 255, 255, 0.92));
}

/* Responsive */
@media (max-width: 1100px) {
  .rcw-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .rcw-step::after {
    display: none;
  }
}

@media (max-width: 980px) {
  /* keep decorative washes inside the card so nothing bleeds past the viewport */
  .rcw-workbench {
    overflow: hidden;
    overflow: clip;
  }
  .rcw-output-grid {
    grid-template-columns: 1fr;
  }
  /* tooltips anchor to their bar (full width, left aligned) instead of the pill */
  .rcw-flags-bar,
  .rcw-glossary-strip {
    position: relative;
  }
  .rcw-hint-pill {
    position: static;
  }
  .rcw-tooltip,
  .rcw-flags-list > .rcw-hint-pill:first-child .rcw-tooltip {
    left: 0;
    right: auto;
    width: min(360px, 100%);
    transform: translateY(4px);
  }
  .rcw-hint-pill:not(.is-dismissed):hover .rcw-tooltip,
  .rcw-hint-pill:not(.is-dismissed):focus-within .rcw-tooltip,
  .rcw-hint-pill.is-open:not(.is-dismissed) .rcw-tooltip,
  .rcw-flags-list > .rcw-hint-pill:first-child:not(.is-dismissed):hover .rcw-tooltip,
  .rcw-flags-list > .rcw-hint-pill:first-child:not(.is-dismissed):focus-within .rcw-tooltip,
  .rcw-flags-list > .rcw-hint-pill.is-open:first-child:not(.is-dismissed) .rcw-tooltip {
    transform: translateY(0);
  }
}

@media (max-width: 580px) {
  .rcw-filter-input {
    flex-basis: 100%;
  }
  .rcw-scenario-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    border-radius: 16px;
  }
  .rcw-preset-chip {
    white-space: normal;
    text-align: center;
    padding: 7px 10px;
  }
  .rcw-workbench {
    padding: 18px 14px;
    border-radius: 20px;
  }
  .rcw-header {
    margin-bottom: 12px;
  }
  /* one compact row per step: header, then command chips */
  .rcw-steps {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .rcw-step {
    gap: 6px;
    padding: 9px 10px 10px;
    border-radius: 14px;
  }
  .rcw-step-head {
    min-height: 22px;
  }
  .rcw-step-num {
    width: 22px;
    height: 22px;
  }
  .rcw-step-title {
    font-size: 1.125rem;
    white-space: normal;
  }
  .rcw-step-cmds {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .rcw-cmd-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 72px;
    min-height: 40px;
    justify-content: center;
    padding: 8px 10px;
  }
  .rcw-cmd-sub {
    display: none;
  }
  .rcw-cmd-card {
    padding: 14px;
  }
  .rcw-cmd-purpose {
    flex-basis: 100%;
  }
  .rcw-stat-row,
  .rcw-matrix-2x2 {
    grid-template-columns: 1fr;
  }
  .rcw-attr-row {
    grid-template-columns: minmax(64px, 0.5fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }
  .rcw-attr-cell {
    padding: 8px 9px;
  }
  .rcw-gate-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .rcw-pane {
    min-height: 0;
  }
  /* phones: two equal full-width tap targets with a real gap between them */
  .rcw-next-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 1.25rem;
  }
  .rcw-next-row .preset-btn {
    text-align: center;
  }
}

/* Small phones (<=360px): four nested cards used to spend 122px of a 320px
   screen on gutters. Trimming the inner ones hands that width back to the
   terminal, the cards and the SPRT chart (198px -> 222px at 320px). */
@media (max-width: 360px) {
  .rcw-workbench {
    padding: 16px 10px;
  }
  .rcw-terminal-body,
  .rcw-visual-body {
    padding: 12px;
  }
  .rcw-sprt-card {
    padding: 10px 8px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rcw-term-line,
  .rcw-sprt-dot,
  .rcw-sprt-end-label {
    animation: none;
  }
  .rcw-sprt-path {
    animation: none;
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }
  .rcw-cmd-btn,
  .rcw-preset-chip,
  .rcw-action-btn,
  .rcw-copy-btn,
  .rcw-tooltip,
  .rcw-sprt-cross {
    transition: none;
  }
  .rcw-cmd-btn:hover,
  .rcw-copy-btn:hover {
    transform: none;
  }
}
