/* Agent Black Box (web/workspace/blackbox.js). Theme tokens only (identity.css): Light, Dark and OLED come free.
   Status is always written as well as colored. */

.bb { gap: 1rem; }
.bb-panel { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
/* A page's text fields are full width (.ws-project input); checkboxes and radios keep their own size. */
.bb input[type="checkbox"], .bb input[type="radio"] { width: auto; padding: 0; border: 0; background: none; flex: none; accent-color: var(--accent); }
.bb .ws-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; line-height: 1.2; }
.bb .ws-button svg { flex: none; display: block; }
.bb-mono { font-family: var(--font-mono); font-size: .8em; overflow-wrap: anywhere; }
.bb-input { font: inherit; font-size: .88rem; padding: .45rem .6rem; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); width: 100%; }
.bb-input--short { max-width: 8rem; }
.bb select { font: inherit; font-size: .85rem; padding: .4rem .55rem; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); }
.bb select[multiple] { min-width: 14rem; }
.bb-linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: start; }
.bb-linkish:hover, .bb-linkish:focus-visible { text-decoration: underline; }
.bb-copy { background: none; border: 1px dashed var(--line); border-radius: var(--r-xs); color: var(--muted); padding: .05rem .35rem; cursor: copy; }
.bb-copy:hover, .bb-copy:focus-visible { color: var(--ink); border-color: var(--accent); }
.bb-mini { display: inline-flex; color: var(--dim); }


/* Overview tiles and the events-per-day bars. */
.bb-overview { display: flex; flex-direction: column; gap: .75rem; }
.bb-usage { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .78rem; }
.bb-bars { display: flex; align-items: flex-end; justify-content: flex-end; gap: 3px; height: 2.6rem; min-width: 8rem; flex: 0 1 18rem; }
.bb-bars i { flex: 1 1 0; min-width: 4px; max-width: 12px; border-radius: 2px 2px 0 0; background: var(--chart-1); opacity: .85; }
.bb-bars i.is-dropped { background: var(--warn); }
.bb-bars i.is-empty { background: var(--line); opacity: 1; }
/* What's stored: events and runs, and whether content is kept (and why not); the chart with its caption beside it. */
.bb-storage { display: grid; gap: .3rem; min-width: 0; flex: 1 1 14rem; }
.bb-storage p { margin: 0; font-size: .85rem; }
.bb-storage__off { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.bb-chart { margin: 0; display: grid; gap: .35rem; justify-items: end; flex: 0 1 18rem; min-width: 8rem; }
.bb-chart figcaption { font-size: .72rem; }
.bb-chart .bb-bars { width: 100%; flex: none; }
.bb-more summary { cursor: pointer; color: var(--muted); font-size: .85rem; padding: .2rem 0; }
.bb-more .ws-filters { margin-top: .5rem; }
/* A picker (App, Agent, Model, Tool): a select's size and shape, its choice's color dot or icon, the text and a chevron
   centered on one line. */
.bb-pick { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; flex: 0 1 auto; max-width: 16rem; font: inherit; font-size: .85rem;
  padding: .4rem .55rem; background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.bb-pick.is-set { color: var(--ink); border-color: var(--accent); }
.bb-pick > svg { flex: none; display: block; }
.bb-pick__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-pick__chev { flex: none; display: grid; place-items: center; margin-left: auto; color: var(--muted); }
.bb-pick__chev svg { display: block; }
.bb-dot { flex: none; display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 2px color-mix(in srgb, var(--dot) 25%, transparent); }
@media (max-width: 600px) { .bb-pick { flex: 1 1 calc(50% - .45rem); max-width: none; } }

/* The run list. */
.bb-runs { display: flex; flex-direction: column; gap: .4rem; }
.bb-run__head { width: 100%; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) auto auto auto; align-items: center; gap: .75rem;
  padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.bb-run__head:hover { border-color: var(--line-strong); }
.bb-run__head:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bb-run__title { display: flex; flex-direction: column; min-width: 0; }
.bb-run__title strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-run__title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-run__badges { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; }
.bb-run__meta { display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; white-space: nowrap; }
.bb-run__seal { color: var(--dim); display: inline-flex; }
.bb-graphkey { display: flex; justify-content: flex-end; margin-bottom: .25rem; }
.bb-empty { display: grid; justify-items: center; gap: .45rem; padding: 2rem 1rem; text-align: center; }
.bb-empty h2 { margin: 0; text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); }
.bb-empty p { margin: 0; }
.bb-empty svg { display: block; }

/* One run. */
.bb-runhead { display: flex; flex-direction: column; gap: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.bb-runhead__title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.bb-runhead__title h2 { margin: 0; font-size: 1.2rem; font-weight: 640; letter-spacing: -.01em; text-transform: none; color: var(--ink); }
.bb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .35rem 1rem; margin: 0; }
.bb-facts dt { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.bb-facts dd { margin: 0 0 .3rem; font-size: .86rem; overflow-wrap: anywhere; }
.bb-links, .bb-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.bb-outcome { padding: .9rem 1rem; }
.bb-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.bb-step { display: flex; flex-direction: column; gap: .05rem; padding: .55rem .65rem; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--line-soft); }
.bb-step strong { font-size: 1.15rem; font-weight: 650; }
.bb-step span { font-size: .78rem; }
.bb-step small { font-size: .7rem; color: var(--dim); }
.bb-step--warn strong { color: var(--warn); }
.bb-step--bad strong { color: var(--danger); }
.bb-step--ok strong { color: var(--ok); }

.bb-limits { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
/* A limit runs to a few lines: its icon sits centered on the first. */
.bb-limit { display: flex; gap: .5rem; align-items: flex-start; font-size: .84rem; line-height: 1.45; }
.bb-limit__icon { display: inline-flex; align-items: center; height: 1lh; flex: none; }
.bb-limit svg { flex: none; display: block; }
.bb-limit--warn { color: var(--warn); }
.bb-limit--warn span { color: var(--ink); }
.bb-limit--info { color: var(--info); }
.bb-limit--info span, .bb-limit--muted span { color: var(--muted); }

/* The timeline. */
.bb-lanes { display: flex; flex-wrap: wrap; gap: .35rem; }
.bb-lane { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: var(--r-pill); cursor: pointer; }
.bb-lane input { accent-color: var(--accent); margin: 0; }
.bb-bookmarks { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .82rem; }
.bb-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-left: 2px solid var(--line); }
.bb-event { position: relative; }
.bb-event.is-tainted { border-left: 2px solid color-mix(in srgb, var(--warn) 55%, transparent); margin-left: -2px; }
.bb-event__head { width: 100%; display: grid; grid-template-columns: 4.8rem 1.6rem minmax(0, 1fr) auto auto; align-items: center; gap: .5rem; padding: .4rem .6rem;
  background: none; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); font: inherit; font-size: .86rem; text-align: start; cursor: pointer; }
.bb-event__head:hover { background: var(--sunken); }
.bb-event__head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.bb-event__time { color: var(--dim); }
.bb-event__lane { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: var(--r-sm); background: var(--sunken); }
.bb-event__what { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: baseline; min-width: 0; }
.bb-event__what strong { font-weight: 560; }
.bb-event__what .bb-mono { color: var(--muted); }
.bb-event__tags { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }
.bb-event__seq { color: var(--dim); }
.bb-event__detail { padding: .6rem .8rem .9rem 2.4rem; display: flex; flex-direction: column; gap: .6rem; background: var(--sunken); border-bottom: 1px solid var(--line-soft); }
.bb-attrs { display: grid; grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); gap: .25rem .9rem; margin: 0; font-size: .82rem; }
.bb-attrs dt { color: var(--muted); }
.bb-attrs dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bb-chain summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.bb-content { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.bb-piece { margin: 0; width: 100%; }
.bb-piece figcaption { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .3rem; font-size: .82rem; }
.bb-pre { margin: 0; max-height: 22rem; overflow: auto; padding: .7rem .8rem; border-radius: var(--r-sm); background: var(--code-bg); color: var(--code-ink); font-family: var(--font-mono); font-size: .78rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Lane colors: the icon tile, the lane chip's dot, the graph's bars. */
.bb-lane--run, .bb-kind--run { --bb-c: var(--chart-1); }
.bb-lane--agent, .bb-kind--agent { --bb-c: var(--chart-2); }
.bb-lane--model, .bb-kind--model { --bb-c: var(--chart-3); }
.bb-lane--tool, .bb-kind--tool, .bb-kind--span { --bb-c: var(--chart-4); }
.bb-lane--policy { --bb-c: var(--chart-5); }
.bb-lane--approval { --bb-c: var(--chart-6); }
.bb-lane--plan { --bb-c: var(--indigo); }
.bb-lane--effect { --bb-c: var(--ok); }
.bb-lane--recording { --bb-c: var(--warn); }
.bb-event__lane { color: var(--bb-c, var(--muted)); background: color-mix(in srgb, var(--bb-c, var(--muted)) 14%, transparent); }
.bb-lane input:checked + span { color: var(--ink); }
.bb-lane::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--bb-c, var(--muted)); }

/* The causal graph: a waterfall that scrolls sideways on a phone (data-noswipe keeps gestures out of it). */
.bb-graphwrap { overflow-x: auto; }
.bb-graph { display: block; width: 100%; height: auto; font-family: var(--font-ui); }
.bb-graph__grid { stroke: var(--chart-grid); stroke-width: 1; }
.bb-graph__tick { fill: var(--dim); font-size: 10px; }
.bb-graph__label { fill: var(--ink); font-size: 11.5px; }
.bb-graph__band { fill: transparent; }
.bb-graph__row { cursor: pointer; outline: none; }
.bb-graph__row:hover .bb-graph__band, .bb-graph__row:focus-visible .bb-graph__band { fill: var(--sunken); }
.bb-graph__row.is-selected .bb-graph__band { fill: var(--accent-surface); }
.bb-graph__row:focus-visible .bb-graph__band { stroke: var(--focus); stroke-width: 2; }
.bb-graph__bar { fill: var(--bb-c, var(--chart-4)); opacity: .85; }
.bb-status--failed .bb-graph__bar, .bb-status--blocked .bb-graph__bar { fill: var(--danger); }
.bb-status--pending_approval .bb-graph__bar { fill: var(--warn); }
.bb-status--open .bb-graph__bar { fill: none; stroke: var(--warn); stroke-dasharray: 4 3; stroke-width: 1.5; }
.bb-graph__open { fill: var(--warn); font-size: 10px; }
.bb-graph__edge { fill: none; stroke: var(--muted); stroke-width: 1.3; opacity: .8; }
.bb-graph__edge--approved { stroke: var(--ok); stroke-dasharray: 5 3; }
.bb-graph__arrowhead { fill: var(--muted); }
.bb-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .76rem; color: var(--muted); }
.bb-legend__item { display: inline-flex; align-items: center; gap: .35rem; }
.bb-legend__item i { width: .9rem; height: .55rem; border-radius: 2px; background: var(--bb-c, var(--chart-4)); }
.bb-legend__edge i { height: 2px; background: var(--muted); }
.bb-legend .bb-status--failed i { background: var(--danger); }
.bb-inspector { border: 1px solid var(--line); border-radius: var(--r-md); padding: .7rem .8rem; background: var(--panel); }
.bb-inspector h3 { margin: 0 0 .2rem; font-size: .95rem; }

/* Permissions, simulations, evidence. */
.bb-section h2 { margin-bottom: .5rem; }
.bb-toolgrid { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .3rem .8rem; }
.bb-toolgrid li { display: flex; justify-content: space-between; gap: .5rem; align-items: center; font-size: .82rem; }
.bb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; font-size: .86rem; }
.bb-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.bb .ws-table table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.bb .ws-table th, .bb .ws-table td { text-align: start; padding: .4rem .55rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.bb .ws-table th { color: var(--muted); font-weight: 560; }
.bb .ws-table tr.is-diverged td { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.bb-callout { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--info) 35%, var(--line));
  background: color-mix(in srgb, var(--info) 7%, var(--panel)); font-size: .88rem; }
.bb-callout p { margin: 0 0 .3rem; }
.bb-callout p:last-child { margin: 0; }
.bb-callout svg { flex: 0 0 auto; display: block; height: 1lh; color: var(--info); }
.bb-callout--warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); }
.bb-callout--warn svg { color: var(--warn); }
.bb-callout ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.bb-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .7rem; }
.bb-mode { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; padding: .85rem .95rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.bb-mode h3 { margin: 0; font-size: .98rem; }
.bb-mode p { margin: 0; font-size: .84rem; }
.bb-mode--wide { grid-column: 1 / -1; }
.bb-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .7rem 1rem; width: 100%; }
.bb-form .ws-field { display: flex; flex-direction: column; gap: .3rem; font-size: .84rem; }
.bb-form .ws-check { display: flex; align-items: flex-start; gap: .5rem; font-size: .84rem; }
.bb-form .ws-check input { flex: none; margin: .2rem 0 0; accent-color: var(--accent); }
.bb-tabs { margin-bottom: 0; }
/* What if, and the settings' forms (.bb-card): one kind of choice per group, then one action bar. */
.bb-whatif, .bb-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.bb .bb-whatif, .bb .bb-card { padding: 0; }  /* its parts carry their own padding (not the page's generic section padding) */
@media (max-width: 720px) {
  .bb-groups { padding: .7rem; }
  .bb-whatif__head, .bb-whatif__foot, .bb-card__head, .bb-card__foot { padding-inline: .75rem; }
}
.bb-whatif__head, .bb-card__head { padding: .9rem 1rem .2rem; }
.bb-whatif__head h3, .bb-card__head h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.bb-whatif__head p, .bb-card__head p { margin: 0; font-size: .86rem; max-width: 46rem; }
/* Both columns end on one line: each stretches to the row, and a column's last group takes what is left. */
.bb-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: .75rem; padding: .8rem 1rem 1rem; align-items: stretch; }
.bb-groups__col { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.bb-groups__col > .bb-group:last-child { flex: 1 1 auto; }
.bb-group { margin: 0; min-width: 0; border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: .7rem .85rem .85rem; background: var(--paper);
  display: flex; flex-direction: column; gap: .75rem; }
.bb-group__head { display: flex; flex-direction: column; gap: .15rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line-soft); }
.bb-group__title { margin: 0; font-size: .72rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.bb-group__help { margin: 0; font-size: .8rem; color: var(--muted); }
.bb-field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.bb-field__label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.bb-field__hint { font-size: .74rem; color: var(--dim); }
.bb-field[hidden] { display: none; }
.bb-option { display: flex; align-items: flex-start; gap: .55rem; font-size: .85rem; cursor: pointer; padding: .15rem 0; }
.bb-option input { flex: none; margin: .2rem 0 0; accent-color: var(--accent); }
.bb-option > span { display: flex; flex-direction: column; gap: .05rem; }
.bb-option small { color: var(--muted); font-size: .76rem; }
.bb-toggles { display: flex; flex-wrap: wrap; gap: .35rem; }
.bb-toggle { position: relative; display: inline-flex; align-items: center; padding: .25rem .65rem; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--panel); color: var(--muted); font-size: .82rem; cursor: pointer; }
.bb-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bb-toggle:hover { border-color: var(--line-strong); color: var(--ink); }
.bb-toggle:has(input:checked) { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); color: var(--danger); }
.bb-toggle:has(input:checked)::before { content: "\2715"; margin-right: .35rem; font-size: .7rem; }
.bb-toggle:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.bb-whatif__foot, .bb-card__foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .7rem 1rem;
  border-top: 1px solid var(--line); background: var(--sunken); }
.bb-whatif__summary { font-size: .84rem; color: var(--muted); }
.bb-card__summary { font-size: .84rem; color: var(--muted); flex: 1 1 9rem; min-width: 0; }
.bb-card__foot > :last-child { margin-left: auto; }  /* wrapped under its summary, the action still ends the bar */
.bb-card__actions { display: inline-flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.bb-card__problem { margin: 0; padding: .55rem 1rem .7rem; font-size: .84rem; background: var(--sunken); }
.bb-group[hidden] { display: none; }

.bb-result { display: flex; flex-direction: column; gap: .6rem; }
.bb-result:empty { display: none; }
.bb-result__title { display: flex; align-items: center; gap: .45rem; margin: 0; font-size: 1rem; padding: .5rem .7rem; border-radius: var(--r-sm); background: var(--accent-surface); }
.bb-simsteps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; }
.bb-simsteps li > * + * { margin-left: .4rem; }
.bb-simtext { margin: .3rem 0 0; padding: .5rem .65rem; border-radius: var(--r-sm); background: var(--sunken); white-space: pre-wrap; }
.bb-verdict { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; }
.bb-verdict--ok { color: var(--ok); }
.bb-verdict--bad { color: var(--danger); }
.bb-verdict strong { color: var(--ink); }
.bb-checks { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .25rem; font-size: .84rem; }
.bb-checks li { display: flex; align-items: center; gap: .4rem; }
.bb-checks li svg { display: block; flex: none; }
.bb-checks li.is-ok svg { color: var(--ok); }
.bb-checks li.is-bad { color: var(--danger); }
.bb-checks li.is-warn svg { color: var(--warn); }

/* Findings and settings. */
.bb-findings { display: flex; flex-direction: column; gap: .6rem; }
.bb-finding { padding: .8rem .95rem; border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: var(--r-md); background: var(--panel); display: flex; flex-direction: column; gap: .4rem; }
.bb-finding--bad { border-left-color: var(--danger); }
.bb-finding--warn { border-left-color: var(--warn); }
.bb-finding--info { border-left-color: var(--info); }
.bb-finding header, .bb-finding footer { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; }
.bb-finding p { margin: 0; font-size: .88rem; }
.bb-finding footer { justify-content: space-between; font-size: .82rem; }
.bb-finding__actions { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.bb-finding__triage { display: flex; flex-direction: column; gap: .35rem; }
.bb-finding .bb-finding__triage > p { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.bb-finding__triage svg { flex: none; }
.bb-note { margin: 0; padding: .45rem .7rem; border-left: 3px solid var(--line-strong); border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--sunken);
  font-size: .84rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.bb-triage__what { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .4rem; }
.bb-mark__by { color: var(--muted); }
.bb-setting { align-items: flex-start; padding: .4rem 0; }
.bb-setting > span { display: flex; flex-direction: column; gap: .1rem; }
.bb-setting small { font-size: .8rem; }

/* A phone: the run row stacks, the timeline loses its fixed columns, the detail its indent. */
@media (max-width: 720px) {
  .bb-run__head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title seal" "badges badges" "meta meta"; }
  .bb-run__title { grid-area: title; }
  .bb-run__badges { grid-area: badges; }
  .bb-run__meta { grid-area: meta; flex-direction: row; gap: .6rem; align-items: baseline; }
  .bb-run__seal { grid-area: seal; }
  .bb-run__head > svg:last-child { display: none; }
  .bb-event__head { grid-template-columns: 1.6rem minmax(0, 1fr) auto; }
  .bb-event__time, .bb-event__seq { display: none; }
  .bb-event__tags { grid-column: 2 / -1; justify-content: flex-start; }
  .bb-event__detail { padding-left: .8rem; }
  .bb-attrs { grid-template-columns: minmax(0, 1fr); }
  .bb-attrs dt { margin-top: .3rem; }
}

/* Whose records (an account that let you in), and an invitation to one. */
.bb-records { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.bb-records__label { font-size: .7rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.bb-records select { min-width: 13rem; }
.bb-records__note { font-size: .8rem; line-height: 1.6; color: var(--muted); }
.bb-records__note .ws-tone { vertical-align: 1px; }
.bb .bb-invite { display: flex; gap: .8rem; align-items: flex-start; border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.bb-invite > svg { flex: none; color: var(--accent); display: block; height: 1lh; }
.bb-invite__body { display: flex; flex-direction: column; gap: .5rem; min-width: 0; flex: 1; }
.bb .bb-invite__body h2 { margin: 0; font-size: 1.02rem; font-weight: 640; letter-spacing: -.01em; text-transform: none; color: var(--ink); }
.bb-invite__body p { margin: 0; font-size: .86rem; }
.bb-invite__body .ws-row-actions { margin-top: .2rem; }

/* Live: a run, or the run list, following what's recorded as it happens. */
.bb-slot { display: contents; }
.bb-live { display: inline-flex; align-items: center; gap: .35rem; flex: 0 0 auto; font-size: .7rem; font-weight: 650; line-height: 1.4; padding: .08rem .5rem;
  border-radius: var(--r-pill); color: var(--ok); border: 1px solid color-mix(in srgb, currentColor 45%, transparent); background: color-mix(in srgb, currentColor 9%, transparent); white-space: nowrap; }
.bb-live i { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; animation: bb-pulse 1.6s ease-in-out infinite; }
.bb-live.is-waiting { color: var(--warn); }
.bb-live.is-waiting i { animation: none; }
.bb-live[hidden] { display: none; }
@keyframes bb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.bb-morebar { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem .75rem; }
.bb-morebar > .bb-more { flex: 1 1 auto; min-width: 0; }
.bb-morebar__live { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .4rem; padding-top: .2rem; }
.bb-morebar__live .ws-chip--action[hidden] { display: none; }
.bb-run.is-new .bb-run__head { animation: bb-arrive 1.6s var(--ease-out); }
@keyframes bb-arrive { from { border-color: var(--accent); background: var(--accent-surface); } }
.bb-timeline__none { padding: .5rem .8rem; }
@media (prefers-reduced-motion: reduce) { .bb-live i, .bb-run.is-new .bb-run__head { animation: none; } }

/* Key and value rows: a label column and a value column (one under the other on a phone). */
.bb-kv { display: grid; grid-template-columns: minmax(7.5rem, max-content) minmax(0, 1fr); gap: .35rem 1rem; margin: 0; font-size: .85rem; align-items: baseline; }
.bb-kv dt { color: var(--muted); }
.bb-kv dd { margin: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 0; }

/* Something shown once: a webhook's secret, an invitation link. */
.bb-once { display: flex; flex-direction: column; gap: .5rem; padding: .8rem .95rem; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--warn) 7%, var(--panel)); }
.bb-once:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bb-once__head { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }
.bb-once__head svg { flex: none; color: var(--warn); }
.bb-once__value { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.bb-once__value code { flex: 1 1 auto; min-width: 0; padding: .45rem .6rem; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line);
  font-size: .82rem; overflow-wrap: anywhere; user-select: all; }
.bb-once__note { margin: 0; font-size: .8rem; color: var(--muted); }

/* Rule tuning. */
.bb-rules { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.bb-rule__id { color: var(--dim); }
.bb-rule.is-off .bb-field { opacity: .55; }
.bb-rule .bb-option { font-weight: 600; }
.bb-input[aria-invalid="true"] { border-color: var(--danger); }
.bb-preview { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.bb-preview__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "rule counts" "runs runs" "examples examples"; gap: .3rem 1rem;
  align-items: center; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.bb-preview__row.is-changed { border-left: 3px solid var(--accent); }
.bb-preview__rule { grid-area: rule; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; min-width: 0; }
.bb-preview__counts { grid-area: counts; display: inline-flex; align-items: center; gap: .55rem; }
.bb-preview__count { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; }
.bb-preview__count small { font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.bb-preview__count strong { font-size: 1.05rem; }
.bb-preview__arrow { display: inline-flex; color: var(--dim); }
.bb-preview__runs { grid-area: runs; }
.bb-preview__examples { grid-area: examples; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; font-size: .82rem; }

/* Sinks and their deliveries. */
.bb-sinks { display: flex; flex-direction: column; gap: .7rem; }
.bb-sink { display: flex; flex-direction: column; gap: .6rem; padding: .8rem .95rem; border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--r-md); background: var(--paper); min-width: 0; }
.bb-sink.is-failing { border-left-color: var(--danger); }
.bb-sink.is-paused { border-left-color: var(--muted); }
.bb-sink__head { display: flex; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.bb-sink__icon { display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: var(--r-sm); background: var(--accent-surface); color: var(--accent); }
.bb-sink__title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 12rem; }
.bb-sink__title small { overflow-wrap: anywhere; }
.bb-sink__health { margin: 0; display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .8rem; color: var(--muted); }
.bb-sink__error { margin: 0; display: flex; gap: .4rem; align-items: center; font-size: .82rem; color: var(--danger); overflow-wrap: anywhere; }
.bb-sink__error svg { display: block; flex: none; }
.bb-sink__foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.bb-sink__foot .ws-iconbtn { margin-left: auto; }
.bb-deliveries { border-top: 1px solid var(--line-soft); padding-top: .6rem; }
.bb-deliveries__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.bb-delivery { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .75rem; align-items: center; padding: .45rem .6rem; border-radius: var(--r-sm); background: var(--sunken); }
.bb-delivery__what { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; min-width: 0; }
.bb-delivery__detail, .bb-delivery__error { grid-column: 1; overflow-wrap: anywhere; }
.bb-delivery__error { color: var(--danger); font-size: .78rem; }
.bb-delivery__retry { grid-column: 2; grid-row: 1 / span 3; }
.bb-headers { display: flex; flex-direction: column; gap: .4rem; }
.bb-headers:empty { display: none; }
.bb-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .4rem; align-items: center; }

/* People: who can read this Black Box, and whose you can. */
.bb-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: .86rem; }
.bb-person { display: flex; flex-direction: column; gap: .25rem;
  padding: .6rem .75rem; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--paper); }
.bb-person__top { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.bb-person__top > strong { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.bb-person__note { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.bb-person__dates { font-size: .8rem; }
.bb-person__actions { display: inline-flex; align-items: center; gap: .1rem; }
.bb-person__actions:empty { display: none; }

/* Integrity and keys. */
.bb .bb-keys { padding: 0; }
.bb-keys .bb-group { gap: .6rem; }
.bb-keys .bb-group__help { line-height: 1.45; }
.bb-anchorchecks .bb-checks { margin: 0; }

/* Comparing two runs: a summary, the totals, then both runs' steps side by side (one under the other on a phone). */
@media (min-width: 601px) { .ws-dialog.bb-dialog--wide { width: min(64rem, 94vw); } }
.bb-diffsum { display: flex; gap: 1rem; align-items: center; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--sunken); margin-bottom: .8rem; }
.bb-diffsum__score { display: flex; flex-direction: column; align-items: center; flex: none; min-width: 4.5rem; }
.bb-diffsum__score strong { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.bb-diffsum__score span { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.bb-diffsum__text { display: flex; flex-direction: column; gap: .3rem; min-width: 0; font-size: .88rem; }
.bb-diffsum__text p { margin: 0; }
.bb-diffsum__jump { align-self: flex-start; font-size: .84rem; }
.bb-difftotals { margin: 0 0 .8rem; }
.bb-difftotals table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.bb-difftotals th, .bb-difftotals td { text-align: start; padding: .4rem .55rem; border-bottom: 1px solid var(--line-soft); }
.bb-difftotals th { color: var(--muted); font-weight: 560; }
.bb-difftotals tr.is-diverged td { background: color-mix(in srgb, var(--warn) 10%, transparent); font-weight: 600; }
.bb-diffkey { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .76rem; color: var(--muted); margin-bottom: .6rem; }
.bb-diffkey__item { display: inline-flex; align-items: center; gap: .35rem; }
.bb-diffkey__item i { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: var(--r-xs); font-style: normal; font-weight: 700; background: var(--sunken); color: var(--dim); }
.bb-diff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.bb-diff__heads, .bb-diff__row { display: grid; grid-template-columns: minmax(0, 1fr) 1.6rem minmax(0, 1fr); gap: .4rem; align-items: stretch; }
.bb-diff__heads { margin-bottom: .4rem; }
.bb-diff__head { display: flex; flex-direction: column; gap: .1rem; min-width: 0; padding: .5rem .6rem; border-bottom: 2px solid var(--line); }
.bb-diff__head strong { font-size: .86rem; overflow-wrap: anywhere; }
.bb-diff__label { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.bb-diff__cell { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; min-width: 0; padding: .35rem .55rem; border-radius: var(--r-xs); font-size: .8rem; background: var(--sunken); }
.bb-diff__step { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; min-width: 0; }
.bb-diff__step strong { font-weight: 560; }
.bb-diff__step .bb-mono { color: var(--muted); }
.bb-diff__seq { color: var(--dim); }
.bb-diff__who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }  /* the column heads say it on a desktop */
.bb-diff__none { color: var(--dim); font-size: .78rem; }
.bb-diff__row .bb-diff__cell.is-empty { background: none; border: 1px dashed var(--line); }
.bb-diff__mark { display: grid; place-items: center; font-weight: 700; color: var(--dim); }
.bb-diff__op { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bb-diff__row--replace .bb-diff__cell { background: color-mix(in srgb, var(--diff-mod) 14%, transparent); }
.bb-diff__row--delete .bb-diff__cell:first-child { background: var(--diff-del-bg); }
.bb-diff__row--insert .bb-diff__cell:last-child { background: var(--diff-add-bg); }
.bb-diff__row--replace .bb-diff__mark, .bb-diffkey__item.bb-diff__row--replace i { color: var(--diff-mod); }
.bb-diff__row--delete .bb-diff__mark, .bb-diffkey__item.bb-diff__row--delete i { color: var(--diff-del); }
.bb-diff__row--insert .bb-diff__mark, .bb-diffkey__item.bb-diff__row--insert i { color: var(--diff-add); }
.bb-diffkey__item.bb-diff__row--replace i { background: color-mix(in srgb, var(--diff-mod) 14%, transparent); }
.bb-diffkey__item.bb-diff__row--delete i { background: var(--diff-del-bg); }
.bb-diffkey__item.bb-diff__row--insert i { background: var(--diff-add-bg); }
.bb-diff__row.is-first { outline: 2px solid var(--warn); outline-offset: 2px; border-radius: var(--r-xs); }
.bb-diff__flag { display: inline-flex; align-items: center; gap: .35rem; align-self: flex-start; margin-top: .45rem; padding: .08rem .5rem; border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 650; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.bb-diff__flag:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bb-diff__fold details > summary { cursor: pointer; padding: .35rem .55rem; border-radius: var(--r-xs); font-size: .8rem; color: var(--muted); border: 1px dashed var(--line); }
.bb-diff__fold details[open] > summary { margin-bottom: 3px; }
.bb-diff__fold summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 600px) {
  .bb-diff__heads { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .bb-diff__heads > span { display: none; }
  .bb-diff__row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: .3rem 0 .4rem; border-bottom: 1px solid var(--line-soft); }
  .bb-diff__mark { order: -1; place-items: start; font-size: .7rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
  .bb-diff__row--equal .bb-diff__mark { display: none; }  /* the plain tint says it; the others are named */
  .bb-diff__cell { flex-wrap: nowrap; align-items: baseline; }
  .bb-diff__step { flex: 1 1 0; }
  .bb-diff__sym { display: none; }
  .bb-diff__op { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .bb-diff__who { position: static; width: 4.4rem; height: auto; overflow: visible; clip: auto; flex: none; font-size: .64rem; font-weight: 650; letter-spacing: .06em;
    text-transform: uppercase; color: var(--dim); }
  .bb-diffsum { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .bb-diffsum__score { flex-direction: row; align-items: baseline; gap: .4rem; }
}

/* Comparing: choosing the other run. */
.bb-pick__title { margin: .6rem 0 .4rem; font-size: .72rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.bb-pick { gap: .3rem; }
.bb-pick li { display: block; }
.bb-pick__run { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name badges" "when badges"; gap: .1rem .6rem; align-items: center;
  padding: .5rem .65rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: inherit; font-size: .86rem; text-align: start; cursor: pointer; }
.bb-pick__run:hover { border-color: var(--line-strong); }
.bb-pick__run:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bb-pick__name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-pick__run > small { grid-area: when; }
.bb-pick__run > .bb-run__badges { grid-area: badges; justify-content: flex-end; }
.bb-pick__id { display: flex; align-items: flex-end; gap: .5rem; margin-top: .8rem; }
.bb-pick__id .bb-field { flex: 1 1 auto; }
.bb-pick__id .ws-button { display: inline-flex; align-items: center; gap: .4rem; flex: none; }

@media (max-width: 720px) {
  .bb-kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .bb-kv dd { margin-bottom: .35rem; }

  .bb-preview__row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rule" "counts" "runs" "examples"; }
  .bb-header { grid-template-columns: minmax(0, 1fr) auto; }
  .bb-header input:first-child { grid-column: 1 / -1; }
  .bb-morebar { flex-wrap: wrap; }
  .bb-records select { flex: 1 1 12rem; min-width: 0; }
  .bb-records__note { flex-basis: 100%; margin: 0; }
}

/* The run as a tree (tree.js): each event a rounded card, its colored icon, the run's first event and the steps directly
   inside it set apart; milestones (a task, a model call, a tool asked for and done, a plan made) in heavier type. */
.bb-tree { --ft-elbow: 1.15rem; }
.bb-tree .bb-event__head { border-bottom: 0; }
.bb-tree .bb-event__detail { border-bottom: 0; border-top: 1px solid var(--line-soft); }
.bb-tree .bb-event.is-milestone .bb-event__what strong { font-weight: 650; }
.bb-tree .ws-ftree__item:has(> .bb-event.is-tainted) { border-left: 3px solid color-mix(in srgb, var(--warn) 65%, transparent); }
/* The open findings by severity: a dot in the severity's color, the count and its name. */
.bb-sevcounts { display: flex; flex-wrap: wrap; gap: .15rem .6rem; }
.bb-sevcount { display: inline-flex; align-items: center; gap: .3rem; }
.bb-sevcount > i { display: block; flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
/* The graph at the page's width, its title and legend on one line above it. */
.bb-graphsection { margin: 0; }
.bb-graph { display: block; max-width: none; }
/* An integrity check: a tick or a cross with its name, and what it found. */
.bb-checkfacts dt { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink); font-weight: 600; }
.bb-checkfacts dt svg { display: block; flex: none; }
.bb-checkfacts dt.is-ok svg { color: var(--ok); } .bb-checkfacts dt.is-bad svg { color: var(--danger); }
.bb-checkfacts dd { color: var(--muted); }

/* A call's page (callPage): its parts fold one under another (the one accordion: a chevron on the left, turning as it
   opens), each a card whose row opens it, with what it holds on the right ("86 Events"). */
.bb-folds { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.bb-fold { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.bb-fold > summary { display: flex; align-items: center; gap: .55rem; min-height: 2.9rem; padding: 0 .95rem; border-radius: inherit;
  color: var(--ink); font-size: .92rem; font-weight: 650; }
.bb-fold[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.bb-fold > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (hover: hover) { .bb-fold > summary:hover { background: var(--panel-strong); } }
.bb-fold__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-fold__note { flex: none; color: var(--muted); font-size: .76rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bb-fold__body { display: flex; flex-direction: column; gap: .85rem; min-width: 0; padding: .85rem .95rem 1rem; }
.bb-fold__body > .ws-reqdetail { margin: 0; }
.bb-count { font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* The call whose page this is, in its turn: marked, not a way to itself. */
.bb-fold .ws-callcard.is-current { border-color: color-mix(in srgb, var(--violet, var(--accent)) 55%, var(--line));
  background: color-mix(in srgb, var(--violet, var(--accent)) 7%, var(--panel)); }
/* The graph's legend button alone above it, at its right. */
.bb-graphhead { justify-content: flex-end; }
/* A page of Runs (Findings, Settings): the way back and its name on one line. */
.bb-pagehead { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.bb-pagehead h2 { margin: 0; font-size: 1.05rem; font-weight: 750; letter-spacing: 0; text-transform: none; color: var(--ink); }
.bb-morebar > .ws-iconbtn { flex: none; width: 2rem; height: 2rem; margin-left: -.25rem; }
