/* ReqBird: the six AI agents, each shown as an animated scene (the AI topic of the main page).
   Page, nav, buttons, badges, tags and footer come from /site.css. This file holds what only the agents need:
   the stage with its tabs, the scenes, their playback cues and the product drawings. */

/* ---------- result colours in the scenes ---------- */
/* A failed result: solid red, the same red and white as the design system's danger button. */
.badge--alert { background: var(--rb-red); color: var(--rb-white); }
/* The soft red badge: the design system's red text on it is 3.8:1, the darker red is 5.5:1. */
.scene .badge--danger { color: var(--rb-red-700); }
/* Green marks a result that passes: "Complies" and "Passed". The design system has no green, so these three values are an
   addition requested by the owner. They are built like its soft red (same lightness steps); the text is 7.6:1 on the badge. */
:root { --ok-soft: #D6F7DC; --ok-ink: #1B552C; --ok: #2E9E52; }
.badge--ok { background: var(--ok-soft); color: var(--ok-ink); }

/* ---------- agents ---------- */

/* Without agents.js the agents stack, each next to its scene's final frame. */
.agent { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto 1fr; gap: 16px 48px; padding: 48px 0; border-top: 1px solid var(--line-hairline); }
.agent__name { grid-column: 1; font-size: var(--rb-size-h4); font-weight: var(--rb-weight-semibold); }
.agent__caption { grid-column: 1; }
.agent > .scene { grid-column: 2; grid-row: 1 / span 2; }
.agent__text { margin: 0 0 16px; font-size: var(--rb-size-body); line-height: var(--rb-leading-normal); color: var(--text-body); }
.io { display: grid; gap: 8px; margin: 0; }
.io__row { display: flex; align-items: flex-start; gap: 12px; }
.io__label { flex: none; width: 32px; margin: 0; padding-top: 4px; font-size: var(--rb-size-small); line-height: 20px; color: var(--text-muted); }
.io__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

/* With agents.js: tabs on the left, the playing scene on the right. */
.stage--tabs { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; }
.stage--tabs .agent { display: block; padding: 0; border: 0; }
.stage--tabs .agent[hidden] { display: none; }
.stage--tabs .agent:focus-visible { outline: var(--rb-focus-ring-width) solid var(--focus-ring); outline-offset: var(--rb-focus-ring-offset); }
.stage--tabs .agent__name { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Pause and play sit under the scene, so no scene has to leave a corner free for them. */
.stage__panel { position: relative; }
.stage__toggle { margin-top: 12px; }
.stage__toggle[hidden] { display: none; }
.stage__toggle .icon { width: 16px; height: 16px; }

.tabs { position: relative; display: flex; flex-direction: column; border-top: 1px solid var(--line-hairline); }
.tab { position: relative; display: block; width: 100%; margin: 0; padding: 20px 0 22px; border: 0; border-bottom: 1px solid var(--line-hairline); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tab__name { display: block; font-family: var(--font-display); font-size: var(--rb-size-lead); font-weight: var(--rb-weight-semibold); line-height: var(--rb-leading-snug); letter-spacing: var(--rb-tracking-display); color: var(--text-muted); transition: var(--rb-transition-control); }
.tab:hover .tab__name, .tab[aria-selected="true"] .tab__name { color: var(--text-heading); }
.tab__more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--rb-duration-normal) var(--rb-ease-standard); }
.tab[aria-selected="true"] .tab__more { grid-template-rows: 1fr; }
.tab__inner { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: hidden; }
.tab__text { display: block; padding-top: 10px; font-size: var(--rb-size-body); line-height: var(--rb-leading-normal); color: var(--text-body); }
.tab__progress { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--rb-navy); transform: scaleX(0); transform-origin: 0 50%; }
.tab[aria-selected="true"] .tab__progress { transform: none; }

@media (min-width: 900px) {
  .stage--tabs .agent__caption { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- scenes ---------- */
.scene { position: relative; aspect-ratio: 27 / 25; overflow: hidden; background: var(--surface-sunken); container: scene / size; }
/* Scenes are drawn in design pixels (--px) at the design system's own sizes, then scaled to the scene.
   --w and --h are the whole box, with the 16 px padding of each scene in it: 520 x 540 of content on a wide scene, 340 x 620 on a phone. */
.art { box-sizing: border-box; --w: 552; --h: 572; --px: min(100cqw / var(--w), 100cqh / var(--h), 1.25px); position: absolute; inset: 0; width: calc(var(--w) * var(--px)); height: calc(var(--h) * var(--px)); margin: auto; color: var(--text-body); font-family: var(--font-core); font-size: calc(14 * var(--px)); line-height: 1.4; }
/* Portrait scenes (phones) get a narrower, taller drawing. */
@container scene (orientation: portrait) { .art { --w: 372; --h: 652; } }

.art .card { border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); box-shadow: var(--rb-shadow-card); }
.art .card__head { display: flex; align-items: center; gap: calc(8 * var(--px)); min-width: 0; }
.art .card__title { flex: none; font-weight: var(--rb-weight-semibold); color: var(--text-heading); }
.art .card__meta { min-width: 0; overflow: hidden; color: var(--text-muted); white-space: nowrap; text-overflow: ellipsis; }
.art .icon { width: calc(18 * var(--px)); height: calc(18 * var(--px)); }
.art .bird { width: calc(20 * var(--px)); height: calc(14.5 * var(--px)); }
.art .btn--sm { gap: calc(6 * var(--px)); height: calc(32 * var(--px)); padding: 0 calc(12 * var(--px)); font-size: calc(14 * var(--px)); }
.art .tag { gap: calc(6 * var(--px)); height: calc(28 * var(--px)); padding: 0 calc(10 * var(--px)); font-size: calc(14 * var(--px)); }
.art .badge { height: calc(22 * var(--px)); padding: 0 calc(8 * var(--px)); font-size: calc(12 * var(--px)); }
/* Checkbox, checked: components/forms/Checkbox.jsx (the square-cut tick from the logo). */
.art .check { display: inline-flex; flex: none; align-items: center; justify-content: center; width: calc(18 * var(--px)); height: calc(18 * var(--px)); border: 1px solid var(--rb-navy); border-radius: var(--rb-radius-sm); background: var(--rb-navy); }
.art .check svg { width: calc(12 * var(--px)); height: calc(12 * var(--px)); fill: none; stroke: var(--rb-white); stroke-width: 3.2; stroke-linecap: square; }
.art .check path { stroke-dasharray: 23; }
.cursor { position: absolute; top: 58%; left: 58%; z-index: 3; width: calc(16 * var(--px)); height: calc(22 * var(--px)); color: var(--rb-navy); pointer-events: none; }

/* Scene 1: requirements agent */
.art--req { display: flex; flex-direction: column; justify-content: center; gap: calc(12 * var(--px)); padding: calc(16 * var(--px)); }
.voice { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: calc(12 * var(--px)); padding: calc(12 * var(--px)) calc(14 * var(--px)); }
.voice__main { display: grid; gap: calc(10 * var(--px)); min-width: 0; }
.voice__mic { display: inline-flex; flex: none; align-items: center; justify-content: center; width: calc(24 * var(--px)); height: calc(24 * var(--px)); border-radius: var(--rb-radius-md); background: var(--rb-navy); color: var(--rb-white); }
.art .voice__mic .icon { width: calc(14 * var(--px)); height: calc(14 * var(--px)); stroke-width: 2; }
.voice__time { flex: none; margin-left: auto; color: var(--text-muted); font-size: calc(12 * var(--px)); font-variant-numeric: tabular-nums; }
.wave { position: relative; height: calc(24 * var(--px)); }
.wave svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wave__all { fill: var(--rb-navy-300); }
.wave__played { fill: var(--rb-navy); }
.voice__text { margin: 0; color: var(--text-heading); }
.doc__head { padding: calc(10 * var(--px)) calc(14 * var(--px)); border-bottom: 1px solid var(--line-hairline); }
.agent-mark { display: inline-flex; flex: none; align-items: center; gap: calc(6 * var(--px)); margin-left: auto; color: var(--text-muted); font-size: calc(12 * var(--px)); }
.reqs { margin: 0; padding: 0; list-style: none; }
.req { position: relative; display: grid; grid-template-columns: calc(56 * var(--px)) minmax(0, 1fr) auto; align-items: baseline; gap: calc(10 * var(--px)); padding: calc(9 * var(--px)) calc(14 * var(--px)); }
.req + .req { border-top: 1px solid var(--line-hairline); }
/* Rows animate in (their own stacking context), so the row holding the suggestion must sit above the rest. */
.req--flagged { z-index: 2; }
.req__id { color: var(--text-muted); font-family: var(--font-mono); font-size: calc(12 * var(--px)); }
.req__text { color: var(--text-heading); }
.req__swap, .req__state { display: grid; }
.req__swap > *, .req__state > * { grid-area: 1 / 1; }
.req__state { justify-items: end; }
.vague { padding: 0 0 1px; background: linear-gradient(var(--rb-red), var(--rb-red)) 0 100% / 100% 2px no-repeat; color: inherit; }
/* The pop-up floats above the card: a crisp edge, a contact shadow and a wide navy halo, so it never blends into the rows behind it. */
.suggest { position: absolute; top: calc(100% - 2 * var(--px)); right: calc(14 * var(--px)); left: calc(80 * var(--px)); z-index: 2; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: calc(8 * var(--px)) calc(10 * var(--px)); padding: calc(12 * var(--px)) calc(14 * var(--px)); border-radius: var(--rb-radius-md); background: var(--surface-accent-soft); box-shadow: 0 0 0 1px rgba(30, 39, 97, .18), 0 calc(4 * var(--px)) calc(10 * var(--px)) rgba(30, 39, 97, .22), 0 calc(16 * var(--px)) calc(36 * var(--px)) rgba(30, 39, 97, .34); color: var(--text-heading); }
.suggest .bird { margin-top: calc(2 * var(--px)); }
.suggest__actions { display: flex; grid-column: 2; gap: calc(6 * var(--px)); }
.export { display: flex; flex-wrap: wrap; align-items: center; gap: calc(6 * var(--px)); padding: calc(10 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); }
.export__label { margin-right: calc(4 * var(--px)); color: var(--text-muted); font-size: calc(13 * var(--px)); }
.file { display: inline-flex; align-self: flex-start; align-items: center; gap: calc(10 * var(--px)); padding: calc(8 * var(--px)) calc(12 * var(--px)); border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); }
.file__name { color: var(--text-heading); font-family: var(--font-mono); font-size: calc(12 * var(--px)); }
.file__meta { color: var(--text-muted); font-size: calc(12 * var(--px)); }
@container scene (orientation: portrait) {
  .req { grid-template-columns: calc(52 * var(--px)) minmax(0, 1fr); }
  .req__state { grid-column: 2; justify-items: start; }
  .suggest { left: calc(14 * var(--px)); }
  .file__meta { display: none; }
}

/* ---------- scenes 2 to 6: shared pieces ---------- */
.swap { display: grid; }
/* All states are positioned, so the later one paints over the earlier one even when nothing is animating. */
.swap > * { grid-area: 1 / 1; position: relative; }
/* Text states: the later state has the card colour and paints over the earlier one, so nothing needs a fade-out. */
.swap--text > * { background: var(--surface-card); }
.art .badge { position: relative; }
.art .badge .icon { width: calc(12 * var(--px)); height: calc(12 * var(--px)); margin-right: calc(4 * var(--px)); stroke-width: 2.2; }
.art .icon--cover { background: var(--surface-card); }
.line { display: block; }
.docchip { display: flex; align-items: center; gap: calc(8 * var(--px)); min-width: 0; padding: calc(8 * var(--px)) calc(12 * var(--px)); border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); box-shadow: var(--rb-shadow-card); font-size: calc(13 * var(--px)); }
.docchip__name { min-width: 0; overflow: hidden; color: var(--text-heading); font-weight: var(--rb-weight-semibold); white-space: nowrap; text-overflow: ellipsis; }
.docchip .badge { margin-left: auto; }
.approved { display: inline-flex; align-items: center; gap: calc(8 * var(--px)); min-height: calc(32 * var(--px)); padding: 0 calc(12 * var(--px)); border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); color: var(--text-heading); font-size: calc(13 * var(--px)); font-weight: var(--rb-weight-semibold); white-space: nowrap; }
.file--text .file__name { font-family: var(--font-core); font-size: calc(13 * var(--px)); font-weight: var(--rb-weight-semibold); }
/* A red underline on the text that is the problem; gone once the engineer has decided. */
.mark { position: relative; }
.mark::after { content: ""; position: absolute; right: 0; bottom: calc(-1 * var(--px)); left: 0; height: calc(2 * var(--px)); background: var(--rb-red); opacity: 0; transform-origin: 0 50%; }
.art--matrix, .art--plan, .art--track, .art--impact { display: flex; flex-direction: column; justify-content: center; gap: calc(12 * var(--px)); padding: calc(16 * var(--px)); }

/* Scene 2: compliance matrix agent */
.inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(8 * var(--px)); }
.mx { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) calc(98 * var(--px)); align-items: center; gap: calc(10 * var(--px)); min-height: calc(32 * var(--px)); padding: calc(3 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); font-size: calc(13 * var(--px)); }
.doc__head + .mx { border-top: 0; }
.mx--head { min-height: calc(24 * var(--px)); background: var(--surface-sunken); color: var(--text-muted); font-size: calc(12 * var(--px)); font-weight: var(--rb-weight-semibold); }
.mx--head span:last-child { text-align: center; }
.mx--gap { z-index: 2; }
.mx__req { color: var(--text-heading); }
.mx__tech { color: var(--text-body); }
.mx__state .badge, .tr__state .badge { box-sizing: border-box; width: 100%; justify-content: center; }
.mx--sum { display: block; min-height: calc(26 * var(--px)); padding-top: calc(5 * var(--px)); color: var(--text-muted); }
.mx--sum b { color: var(--text-heading); }
.art--matrix { gap: calc(10 * var(--px)); }
.matrix .export { padding: calc(8 * var(--px)) calc(14 * var(--px)); }
.art--matrix .file { padding: calc(6 * var(--px)) calc(12 * var(--px)); }
/* These popovers span the whole card, so they cover the rows beneath them instead of leaving fragments showing. */
.suggest--source, .suggest--retest { left: calc(14 * var(--px)); }
.suggest--source { padding-bottom: calc(22 * var(--px)); }
.suggest--source .suggest__text { font-size: calc(13 * var(--px)); }
.quote { display: block; }

/* Scene 3: test plan builder */
.cover { display: flex; align-items: center; gap: calc(10 * var(--px)); padding: calc(8 * var(--px)) calc(14 * var(--px)); border-bottom: 1px solid var(--line-hairline); color: var(--text-muted); font-size: calc(13 * var(--px)); }
.cover__bar { display: flex; gap: calc(3 * var(--px)); margin-left: auto; }
.cover__bar i { width: calc(20 * var(--px)); height: calc(8 * var(--px)); background: var(--rb-navy); }
.cover__count { min-width: calc(48 * var(--px)); text-align: right; }
.cover__n { color: var(--text-heading); font-weight: var(--rb-weight-semibold); }
.cover__n--bad { color: var(--text-danger); }
.plan__rows { margin: 0; padding: 0; list-style: none; }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) calc(24 * var(--px)) minmax(0, 1.25fr); align-items: center; padding: calc(6 * var(--px)) calc(14 * var(--px)); font-size: calc(13 * var(--px)); }
.trow + .trow { border-top: 1px solid var(--line-hairline); }
.trow__req { display: grid; grid-template-columns: calc(52 * var(--px)) minmax(0, 1fr); gap: calc(8 * var(--px)); align-items: baseline; color: var(--text-heading); }
.trow__link { height: calc(2 * var(--px)); margin: 0 calc(4 * var(--px)); background: var(--rb-navy-300); transform-origin: 0 50%; }
.trow__test .badge { align-self: center; justify-self: start; }
.tcase { display: grid; gap: 1px; padding: calc(5 * var(--px)) calc(10 * var(--px)); border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); }
.tcase__name { color: var(--text-heading); font-weight: var(--rb-weight-semibold); }
.tcase__how { color: var(--text-muted); font-size: calc(12 * var(--px)); }
.plan__foot { display: flex; align-items: center; justify-content: space-between; gap: calc(10 * var(--px)); padding: calc(10 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); }
.plan__sum { color: var(--text-muted); font-size: calc(13 * var(--px)); }
.plan__act, .report__send { justify-items: end; }

/* Scene 4: test plan tracker */
.reports { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(8 * var(--px)); }
.reports .docchip { gap: calc(6 * var(--px)); padding: calc(6 * var(--px)) calc(10 * var(--px)); }
.tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) calc(108 * var(--px)); align-items: center; gap: calc(10 * var(--px)); padding: calc(7 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); }
.doc__head + .tr { border-top: 0; }
.tr--fail { z-index: 2; }
.tr__main { display: grid; gap: 1px; min-width: 0; }
.tr__name { color: var(--text-heading); font-size: calc(13 * var(--px)); font-weight: var(--rb-weight-semibold); }
.tr__sub { color: var(--text-muted); font-size: calc(12 * var(--px)); }
.tr__sum { color: var(--text-muted); font-size: calc(13 * var(--px)); }
.tr__sum > span { padding: calc(8 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); }

/* Scene 5: daily or weekly reporting */
.art--report { display: flex; flex-direction: column; justify-content: center; gap: calc(10 * var(--px)); padding: calc(16 * var(--px)); }
.sources { display: flex; flex-wrap: wrap; gap: calc(6 * var(--px)); }
.src { display: inline-flex; align-items: center; gap: calc(6 * var(--px)); height: calc(30 * var(--px)); padding: 0 calc(10 * var(--px)); border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); box-shadow: var(--rb-shadow-card); font-size: calc(13 * var(--px)); }
.art .src .icon { width: calc(16 * var(--px)); height: calc(16 * var(--px)); }
.src__label { color: var(--text-muted); }
.src__n { color: var(--text-heading); font-weight: var(--rb-weight-semibold); }
.product { display: flex; align-items: center; gap: calc(12 * var(--px)); padding: calc(10 * var(--px)) calc(14 * var(--px)); border-bottom: 1px solid var(--line-hairline); }
.figure { display: block; flex: none; width: calc(128 * var(--px)); padding: calc(5 * var(--px)); border: 1px solid var(--line-hairline); border-radius: var(--rb-radius-md); background: var(--surface-card); }
.product__who { display: grid; gap: calc(3 * var(--px)); min-width: 0; }
.product__name { color: var(--text-heading); font-size: calc(14 * var(--px)); font-weight: var(--rb-weight-semibold); }
.product__lines { color: var(--text-muted); font-size: calc(12 * var(--px)); line-height: 1.5; }
.product + .mx, .product + .tr { border-top: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(10 * var(--px)); padding: calc(12 * var(--px)) calc(14 * var(--px)) calc(10 * var(--px)); }
.stat { display: grid; align-content: start; gap: 1px; }
.stat__n { color: var(--text-heading); font-family: var(--font-display); font-size: calc(24 * var(--px)); font-weight: var(--rb-weight-semibold); line-height: 1.1; }
.stat__label { color: var(--text-muted); font-size: calc(12 * var(--px)); }
.bar { display: flex; gap: calc(2 * var(--px)); height: calc(6 * var(--px)); margin-top: calc(6 * var(--px)); transform-origin: 0 50%; }
.bar i { flex: var(--n) 1 0%; background: var(--rb-navy); }
.bar .bad { min-width: calc(4 * var(--px)); background: var(--rb-red); }
.bar .ok { background: var(--ok); }
.bar .rest { background: var(--rb-grey-200); }
.risks { display: grid; gap: calc(5 * var(--px)); margin: 0; padding: calc(2 * var(--px)) calc(14 * var(--px)) calc(12 * var(--px)); list-style: none; }
.risk { display: flex; align-items: center; gap: calc(8 * var(--px)); color: var(--text-heading); font-size: calc(13 * var(--px)); }
.risk::before { content: ""; flex: none; width: calc(8 * var(--px)); height: calc(8 * var(--px)); background: var(--rb-red); }
.report__foot { display: flex; flex-wrap: wrap; align-items: center; gap: calc(6 * var(--px)); padding: calc(10 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); }
.report__send { margin-left: auto; }

/* The product drawing: isometric line art in the style of a technical manual. Lines keep a constant width at any size. */
.drawing { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; color: var(--rb-navy); }
.drawing * { vector-effect: non-scaling-stroke; stroke: var(--rb-navy); stroke-width: 1.15px; stroke-linejoin: round; stroke-linecap: round; }
.drawing .f1 { fill: var(--rb-white); }
.drawing .f2 { fill: var(--rb-mist); }
.drawing .f3 { fill: var(--rb-navy-100); }
.drawing .sm2 { fill: var(--rb-mist); stroke: var(--rb-mist); stroke-width: 1px; }
.drawing .sm3 { fill: var(--rb-navy-100); stroke: var(--rb-navy-100); stroke-width: 1px; }
.drawing .ol { fill: none; }
.drawing .ln { fill: none; stroke-width: .8px; }
.drawing .dk { fill: var(--rb-navy); }
.drawing .sw { fill: none; stroke: var(--rb-navy-300); stroke-width: 1px; stroke-dasharray: 4 3; }
.drawing .hub { fill: var(--rb-navy); }
.drawing .wh { fill: none; stroke: var(--rb-white); stroke-width: 1px; }
.drawing .wh2 { fill: none; stroke: var(--rb-white); stroke-width: 1.5px; }
.drawing .whf { fill: var(--rb-white); stroke: var(--rb-white); stroke-width: 1px; }
.drawing .wtx { fill: var(--rb-white); stroke: none; font-family: var(--font-display); font-weight: var(--rb-weight-semibold); }
.drawing .ah { fill: var(--rb-navy-300); stroke: var(--rb-navy-300); stroke-width: .8px; }
.drawing .cl { stroke: var(--rb-navy-300); stroke-width: .8px; stroke-dasharray: 9 2.5 1.5 2.5; }

/* Scene 6: change impact agent */
.art--impact { gap: calc(8 * var(--px)); }
.change { display: flex; align-items: center; gap: calc(12 * var(--px)); padding: calc(8 * var(--px)) calc(14 * var(--px)); }
.change__main { display: grid; gap: calc(3 * var(--px)); min-width: 0; }
.change__head { display: flex; align-items: center; gap: calc(8 * var(--px)); }
.change__value { display: flex; flex-wrap: wrap; align-items: baseline; gap: calc(2 * var(--px)) calc(8 * var(--px)); margin-top: calc(2 * var(--px)); color: var(--text-heading); font-family: var(--font-display); font-size: calc(18 * var(--px)); font-weight: var(--rb-weight-semibold); line-height: 1.2; }
.change__what { color: var(--text-muted); font-family: var(--font-core); font-size: calc(13 * var(--px)); font-weight: var(--rb-weight-regular); }
.change__from { color: var(--text-muted); font-weight: var(--rb-weight-medium); }
.impact__total { margin-left: auto; color: var(--text-muted); font-size: calc(12 * var(--px)); }
.irow { position: relative; display: grid; grid-template-columns: calc(18 * var(--px)) calc(100 * var(--px)) minmax(0, 1fr) auto; align-items: center; column-gap: calc(10 * var(--px)); min-height: calc(30 * var(--px)); padding: calc(3 * var(--px)) calc(14 * var(--px)); border-top: 1px solid var(--line-hairline); font-size: calc(13 * var(--px)); }
.doc__head + .irow { border-top: 0; }
.irow__label { color: var(--text-heading); font-weight: var(--rb-weight-semibold); }
.irow__items { min-width: 0; color: var(--text-body); }
.irow__n { justify-self: end; }
.irow__n .badge { justify-self: end; }
.irow__n .badge--danger, .irow__n .badge--soft { min-width: calc(108 * var(--px)); justify-content: center; }
.cr__id { font-family: var(--font-mono); font-size: calc(12 * var(--px)); }
.cr__body { display: grid; gap: 2px; padding: calc(8 * var(--px)) calc(14 * var(--px)) calc(4 * var(--px)); }
.cr__title { color: var(--text-heading); font-weight: var(--rb-weight-semibold); }
.cr__sub { color: var(--text-muted); font-size: calc(12 * var(--px)); }
.cr__foot { justify-items: start; padding: calc(2 * var(--px)) calc(14 * var(--px)) calc(10 * var(--px)); }

/* Scenes 2 to 6 on narrow screens: rows stack instead of running in columns. */
@container scene (orientation: portrait) {
  /* The bird alone marks the agent's work, which leaves room for the card subtitle. */
  .agent-mark__text { display: none; }
  .voice { grid-template-areas: "fig head" "wave wave" "text text"; }
  .voice__main { display: contents; }
  .voice > .figure { grid-area: fig; }
  .voice .card__head { grid-area: head; flex-wrap: wrap; row-gap: calc(2 * var(--px)); }
  .voice .wave { grid-area: wave; }
  .voice__text { grid-area: text; }
  .voice__time { order: 2; }
  .voice .card__meta { order: 3; flex-basis: 100%; }
  .reports .docchip .icon { display: none; }
  .inputs { grid-template-columns: minmax(0, 1fr); gap: calc(6 * var(--px)); }
  .mx { grid-template-columns: minmax(0, 1fr) calc(98 * var(--px)); grid-template-areas: "req state" "tech state"; row-gap: 0; min-height: calc(48 * var(--px)); }
  .mx--head { display: none; }
  .mx__req { grid-area: req; }
  .mx__tech { grid-area: tech; color: var(--text-muted); font-size: calc(12 * var(--px)); }
  .mx__tech::before { content: "Sheet: "; }
  .mx__state { grid-area: state; }
  .mx--sum { min-height: 0; }
  .trow { grid-template-columns: minmax(0, 1fr); row-gap: calc(5 * var(--px)); padding: calc(8 * var(--px)) calc(14 * var(--px)); }
  .trow__link { display: none; }
  .trow__test { margin-left: calc(12 * var(--px)); }
  .tcase { border-left: calc(2 * var(--px)) solid var(--rb-navy-300); }
  .figure { width: calc(100 * var(--px)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(8 * var(--px)) calc(16 * var(--px)); padding-top: calc(10 * var(--px)); }
  .stat { grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: calc(6 * var(--px)); }
  .stat__n { font-size: calc(20 * var(--px)); }
  .stat .bar { grid-column: 1 / -1; }
  .irow { grid-template-columns: calc(18 * var(--px)) minmax(0, 1fr) auto; grid-template-areas: "icon label n" ". items items"; min-height: calc(46 * var(--px)); padding: calc(6 * var(--px)) calc(14 * var(--px)); }
  .irow > .icon { grid-area: icon; }
  .irow__label { grid-area: label; }
  .irow__items { grid-area: items; color: var(--text-muted); font-size: calc(12 * var(--px)); }
  .irow__n { grid-area: n; }
}

/* ---------- scene playback ----------
   Cues in the markup: data-in enters at --t, data-show is visible from --t for --len, data-press presses
   a button, data-select picks a tag, data-cursor brings the pointer to its parent, data-check ticks a box,
   data-until hides a state for good once the state that replaces it is in.
   Without .is-playing (no JS, reduced motion, or the end of a scene) every scene shows its final frame. */
.scene [data-show], .scene [data-cursor] { opacity: 0; }
.is-playing .scene [data-in] { animation: rb-in var(--len, .4s) var(--rb-ease-standard) var(--t, 0s) both; }
.swap > [data-in] { --len: .15s; }
/* A state that a later one replaces in a .swap (data-until) is shown from the start and gone for good at --u, once the new state is fully in.
   Left underneath, its rounded corners would show as a faint fringe around the new one. Without .is-playing only the last state shows. */
.swap > [data-until] { visibility: hidden; }
.is-playing .scene [data-show] { animation: rb-show var(--len, 2s) linear var(--t, 0s) both; }
.is-playing .scene [data-press] { animation: rb-press .3s linear var(--t) both; }
.is-playing .scene [data-select] { animation: rb-select var(--rb-duration-fast) var(--rb-ease-standard) var(--t) both; }
.is-playing .scene [data-cursor] { animation: rb-cursor 1.2s var(--rb-ease-standard) var(--t) both; }
.is-playing .scene [data-check] { animation: rb-check var(--rb-duration-fast) var(--rb-ease-standard) var(--t) both; }
.is-playing .scene [data-check] path { animation: rb-tick .3s var(--rb-ease-out) calc(var(--t) + .1s) both; }
.is-playing .scene .req[data-in] { animation: rb-in .4s var(--rb-ease-standard) var(--t) both, rb-draft 1.6s var(--rb-ease-standard) var(--t) both; }
.is-playing .scene .vague { animation: rb-underline .5s var(--rb-ease-standard) var(--t) both; }
/* Scenes 2 to 6. --tp is the moment a button is pressed, --t2 the moment the engineer approves a draft. */
.is-playing .scene [data-in][data-press] { animation: rb-in var(--len, .4s) var(--rb-ease-standard) var(--t, 0s) both, rb-press .3s linear var(--tp) both; }
.is-playing .scene .flash[data-in] { animation: rb-in .4s var(--rb-ease-standard) var(--t, 0s) both, rb-draft 1.6s var(--rb-ease-standard) var(--t, 0s) both; }
.is-playing .scene .tcase[data-in], .is-playing .scene .cr[data-in] { animation: rb-in var(--len, .4s) var(--rb-ease-standard) var(--t, 0s) both, rb-approve .35s linear var(--t2) both; }
.is-playing .scene [data-until] { animation: rb-until .01s linear var(--u) both; }
.is-playing .scene [data-until][data-in] { animation: rb-in var(--len, .4s) var(--rb-ease-standard) var(--t, 0s) both, rb-until .01s linear var(--u) both; }
.is-playing .scene [data-until][data-in][data-press] { animation: rb-in var(--len, .4s) var(--rb-ease-standard) var(--t, 0s) both, rb-press .3s linear var(--tp) both, rb-until .01s linear var(--u) both; }
.is-playing .scene [data-fill] { animation: rb-fill .3s var(--rb-ease-standard) var(--t) both; }
.is-playing .scene [data-link] { animation: rb-link .35s var(--rb-ease-standard) var(--t) both; }
.is-playing .scene [data-grow] { animation: rb-grow .6s var(--rb-ease-standard) var(--t) both; }
.is-playing .scene [data-deselect] { animation: rb-deselect var(--rb-duration-fast) var(--rb-ease-standard) var(--t) both; }
.is-playing .scene .mark::after { animation: rb-mark var(--len) linear var(--t) both; }
.is-playing .scene .wave__played { animation: rb-play 2.6s linear .35s both; }
.is-playing .scene .say { animation: rb-word .3s var(--rb-ease-standard) calc(.4s + var(--i) * .105s) both; }
.is-playing .tab[aria-selected="true"] .tab__progress { animation: rb-progress var(--d, 10s) linear both; }
.is-paused .scene *, .is-paused .scene *::after, .is-paused .tab__progress { animation-play-state: paused !important; }

@keyframes rb-in { from { opacity: 0; transform: translateY(calc(8 * var(--px))); } }
@keyframes rb-show { 0% { opacity: 0; transform: translateY(calc(6 * var(--px))); } 10%, 90% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }
@keyframes rb-press { 30%, 70% { transform: translateY(1px); border-color: var(--action-primary-bg-active); background-color: var(--action-primary-bg-active); } }
@keyframes rb-select { from { background-color: var(--rb-mist); color: var(--rb-navy); } }
@keyframes rb-cursor { 0% { opacity: 0; transform: translate(calc(56 * var(--px)), calc(40 * var(--px))); } 20% { opacity: 1; } 55%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }
@keyframes rb-check { from { border-color: var(--line-hairline); background-color: var(--rb-white); } }
@keyframes rb-tick { from { stroke-dashoffset: 23; } }
@keyframes rb-draft { 0%, 50% { background-color: var(--surface-accent-soft); } }
@keyframes rb-underline { from { background-size: 0% 2px; } }
@keyframes rb-approve { from { background-color: var(--surface-accent-soft); } }
@keyframes rb-until { from { visibility: visible; } to { visibility: hidden; } }
@keyframes rb-fill { from { background-color: var(--rb-grey-200); } }
@keyframes rb-link { from { transform: scaleX(0); } }
@keyframes rb-grow { from { transform: scaleX(0); } }
@keyframes rb-deselect { from { background-color: var(--rb-navy); color: var(--rb-white); } }
@keyframes rb-mark { 0% { opacity: 1; transform: scaleX(0); } 8% { transform: scaleX(1); } 92% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1); } }
@keyframes rb-play { from { clip-path: inset(0 100% 0 0); } }
@keyframes rb-word { from { opacity: 0; } }
@keyframes rb-progress { from { transform: scaleX(0); } }

/* ---------- smaller screens ---------- */
@media (max-width: 899px) {
  .agent { grid-template-columns: minmax(0, 1fr); }
  .agent > .scene { grid-column: 1; grid-row: auto; }
  .stage--tabs { display: block; }
  /* The tabs become the design system's underlined tab strip (components/navigation/Tabs.jsx). */
  /* The fade at the right edge shows that more agents scroll in. */
  .tabs { flex-direction: row; gap: 4px; margin: 0 -32px 20px; padding: 0 32px; overflow-x: auto; border-top: 0; border-bottom: 1px solid var(--line-hairline); scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; width: auto; margin-bottom: -1px; padding: 10px 14px; border-bottom: 0; }
  .tab:focus-visible { outline-offset: -2px; }
  .tab__name { font-family: var(--font-core); font-size: var(--rb-size-small); font-weight: var(--rb-weight-medium); line-height: 1.4; letter-spacing: 0; }
  .tab[aria-selected="true"] .tab__name { font-weight: var(--rb-weight-semibold); }
  .tab__more { display: none; }
  .tab__progress { bottom: 0; }
  /* The scene and its pause button come first, then the caption. */
  .stage--tabs .agent:not([hidden]) { display: flex; flex-direction: column; }
  .stage--tabs .agent > .scene, .stage--tabs .agent > .stage__toggle { order: -1; }
  .stage--tabs .agent > .stage__toggle { align-self: flex-start; }
  .stage--tabs .agent__caption { margin-top: 20px; }
}
@media (max-width: 640px) {
  .tabs { margin: 0 -20px 16px; padding: 0 20px; }
}
@media (max-width: 599px) {
  .scene { aspect-ratio: 4 / 7; }
}
