/*
 * SPDX-FileCopyrightText: 2026 Hulmane
 * SPDX-License-Identifier: Apache-2.0
 *
 * Open Box shell and component styles that need no React: the top bar, the navigation of pages without React (in the
 * top bar, a bottom bar on phones), buttons, fields, cards, sections, the status badges, the evidence marks (with the
 * strip's tooltip), the fingerprint chip, tables, filter chips, the exchange line, the journey, step rows and the
 * step list, prose (rendered Markdown), the focus ring and utilities. Used by the React kit and, as a file, by the
 * Flask site, the portals hub and the simulator (load tokens.css and fonts.css first; put class="ob-page" on <body>
 * for the base typography). Only var(--...) values.
 */

@layer mantine, openbox;

@layer openbox {
  /* --- base typography for static pages (React pages get it from the Mantine theme) */
  .ob-page {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size-body);
    font-weight: var(--weight-body);
    line-height: var(--line-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  .ob-page *, .ob-page *::before, .ob-page *::after { box-sizing: border-box; }
  .ob-page :where(h1, h2, h3, h4) { margin: 0; font-weight: var(--weight-heading); line-height: var(--line-heading); }
  .ob-page :where(h1) { font-size: var(--font-size-h1); letter-spacing: var(--tracking-heading); }
  .ob-page :where(h2) { font-size: var(--font-size-h2); letter-spacing: var(--tracking-heading); }
  .ob-page :where(h3) { font-size: var(--font-size-h3); }
  .ob-page :where(h4) { font-size: var(--font-size-h4); line-height: var(--line-lead); }
  .ob-page :where(p) { margin: 0 0 var(--space-3); }
  .ob-page :where(a), .ob-link { color: var(--accent); text-underline-offset: 0.15em; }
  .ob-page :where(a:hover), .ob-link:hover { color: var(--accent-hover); }
  .ob-page :where(code, kbd, samp, pre) { font-family: var(--mono); font-size: max(0.92em, var(--font-size-meta)); }
  .ob-page :where(input, button, select, textarea) { font: inherit; }

  /* --- the focus ring, on everything focusable */
  :where(.ob-page, .ob-shell, .ob-scope) :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
  .ob-focus:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: var(--focus);
    border-radius: var(--radius-sm);
  }

  /* --- utilities */
  .ob-visually-hidden {
    position: absolute !important;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .ob-mono { font-family: var(--mono); font-size: max(0.92em, var(--font-size-meta)); overflow-wrap: anywhere; }
  .ob-muted { color: var(--text-muted); }
  .ob-meta { font-size: var(--font-size-meta); color: var(--text-muted); }
  .ob-small { font-size: var(--font-size-label); }
  .ob-eyebrow {
    font-size: var(--font-size-meta);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .ob-measure { max-inline-size: var(--measure); }
  .ob-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .ob-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
  .ob-auto-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
  /* fill for icons drawn from the sprite (<use href="icons.svg#ob-icon-…">); React's icons set it themselves */
  .ob-icon { flex: none; inline-size: var(--icon-md); block-size: var(--icon-md); fill: currentColor; }
  .ob-icon--sm { inline-size: var(--icon-sm); block-size: var(--icon-sm); }
  /* the sprite icons.js puts into the page: out of the flow */
  .ob-icons { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
  .ob-icon--lg { inline-size: var(--icon-lg); block-size: var(--icon-lg); }

  .ob-skip {
    position: fixed;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: 1000;
    padding: var(--space-2) var(--space-4);
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-weight: var(--weight-strong);
    min-block-size: var(--touch-target);
    transform: translateY(-200%);
  }
  .ob-skip:focus { transform: none; }

  /* --- top bar and brand */
  .ob-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    block-size: var(--topbar-height);
    padding-inline: var(--space-4);
    background: var(--surface);
    color: var(--text);
  }
  .ob-page > .ob-topbar { position: sticky; inset-block-start: 0; z-index: 50; border-block-end: 1px solid var(--border); }
  .ob-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-block-size: var(--touch-target);
    color: var(--text);
    text-decoration: none;
    font-weight: var(--weight-strong);
    white-space: nowrap;
  }
  .ob-brand__app {
    color: var(--text-muted);
    font-weight: var(--weight-label);
    padding-inline-start: var(--space-2);
    border-inline-start: 1px solid var(--border);
  }
  .ob-logo-tile {
    display: grid;
    place-items: center;
    flex: none;
    inline-size: var(--size-logo);
    block-size: var(--size-logo);
    border-radius: var(--radius-sm);
    background: var(--brand-gradient);
    color: var(--brand-mark);
  }
  .ob-logo-tile svg { inline-size: var(--icon-md); block-size: var(--icon-md); }
  .ob-topbar__end { display: flex; align-items: center; gap: var(--space-2); margin-inline-start: auto; }
  .ob-env {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--size-badge);
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-meta);
    font-weight: var(--weight-label);
    white-space: nowrap;
    background: var(--warning-bg);
    color: var(--warning);
  }
  .ob-env--info { background: var(--info-bg); color: var(--info); }
  .ob-env--neutral { background: var(--neutral-bg); color: var(--neutral); }
  .ob-env--danger { background: var(--danger-bg); color: var(--danger); }
  .ob-env__short { display: none; }
  .ob-avatar {
    display: grid;
    place-items: center;
    flex: none;
    inline-size: var(--size-avatar);
    block-size: var(--size-avatar);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--font-size-label);
    font-weight: var(--weight-strong);
  }
  .ob-kbd {
    font: var(--weight-label) var(--font-size-meta) var(--mono);
    padding: 0 var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
  }

  /* --- buttons and fields for pages without React (React pages use the Mantine ones, themed the same) */
  .ob-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-block-size: var(--control-height);
    padding: 0 var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: var(--weight-strong) var(--font-size-dense) / 1 var(--font);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
  }
  .ob-btn:hover { background: var(--surface-2); color: var(--text); }
  .ob-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .ob-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
  .ob-btn--quiet { border-color: transparent; background: transparent; }
  .ob-btn--danger { color: var(--danger); border-color: var(--danger); }
  .ob-btn--lg { min-block-size: var(--control-height-lg); padding: 0 var(--space-5); font-size: var(--font-size-body); }
  .ob-btn[disabled], .ob-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
  .ob-field { display: grid; gap: var(--space-1); font-size: var(--font-size-dense); }
  .ob-field > label { font-weight: var(--weight-label); }
  .ob-field :is(input, select, textarea) {
    min-block-size: var(--control-height);
    padding: 0 var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
  }
  .ob-field textarea { padding-block: var(--space-2); min-block-size: calc(var(--control-height) * 2.5); }
  .ob-field__help { font-size: var(--font-size-meta); color: var(--text-muted); }
  .ob-field__error { font-size: var(--font-size-label); color: var(--danger); }
  .ob-field--error :is(input, select, textarea) { border-color: var(--danger); }

  /* --- cards, page header, sections */
  .ob-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
  }
  .ob-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    margin: 0 0 var(--space-1);
    padding: 0;
    list-style: none;
    font-size: var(--font-size-label);
    color: var(--text-muted);
  }
  .ob-crumbs li { display: inline-flex; align-items: center; gap: var(--space-1); }
  .ob-crumbs a { color: inherit; text-decoration: none; }
  .ob-crumbs a:hover { color: var(--accent); text-decoration: underline; }
  .ob-crumbs [aria-current="page"] { color: var(--text); }
  .ob-pagehead { margin-block-end: var(--space-5); }
  .ob-pagehead__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
  .ob-pagehead__text { min-inline-size: 0; flex: 1 1 20rem; }
  .ob-pagehead__title {
    margin: 0;
    font-size: var(--font-size-h1);
    font-weight: var(--weight-heading);
    line-height: var(--line-heading);
    letter-spacing: var(--tracking-heading);
    overflow-wrap: anywhere;
  }
  .ob-pagehead__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
  .ob-oneline { margin: var(--space-1) 0 0; color: var(--text-muted); font-size: var(--font-size-body); max-inline-size: var(--measure); }
  .ob-section + .ob-section { margin-block-start: var(--space-6); }
  .ob-section__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-block-end: var(--space-4); }
  .ob-section__title { margin: 0; font-weight: var(--weight-heading); line-height: var(--line-heading); }
  .ob-section__title--h2 { font-size: var(--font-size-h2); letter-spacing: var(--tracking-heading); }
  .ob-section__title--h3 { font-size: var(--font-size-h3); }
  /* compact: a page of several sections (a dashboard, a record's page) titles them at the size of a card's title */
  .ob-section--compact > .ob-section__head { margin-block-end: var(--space-3); }
  .ob-section--compact .ob-section__title { font-size: var(--font-size-h4); line-height: var(--line-lead); letter-spacing: normal; }
  .ob-section__description { margin: var(--space-1) 0 0; color: var(--text-muted); font-size: var(--font-size-dense); max-inline-size: var(--measure); }

  /* --- status: the word plus the shape */
  .ob-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-block-size: var(--size-badge);
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-label);
    font-weight: var(--weight-label);
    line-height: 1;
    white-space: nowrap;
    background: var(--neutral-bg);
    color: var(--neutral);
  }
  .ob-status--sm { font-size: var(--font-size-meta); }
  .ob-status--success { background: var(--success-bg); color: var(--success); }
  .ob-status--info { background: var(--info-bg); color: var(--info); }
  .ob-status--warning { background: var(--warning-bg); color: var(--warning); }
  .ob-status--danger { background: var(--danger-bg); color: var(--danger); }
  .ob-status__count { font-weight: var(--weight-strong); }
  /* step outcomes without a status word: the check (finished) and the dotted mark (not applicable) */
  .ob-step { display: inline-grid; place-items: center; inline-size: var(--size-badge); block-size: var(--size-badge); vertical-align: middle; }
  .ob-step--done { color: var(--success); }
  .ob-step__dotted { inline-size: var(--icon-sm); block-size: var(--icon-sm); border: 1px dotted var(--neutral); border-radius: var(--radius-pill); }

  /* --- the four evidence marks */
  .ob-marks { display: inline-flex; gap: var(--space-1); border-radius: var(--radius-sm); vertical-align: middle; }
  .ob-marks__hit { display: inline-flex; }
  /* the state is a shape too, never colour alone: a corner badge with a check (proven), a clock (outstanding) or a
     cross (refused); not applicable has no badge and a dotted outline */
  .ob-mark {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    inline-size: var(--size-mark);
    block-size: var(--size-mark);
    border-radius: var(--radius-sm);
    background: var(--neutral-bg);
    color: var(--neutral);
  }
  .ob-mark > .ob-icon, .ob-mark > svg { inline-size: var(--icon-sm); block-size: var(--icon-sm); }
  .ob-mark__state {
    position: absolute;
    inset-block-end: calc(var(--space-1) / -2);
    inset-inline-end: calc(var(--space-1) / -2);
    display: grid;
    place-items: center;
    inline-size: calc(var(--space-2) + var(--space-1) / 2);
    block-size: calc(var(--space-2) + var(--space-1) / 2);
    border-radius: var(--radius-pill);
    background: currentColor;
    box-shadow: 0 0 0 1px var(--surface);
  }
  .ob-mark__state svg { inline-size: var(--space-2); block-size: var(--space-2); fill: none; stroke: var(--surface); }
  .ob-mark--proven { background: var(--success-bg); color: var(--success); }
  .ob-mark--outstanding { background: var(--warning-bg); color: var(--warning); }
  .ob-mark--refused { background: var(--danger-bg); color: var(--danger); }
  .ob-mark--na { background: transparent; border: 1px dotted var(--neutral); color: var(--neutral); }
  .ob-marks-tip { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-1); }
  /* the strip's tooltip on pages without React: <span class="ob-marks" tabindex="0" role="img" aria-label="…"> holds
     the four marks and <span class="ob-marks__tip" aria-hidden="true"><ul class="ob-marks-tip">…</ul></span>,
     shown on hover and on focus, as the React strip's tooltip looks */
  .ob-marks:has(> .ob-marks__tip) { position: relative; }
  .ob-marks__tip {
    display: none;
    position: absolute;
    z-index: 20;
    inset-block-start: calc(100% + var(--space-2));
    inset-inline-start: 0;
    inline-size: max-content;
    max-inline-size: min(var(--tooltip-width), calc(100vw - var(--space-6)));
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--surface);
    font-size: var(--font-size-label);
    font-weight: var(--weight-body);
    line-height: var(--line-lead);
    white-space: normal;
    text-align: start;
  }
  .ob-marks:is(:hover, :focus-visible) > .ob-marks__tip { display: block; }
  .ob-marks-labelled {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .ob-marks-labelled__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }
  .ob-marks-labelled__item b { display: block; font-size: var(--font-size-dense); }
  .ob-marks-labelled__detail { display: block; font-size: var(--font-size-meta); color: var(--text-muted); }

  /* --- fingerprint chip */
  .ob-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-inline-size: 100%;
    min-block-size: var(--size-badge);
    padding: 0 var(--space-1) 0 var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--font-size-meta);
    font-weight: var(--weight-label);
    vertical-align: middle;
  }
  .ob-chip__value {
    position: relative;
    min-inline-size: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
  }
  .ob-chip.is-expanded .ob-chip__value { white-space: normal; overflow-wrap: anywhere; }
  .ob-chip__copy {
    display: grid;
    place-items: center;
    flex: none;
    inline-size: var(--size-count);
    block-size: var(--size-count);
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--accent);
    cursor: pointer;
  }
  .ob-chip__copy:hover { background: var(--surface); }
  .ob-chip__full { font-family: var(--mono); overflow-wrap: anywhere; }

  /* --- key-value list and technical details */
  .ob-kv { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; font-size: var(--font-size-label); }
  .ob-kv__row { display: contents; }
  .ob-kv dt { color: var(--text-muted); }
  .ob-kv dd { margin: 0; min-inline-size: 0; overflow-wrap: anywhere; }
  .ob-kv dd.ob-mono { font-size: var(--font-size-meta); }
  .ob-details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: var(--font-size-dense);
  }
  .ob-details > summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-block-size: var(--control-height);
    padding: 0 var(--space-3);
    cursor: pointer;
    font-weight: var(--weight-label);
    list-style: none;
  }
  .ob-details > summary::-webkit-details-marker { display: none; }
  .ob-details > summary::before {
    content: "";
    inline-size: var(--space-2);
    block-size: var(--space-2);
    border-inline-end: 2px solid currentColor;
    border-block-end: 2px solid currentColor;
    transform: rotate(-45deg);
    flex: none;
  }
  .ob-details[open] > summary::before { transform: rotate(45deg); }
  .ob-details__body { padding: 0 var(--space-3) var(--space-3); }

  /* --- stat tile and meter */
  .ob-tile {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-inline-size: 0;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
  }
  .ob-tile--link:hover { border-color: var(--accent); color: var(--text); }
  .ob-tile__num { font-size: var(--font-size-h2); font-weight: var(--weight-strong); line-height: var(--line-heading); letter-spacing: var(--tracking-heading); font-variant-numeric: tabular-nums; }
  .ob-tile__word { font-size: var(--font-size-label); color: var(--text-muted); }
  .ob-tile__trend { font-size: var(--font-size-meta); color: var(--text-muted); }
  /* a second line under the word: where the number comes from, what it includes */
  .ob-tile__detail { font-size: var(--font-size-meta); color: var(--text-muted); }
  .ob-tile__trend--good { color: var(--success); }
  .ob-tile__trend--bad { color: var(--danger); }
  .ob-tile--success .ob-tile__num { color: var(--success); }
  .ob-tile--warning .ob-tile__num { color: var(--warning); }
  .ob-tile--danger .ob-tile__num { color: var(--danger); }
  .ob-tile--info .ob-tile__num { color: var(--info); }
  .ob-tile__chart { margin-block-start: var(--space-2); }
  .ob-meter { display: grid; gap: var(--space-1); font-size: var(--font-size-label); }
  .ob-meter__labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); }
  .ob-meter__value { color: var(--text-muted); }
  .ob-meter__track { block-size: var(--space-2); border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
  .ob-meter__fill { display: block; block-size: 100%; border-radius: inherit; background: var(--accent); }
  .ob-meter--success .ob-meter__fill { background: var(--success); }
  .ob-meter--warning .ob-meter__fill { background: var(--warning); }
  .ob-meter--danger .ob-meter__fill { background: var(--danger); }
  .ob-meter--info .ob-meter__fill { background: var(--info); }

  /* --- tables (static pages; React pages use the data grid) */
  .ob-table { inline-size: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--font-size-label); }
  .ob-table th {
    position: sticky;
    inset-block-start: 0;
    block-size: var(--control-height);
    padding: 0 var(--space-3);
    background: var(--surface-2);
    border-block-end: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--font-size-meta);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    text-align: start;
    white-space: nowrap;
  }
  .ob-table td { block-size: var(--row-height); padding: 0 var(--space-3); border-block-end: 1px solid var(--border); }
  .ob-table tbody tr:hover td { background: var(--surface-2); }
  .ob-table tr.is-selected td { background: var(--accent-soft); }

  /* --- filter chips */
  .ob-fchip {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--control-height);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    font-size: var(--font-size-label);
  }
  .ob-fchip > span, .ob-fchip > button:first-child { padding: 0 var(--space-3); }
  .ob-fchip button {
    align-self: stretch;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    border-radius: var(--radius-pill);
    cursor: pointer;
  }
  .ob-fchip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .ob-fchip__remove { display: grid; place-items: center; padding: 0 var(--space-2) 0 0; }
  .ob-fchip > button:first-child { display: inline-flex; align-items: center; gap: var(--space-2); }
  .ob-fchip__count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .ob-fchip.is-on .ob-fchip__count { color: inherit; }
  /* chips under a heading (Phase, Status): one labelled group each */
  .ob-chipgroups { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); }
  .ob-chipgroup { display: grid; gap: var(--space-2); min-inline-size: 0; }
  .ob-chipgroup__label {
    font-size: var(--font-size-meta);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .ob-chipgroup__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

  /* --- the exchange line: partners, Manti, systems */
  .ob-exchange { margin: 0; container-type: inline-size; border-radius: var(--radius); }
  .ob-exchange--ink { background: var(--ink); color: var(--ink-text); padding: var(--space-5); }
  .ob-exchange--surface { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: var(--space-4); }
  .ob-exchange__grid { display: grid; grid-template-columns: 1fr auto 1.1fr auto 1fr; gap: var(--space-3); align-items: stretch; }
  .ob-exchange__node {
    min-inline-size: 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--ink-border);
    border-radius: var(--radius-sm);
    background: var(--ink-raised);
  }
  .ob-exchange__node > b { display: block; font-size: var(--font-size-body); font-weight: var(--weight-strong); }
  .ob-exchange__node > span { display: block; margin-block-start: var(--space-1); font-size: var(--font-size-label); color: var(--ink-muted); overflow-wrap: anywhere; }
  .ob-exchange__node--manti { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
  .ob-exchange__node--manti > span { color: var(--text-muted); }
  /* facts under a node (ids, addresses): a key-value list, readable on either tone */
  .ob-exchange__details { display: grid; gap: var(--space-2); margin-block-start: var(--space-3); padding-block-start: var(--space-3); border-block-start: 1px solid var(--ink-border); font-size: var(--font-size-label); }
  .ob-exchange__details .ob-kv dt { color: var(--ink-muted); }
  .ob-exchange__details .ob-kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ob-exchange__details .ob-kv__row + .ob-kv__row dt { margin-block-start: var(--space-2); }
  .ob-exchange__node--manti .ob-exchange__state { color: var(--text); font-weight: var(--weight-label); }
  .ob-exchange__arrow {
    display: grid;
    place-items: center;
    align-content: center;
    gap: var(--space-1);
    text-align: center;
    font-size: var(--font-size-label);
    color: var(--ink-muted);
  }
  .ob-exchange__arrow .ob-icon { inline-size: calc(var(--icon-lg) + var(--space-1)); block-size: calc(var(--icon-lg) + var(--space-1)); color: var(--ink-accent); }
  .ob-exchange__arrow b { color: var(--ink-text); font-weight: var(--weight-strong); }
  .ob-exchange--surface .ob-exchange__node { border-color: var(--border); background: var(--surface-2); }
  .ob-exchange--surface .ob-exchange__node > span, .ob-exchange--surface .ob-exchange__details .ob-kv dt { color: var(--text-muted); }
  .ob-exchange--surface .ob-exchange__details { border-block-start-color: var(--border); }
  .ob-exchange--surface .ob-exchange__node--manti { background: var(--accent-soft); border-color: var(--accent); }
  .ob-exchange--surface .ob-exchange__arrow { color: var(--text-muted); }
  .ob-exchange--surface .ob-exchange__arrow .ob-icon { color: var(--accent); }
  .ob-exchange--surface .ob-exchange__arrow b { color: var(--text); }
  @container (max-width: 760px) {
    .ob-exchange__grid { grid-template-columns: 1fr; }
    .ob-exchange__arrow { display: flex; flex-wrap: wrap; justify-content: center; column-gap: var(--space-2); }
    .ob-exchange__arrow .ob-icon { transform: rotate(90deg); }
  }

  /* --- the journey: units of work as a tree */
  .ob-journey { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .ob-journey--nested { margin-block-start: var(--space-2); margin-inline-start: var(--space-4); }
  .ob-journey--nested > .ob-journey__item { position: relative; padding-inline-start: var(--space-5); }
  .ob-journey--nested > .ob-journey__item::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: calc(-1 * var(--space-2));
    inset-block-end: 0;
    border-inline-start: 1px solid var(--border-strong);
  }
  .ob-journey--nested > .ob-journey__item:last-child::before {
    inset-block-end: auto;
    block-size: calc(var(--space-2) + var(--touch-target) / 2);
    inline-size: var(--space-4);
    border-block-end: 1px solid var(--border-strong);
    border-end-start-radius: var(--radius-sm);
  }
  .ob-journey--nested > .ob-journey__item:not(:last-child)::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: calc(var(--touch-target) / 2);
    inline-size: var(--space-4);
    border-block-start: 1px solid var(--border-strong);
  }
  .ob-journey__unit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-2) 0 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }
  .ob-journey__unit.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .ob-journey__name { font-size: var(--font-size-dense); }
  .ob-journey__svc { font-family: var(--mono); font-size: var(--font-size-meta); font-weight: var(--weight-label); color: var(--text-muted); }
  .ob-journey__facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-inline-start: auto; font-size: var(--font-size-meta); color: var(--text-muted); }

  /* --- step rows */
  /* the rows become cards when their own box is narrow (a phone, a tablet, a card beside other content), not only on
     phones, so the table never has to scroll sideways */
  .ob-steps-wrap { position: relative; overflow-x: auto; container: ob-steps / inline-size; }
  .ob-steps { inline-size: 100%; border-collapse: collapse; font-size: var(--font-size-label); }
  .ob-steps th {
    padding: var(--space-2) var(--space-3);
    border-block-end: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--font-size-meta);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    text-align: start;
    white-space: nowrap;
  }
  .ob-steps td { padding: var(--space-2) var(--space-3); border-block-end: 1px solid var(--border); vertical-align: top; }
  .ob-steps td.ob-mono { font-size: var(--font-size-meta); color: var(--text-muted); white-space: nowrap; }
  /* long tokens (hashes, checksums, URIs) break anywhere so they never push Payload and Next out of view */
  .ob-steps__what { min-inline-size: 14rem; overflow-wrap: anywhere; }
  .ob-steps__took { white-space: nowrap; }
  .ob-steps td.ob-steps__next { white-space: normal; overflow-wrap: anywhere; min-inline-size: 8rem; }

  @container ob-steps (max-width: 767.98px) {
    .ob-steps, .ob-steps tbody, .ob-steps tr, .ob-steps td { display: block; }
    .ob-steps thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .ob-steps tr { padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-block-end: var(--space-2); }
    .ob-steps td { display: grid; grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); gap: var(--space-2); padding: var(--space-1) 0; border: 0; }
    .ob-steps td::before { content: attr(data-label); color: var(--text-muted); font-family: var(--font); font-size: var(--font-size-meta); }
    .ob-steps td > * { justify-self: start; max-inline-size: 100%; }
    .ob-steps td:is(.ob-steps__what, .ob-steps__next) { min-inline-size: 0; }
    .ob-steps td.ob-mono { white-space: normal; }
  }

  /* --- the step list: steps that have only an outcome, a name and what happened (a send, a connectivity test), in
     rows while their box is wide enough and stacked when it is narrow; <ol class="ob-steplist"> of
     <li class="ob-steplist__row"> with __state (StepStatus), __name and __what */
  .ob-steplist-wrap { container: ob-steplist / inline-size; }
  .ob-steplist { margin: 0; padding: 0; list-style: none; font-size: var(--font-size-label); }
  .ob-steplist__row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-1) var(--space-3);
    padding-block: var(--space-2);
    border-block-end: 1px solid var(--border);
  }
  .ob-steplist__row:last-child { border-block-end: 0; }
  .ob-steplist__state { display: flex; align-items: center; min-block-size: var(--size-badge); }
  .ob-steplist__name { font-weight: var(--weight-label); }
  .ob-steplist__name .ob-mono { font-weight: var(--weight-body); }
  .ob-steplist__what { grid-column: 1 / -1; min-inline-size: 0; overflow-wrap: anywhere; color: var(--text); }
  @container ob-steplist (min-width: 36rem) {
    .ob-steplist__row { grid-template-columns: 7rem minmax(0, 12rem) minmax(0, 1fr); align-items: start; }
    .ob-steplist__what { grid-column: auto; }
  }

  /* --- prose: rendered Markdown (articles, documents, drafts) on the type scale, the text at the reading measure;
     tables may use the whole column and scroll sideways in <div class="ob-prose__table"> (a bare table scrolls by
     itself); ob-prose--lead sets the text at the lead size, for long reads */
  .ob-prose { color: var(--text); font-size: var(--font-size-body); line-height: var(--line-body); overflow-wrap: break-word; }
  .ob-prose--lead { font-size: var(--font-size-lead); }
  .ob-prose > :first-child { margin-block-start: 0; }
  .ob-prose > :last-child { margin-block-end: 0; }
  .ob-prose > :is(p, ul, ol, dl, blockquote, h1, h2, h3, h4, h5, h6) { max-inline-size: var(--measure); }
  .ob-prose :is(h1, h2, h3, h4, h5, h6) { font-weight: var(--weight-heading); line-height: var(--line-heading); text-wrap: pretty; }
  .ob-prose h1 { margin: var(--space-6) 0 var(--space-3); font-size: var(--font-size-h2); letter-spacing: var(--tracking-heading); }
  .ob-prose h2 { margin: var(--space-7) 0 var(--space-3); font-size: var(--font-size-h3); }
  .ob-prose h3 { margin: var(--space-6) 0 var(--space-2); font-size: var(--font-size-h4); font-weight: var(--weight-strong); line-height: var(--line-lead); }
  .ob-prose :is(h4, h5, h6) { margin: var(--space-5) 0 var(--space-2); font-size: var(--font-size-body); font-weight: var(--weight-strong); line-height: var(--line-body); }
  .ob-prose p { margin: 0 0 var(--space-4); }
  .ob-prose :is(ul, ol) { margin: 0 0 var(--space-4); padding-inline-start: var(--space-5); }
  .ob-prose li + li { margin-block-start: var(--space-1); }
  .ob-prose li > :is(ul, ol) { margin: var(--space-1) 0 0; }
  .ob-prose strong { font-weight: var(--weight-strong); }
  .ob-prose a { color: var(--accent); text-underline-offset: 0.15em; }
  .ob-prose a:hover { color: var(--accent-hover); }
  .ob-prose :is(code, kbd, samp) { font-family: var(--mono); font-size: max(0.92em, var(--font-size-meta)); }
  .ob-prose :not(pre) > code { padding: 0 var(--space-1); border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; }
  .ob-prose pre {
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--ink-text);
    font-family: var(--mono);
    font-size: var(--font-size-label);
    line-height: var(--line-body);
    /* long lines wrap: a block that scrolled sideways would need a focus stop of its own */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .ob-prose pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
  .ob-prose blockquote { margin: 0 0 var(--space-4); padding: var(--space-1) var(--space-4); border-inline-start: calc(var(--space-1) / 2) solid var(--accent); color: var(--text-muted); }
  .ob-prose blockquote > :last-child { margin-block-end: 0; }
  .ob-prose hr { margin: var(--space-6) 0; border: 0; border-block-start: 1px solid var(--border); }
  .ob-prose img { max-inline-size: 100%; block-size: auto; border-radius: var(--radius-sm); }
  .ob-prose__table { margin: 0 0 var(--space-5); overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .ob-prose > table { display: block; margin: 0 0 var(--space-5); overflow-x: auto; }
  .ob-prose__table:focus-visible { outline: 1px solid transparent; box-shadow: var(--focus-inset); }
  /* a frame that scrolls sideways is a focus stop (React's Prose makes it one): never taller than the space between
     the bars, so it can be read while focused */
  .ob-prose__table[tabindex] { max-block-size: calc(100dvh - var(--app-shell-header-offset, 0px) - var(--app-shell-footer-offset, 0px) - var(--space-6)); overflow: auto; }
  .ob-prose__table :is(th, td) { min-inline-size: 8rem; }
  /* whole words in a table: a crowded table scrolls sideways rather than splitting words */
  .ob-prose table { inline-size: 100%; border-collapse: collapse; font-size: var(--font-size-label); line-height: var(--line-lead); overflow-wrap: normal; }
  .ob-prose :is(th, td) { padding: var(--space-2) var(--space-3); border-block-end: 1px solid var(--border); text-align: start; vertical-align: top; }
  .ob-prose th { background: var(--surface-2); color: var(--text); font-weight: var(--weight-strong); }
  .ob-prose tbody tr:last-child td { border-block-end: 0; }

  /* --- navigation for pages without React: a few links in the top bar from 768 px, the bottom bar on phones (as the
     React shell's): <nav class="ob-topnav" aria-label="…"> of <a class="ob-topnav__item"> with an icon and a <span>
     label; the current page has aria-current="page" */
  .ob-topnav { display: flex; align-items: center; gap: var(--space-1); margin-inline-start: var(--space-4); }
  .ob-topnav__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-block-size: var(--control-height);
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: var(--font-size-dense);
    font-weight: var(--weight-label);
    text-decoration: none;
  }
  .ob-topnav__item:hover { color: var(--text); background: var(--surface-2); }
  .ob-topnav__item[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

  /* --- narrow screens */
  @media (max-width: 767.98px) {
    .ob-topbar { gap: var(--space-2); }
    /* the long label stays for assistive technology; the short one is what shows */
    .ob-env__long { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .ob-env__short { display: inline; }
    .ob-pagehead__title { font-size: var(--font-size-h2); }
    .ob-pagehead__actions { inline-size: 100%; }
    .ob-pagehead__actions > :last-child { flex: 1; }
    .ob-btn, .ob-field :is(input, select), .ob-fchip button { min-block-size: var(--touch-target); }
    .ob-crumbs a { display: inline-flex; align-items: center; justify-content: center; min-block-size: var(--touch-target); min-inline-size: var(--touch-target); }
    /* the fingerprint chip's value and copy button as 44 px targets, without changing the line's height */
    .ob-chip__copy { inline-size: var(--touch-target); block-size: var(--touch-target); margin-block: calc((var(--size-badge) - var(--touch-target)) / 2); }
    .ob-chip__value { min-block-size: var(--touch-target); }
    /* the strip's tooltip opens in place under the marks: a phone has no room beside them */
    .ob-marks:has(> .ob-marks__tip):is(:hover, :focus-visible) { flex-wrap: wrap; margin-block-end: 0; }
    .ob-marks__tip { position: static; flex: 1 0 100%; inline-size: auto; max-inline-size: 100%; margin-block-start: var(--space-1); }
    /* a 44 px target around the 22 px marks, without changing the row's height */
    .ob-marks[tabindex] { padding-block: calc((var(--touch-target) - var(--size-mark)) / 2); margin-block: calc((var(--size-mark) - var(--touch-target)) / 2); }
    .ob-field :is(input, select, textarea) { font-size: var(--font-size-body); }
    .ob-details > summary { min-block-size: var(--touch-target); }
    /* the top bar's links become the bottom bar; the page keeps room for it and focus scrolling clears it */
    html:has(.ob-topnav) { scroll-padding-block-end: calc(var(--bottom-bar-height) + var(--space-2)); }
    .ob-page:has(.ob-topnav) { padding-block-end: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom)); }
    .ob-topnav {
      position: fixed;
      inset-inline: 0;
      inset-block-end: 0;
      z-index: 50;
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: minmax(0, 1fr);
      gap: 0;
      block-size: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom));
      margin: 0;
      padding-block-end: env(safe-area-inset-bottom);
      border-block-start: 1px solid var(--border);
      background: var(--surface);
    }
    .ob-topnav__item {
      flex-direction: column;
      justify-content: center;
      gap: calc(var(--space-1) / 2);
      block-size: 100%;
      min-block-size: var(--touch-target);
      padding: 0 var(--space-1);
      border-radius: 0;
      font-size: var(--font-size-meta);
    }
    .ob-topnav__item > span { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ob-topnav__item[aria-current="page"] { background: transparent; }
    /* on a phone the columns share the width; only a table with many columns scrolls sideways */
    .ob-prose :is(th, td) { padding-inline: var(--space-2); }
    .ob-prose__table :is(th, td) { min-inline-size: 0; }
    .ob-kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .ob-kv dt { margin-block-start: var(--space-2); }
    .ob-journey__facts { margin-inline-start: 0; inline-size: 100%; }
    /* deep journeys keep room for the unit on a phone: half the indent per level */
    .ob-journey--nested { margin-inline-start: var(--space-2); }
    .ob-journey--nested > .ob-journey__item { padding-inline-start: var(--space-3); }
    .ob-journey--nested > .ob-journey__item:not(:last-child)::after, .ob-journey--nested > .ob-journey__item:last-child::before { inline-size: var(--space-3); }
  }
  @media (min-width: 768px) { .ob-topbar { padding-inline: var(--space-5); } }

  @media (prefers-reduced-motion: no-preference) {
    .ob-btn, .ob-tile, .ob-fchip, .ob-chip__copy, .ob-topnav__item { transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease); }
    .ob-skip { transition: transform var(--duration-fast) var(--ease); }
  }
}
