/* Bioneex demo surface — the design system extracted from the Oct 2026 demo
   snapshots. Tokens then primitives. Loaded after common.css (resets, nav
   chrome) and before each page's own css (overrides). Every value is from
   plans/design/bioneex-demo/design_system.md, sampled from the screenshots.

   Scoped to `body.bx-surface` so it never touches the operator pages. One brand
   hue (navy); semantic colour only where a word is a status. Chip inks are the
   app's AAA inks on the mock's grounds — same hue, 7:1 kept. */

body.bx-surface {
  /* neutrals */
  --s-bg: #f4f6f9;
  --s-surface: #ffffff;
  --s-well: #f3f5f8;
  --s-border: #e3e7ee;
  --s-ink: #0f172a;
  --s-text: #1e293b;
  --s-muted: #475569;

  /* brand */
  --s-navy: #1a2e8a;
  --s-navy-deep: #122686;
  --s-navy-tint: #eef2fd;
  --s-navy-tint-2: #f5f7fe;
  --s-on-navy: #ffffff;

  /* "Evaluate" entry button only: it points at the evaluation path. */
  --s-eval: #047857;
  --s-eval-2: #10b981;
  --s-eval-rgb: 4, 120, 87;

  /* semantic: ink / ground (ink is the app's AAA token) */
  --s-ok: #0b5f3b;        --s-ok-bg: #e3f4ea;
  --s-warn: #7a4100;      --s-warn-bg: #fdf1e4;  --s-warn-edge: #fde7c3;
  --s-risk: #7a3a05;
  --s-err: #8f1d1d;       --s-err-bg: #fbe9e7;
  --s-source: #fde7c3;    /* highlighted source term */
  --s-change: #fff6d6;    /* text added in a report v2 */

  /* shape + depth */
  --s-r-lg: 12px;
  --s-r-md: 8px;
  --s-r-sm: 6px;
  --s-r-chip: 4px;
  --s-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.06);
  --s-shadow-btn: 0 1px 2px rgba(18, 38, 134, 0.24);

  --s-gutter: 2rem;
  --s-content: 69rem;   /* ≈ 1104px */
  --s-mono: "IBM Plex Mono", ui-monospace, monospace;

  background: var(--s-bg);
  color: var(--s-text);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

body.bx-surface :focus-visible {
  outline: 2px solid var(--s-navy);
  outline-offset: 2px;
}

/* ── Top bar ──────────────────────────────────────────────────────────────
   White, 1px rule. The wordmark and the role menu are rendered into
   `.site-nav` by auth.js, and nothing else sits in the bar on the prototype's
   screens: it stays the same everywhere. What belongs to one page, its
   breadcrumb and stepper, is in `.bx-pagebar`, in the page. auth.js fills it
   only once the session has answered, so its height is held from the start:
   otherwise the page drawn under it jumps down when the menu arrives. */
body.bx-surface .bx-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.3125rem;
  padding: 0.6rem 1.25rem;
  background: var(--s-surface);
  border-bottom: 1px solid var(--s-border);
}
body.bx-surface .bx-topbar .site-nav {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 0;
}
body.bx-surface .bx-pagebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: var(--s-content);
  margin: 0 auto;
  padding: 1rem var(--s-gutter) 0;
}
body.bx-surface .bx-pagebar + .bx-page { padding-top: 1.25rem; }
body.bx-surface .bx-crumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
  color: var(--s-muted);
}
body.bx-surface .bx-crumb a { color: var(--s-muted); text-decoration: none; }
body.bx-surface .bx-crumb a:hover { text-decoration: underline; }
body.bx-surface .bx-crumb .bx-crumb-here { color: var(--s-ink); font-weight: 600; }
body.bx-surface .bx-crumb-sep { color: var(--s-border); }

/* ── Stepper ──────────────────────────────────────────────────────────────*/
body.bx-surface .bx-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
body.bx-surface .bx-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--s-muted);
}
body.bx-surface .bx-step-num {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--s-border);
  color: var(--s-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}
body.bx-surface .bx-step.is-active { color: var(--s-ink); font-weight: 600; }
body.bx-surface .bx-step.is-active .bx-step-num { background: var(--s-navy); color: var(--s-on-navy); }
body.bx-surface .bx-step.is-done .bx-step-num { background: var(--s-ok-bg); color: var(--s-ok); }
body.bx-surface .bx-step-rule { width: 1.5rem; height: 1px; background: var(--s-border); }
body.bx-surface a.bx-step { text-decoration: none; }
body.bx-surface a.bx-step:hover { color: var(--s-navy); text-decoration: underline; text-underline-offset: 0.2em; }

/* ── Page frame ───────────────────────────────────────────────────────────*/
body.bx-surface .bx-page {
  max-width: var(--s-content);
  margin: 0 auto;
  padding: 1.75rem var(--s-gutter) 3rem;
}
body.bx-surface .bx-eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--s-muted);
}
body.bx-surface .bx-title { font-size: 1.5rem; font-weight: 700; color: var(--s-ink); margin: 0.35rem 0 0; }
body.bx-surface .bx-title.is-display { font-size: 2.5rem; line-height: 1.1; letter-spacing: -0.01em; }
body.bx-surface .bx-lede { font-size: 0.9375rem; color: var(--s-muted); margin: 0.4rem 0 0; }

body.bx-surface .bx-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; align-items: start; }
body.bx-surface .bx-grid-3 { display: grid; grid-template-columns: 210px 1fr 220px; gap: 1.25rem; align-items: start; }

/* ── Cards + wells ────────────────────────────────────────────────────────*/
body.bx-surface .bx-card {
  background: var(--s-surface);
  border: 1px solid var(--s-border);
  border-radius: var(--s-r-md);
  padding: 1.25rem 1.4rem;
}
body.bx-surface .bx-card.is-lg { border-radius: var(--s-r-lg); box-shadow: var(--s-shadow-card); }
body.bx-surface .bx-well { background: var(--s-well); border-radius: var(--s-r-md); padding: 1rem 1.15rem; }
body.bx-surface .bx-rail-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--s-muted);
  margin: 0 0 0.5rem;
}
body.bx-surface .bx-card + .bx-card,
body.bx-surface .bx-rail > * + * { margin-top: 1rem; }

/* ── Chips ────────────────────────────────────────────────────────────────
   Pale ground, dark ink of the same hue. No border, matching the mock. */
body.bx-surface .bx-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--s-r-chip);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--s-navy-tint);
  color: var(--s-navy);
  white-space: nowrap;
}
body.bx-surface .bx-chip.is-ok { background: var(--s-ok-bg); color: var(--s-ok); }
body.bx-surface .bx-chip.is-warn { background: var(--s-warn-bg); color: var(--s-warn); }
body.bx-surface .bx-chip.is-err { background: var(--s-err-bg); color: var(--s-err); }
body.bx-surface .bx-chip.is-muted { background: var(--s-well); color: var(--s-muted); }
body.bx-surface .bx-chip.is-solid { background: var(--s-ink); color: var(--s-on-navy); }
body.bx-surface .bx-chip.is-outline { background: transparent; color: var(--s-navy); box-shadow: inset 0 0 0 1px var(--s-navy); }
body.bx-surface .bx-chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────*/
body.bx-surface .bx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  min-height: 2.5rem;
  border-radius: var(--s-r-sm);
  border: 1px solid var(--s-border);
  background: var(--s-surface);
  color: var(--s-text);
  font-size: 0.9375rem;
  font-weight: 600;
}
body.bx-surface .bx-btn:hover { border-color: var(--s-navy); color: var(--s-navy); }
body.bx-surface .bx-btn.is-primary {
  background: var(--s-navy);
  border-color: var(--s-navy);
  color: var(--s-on-navy);
  box-shadow: var(--s-shadow-btn);
}
body.bx-surface .bx-btn.is-primary:hover { background: var(--s-navy-deep); border-color: var(--s-navy-deep); color: var(--s-on-navy); }
body.bx-surface .bx-btn.is-ghost { border-color: transparent; background: transparent; }
body.bx-surface .bx-btn.is-eval { background: var(--s-eval); border-color: var(--s-eval); color: var(--s-on-navy); box-shadow: 0 1px 2px rgba(var(--s-eval-rgb), 0.3); }
body.bx-surface .bx-btn.is-eval:hover { background: #065f46; border-color: #065f46; color: var(--s-on-navy); }
body.bx-surface .bx-btn.is-block { width: 100%; }
body.bx-surface .bx-btn:disabled { opacity: 0.55; }

/* Segmented toggle (Quick/Deep, Table/Cards/Map, Decision-maker/Analyst) */
body.bx-surface .bx-seg { display: inline-flex; background: var(--s-well); border-radius: var(--s-r-sm); padding: 2px; }
body.bx-surface .bx-seg button {
  border: 0;
  background: transparent;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--s-muted);
}
body.bx-surface .bx-seg button.is-on { background: var(--s-ink); color: var(--s-on-navy); }

/* ── Option pills (in-chat) ───────────────────────────────────────────────*/
body.bx-surface .bx-options { margin: 0.6rem 0 0; }
body.bx-surface .bx-options-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--s-muted);
  margin: 0.5rem 0 0.35rem;
}
body.bx-surface .bx-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.4rem 0.4rem 0;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--s-border);
  background: var(--s-surface);
  color: var(--s-text);
  font-size: 0.875rem;
  font-weight: 600;
}
body.bx-surface .bx-opt:hover { border-color: var(--s-navy); color: var(--s-navy); }
body.bx-surface .bx-opt.is-on { background: var(--s-navy); border-color: var(--s-navy); color: var(--s-on-navy); }
body.bx-surface .bx-opt[disabled] { opacity: 0.55; }
body.bx-surface .bx-options.is-answered { opacity: 0.85; }

/* ── Bars (score, funnel, progress) ───────────────────────────────────────*/
body.bx-surface .bx-bar { height: 6px; border-radius: 999px; background: var(--s-border); overflow: hidden; }
body.bx-surface .bx-bar-fill { height: 100%; background: var(--s-navy); border-radius: 999px; }
body.bx-surface .bx-score { font-size: 1.75rem; font-weight: 700; color: var(--s-navy); line-height: 1; }

/* ── Tables ───────────────────────────────────────────────────────────────*/
body.bx-surface .bx-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
body.bx-surface .bx-table th {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--s-muted);
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--s-border);
}
body.bx-surface .bx-table td { padding: 0.75rem; border-bottom: 1px solid var(--s-border); vertical-align: top; }
body.bx-surface .bx-table tr.is-selected { background: var(--s-navy-tint-2); }
body.bx-surface .bx-table tr.is-excluded { opacity: 0.5; }
body.bx-surface .bx-cell-strong { font-weight: 600; color: var(--s-ink); }

/* status matrix cell marks */
body.bx-surface .bx-mark { font-weight: 700; }
body.bx-surface .bx-mark.is-ok { color: var(--s-ok); }
body.bx-surface .bx-mark.is-err { color: var(--s-err); }
body.bx-surface .bx-mark.is-warn { color: var(--s-warn); }
body.bx-surface .bx-mark.is-none { color: var(--s-muted); }

/* ── Conversation ─────────────────────────────────────────────────────────*/
body.bx-surface .bx-convo { display: flex; flex-direction: column; gap: 1.1rem; }
body.bx-surface .bx-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8125rem;
  color: var(--s-muted);
}
body.bx-surface .bx-divider::before,
body.bx-surface .bx-divider::after { content: ""; flex: 1; height: 1px; background: var(--s-border); }
body.bx-surface .bx-msg { display: flex; gap: 0.7rem; }
body.bx-surface .bx-avatar {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 5px;
  background: var(--s-navy);
  color: var(--s-on-navy);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.625rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}
body.bx-surface .bx-msg-body { font-size: 0.9375rem; line-height: 1.55; }
/* The analyst's avatar: the two circles of the Bioneex mark (site/favicon.svg), in the avatar's text colour.
   The "AI" stays in the markup for screen readers. */
body.bx-surface .bx-avatar.is-ai { position: relative; font-size: 0; }
body.bx-surface .bx-avatar.is-ai::before {
  content: "";
  position: absolute;
  inset: 13%;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60' fill='none' stroke='black' stroke-width='5'%3E%3Ccircle cx='24' cy='17.75' r='12.75'/%3E%3Ccircle cx='30' cy='37' r='18.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60' fill='none' stroke='black' stroke-width='5'%3E%3Ccircle cx='24' cy='17.75' r='12.75'/%3E%3Ccircle cx='30' cy='37' r='18.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.bx-surface .bx-msg-body strong { color: var(--s-ink); }
body.bx-surface .bx-say + .bx-added { margin-top: 0.6rem; }
/* A notice is a sentence: its [n] stays inline. */
body.bx-surface .bx-notice {
  display: block;
  background: var(--s-warn-bg);
  border: 1px solid var(--s-warn-edge);
  color: var(--s-warn);
  padding: 0.5rem 0.7rem;
  border-radius: var(--s-r-sm);
  font-size: 0.875rem;
  margin-bottom: 0.6rem;
}
body.bx-surface .bx-msg-body .bx-suggest { margin-top: 0.6rem; }
body.bx-surface .bx-progress {
  margin-top: 0.6rem;
  color: var(--s-muted);
  font-family: var(--s-mono);
  font-size: 0.8125rem;
}
body.bx-surface .bx-bubble-user {
  align-self: flex-end;
  max-width: 80%;
  background: var(--s-navy-tint);
  color: var(--s-text);
  padding: 0.7rem 0.95rem;
  border-radius: var(--s-r-md);
  font-size: 0.9375rem;
}
body.bx-surface .bx-added { color: var(--s-ok); font-size: 0.875rem; margin-top: 0.4rem; }
body.bx-surface .bx-added .bx-chip { margin-left: 0.3rem; }

/* progress message */
body.bx-surface .bx-progress { font-size: 0.875rem; }
body.bx-surface .bx-progress-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
body.bx-surface .bx-progress-actions button {
  border: 0;
  background: none;
  color: var(--s-navy);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  padding: 0;
}

/* composer */
body.bx-surface .bx-composer { display: flex; gap: 0.6rem; align-items: flex-end; border-top: 1px solid var(--s-border); padding-top: 0.9rem; }
body.bx-surface .bx-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--s-border);
  border-radius: var(--s-r-sm);
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* played conversation (shared/convo_player.js) */
body.bx-surface .bx-convo > .is-new { animation: bx-turn-in 0.25s ease-out; }
@keyframes bx-turn-in { from { opacity: 0; transform: translateY(0.35rem); } to { opacity: 1; transform: none; } }
body.bx-surface .bx-typing .bx-msg-body { display: flex; align-items: center; gap: 0.6rem; color: var(--s-muted); font-size: 0.875rem; }
body.bx-surface .bx-dots { display: inline-flex; gap: 0.25rem; padding: 0.45rem 0; }
body.bx-surface .bx-dots i { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--s-muted); opacity: 0.35; animation: bx-dot 1s infinite; }
body.bx-surface .bx-dots i:nth-child(2) { animation-delay: 0.15s; }
body.bx-surface .bx-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bx-dot { 0%, 100% { opacity: 0.25; } 40% { opacity: 0.9; } }
body.bx-surface .bx-opt.is-suggested:not(.is-on) { border-color: var(--s-navy); color: var(--s-navy); border-style: dashed; }
body.bx-surface .bx-opt.is-on[disabled] { opacity: 1; }
body.bx-surface .bx-reply-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; margin-bottom: 0.6rem; }
body.bx-surface .bx-reply-suggest[hidden] { display: none; }
body.bx-surface .bx-reply-label { font-family: var(--s-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-muted); }
body.bx-surface .bx-reply-pick {
  text-align: left;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--s-navy);
  background: var(--s-navy-tint-2);
  border: 1px dashed var(--s-navy);
  border-radius: var(--s-r-md);
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}
body.bx-surface .bx-reply-pick:hover { background: var(--s-navy-tint); }
body.bx-surface .bx-reply-pick:disabled { opacity: 0.5; cursor: default; }
body.bx-surface .bx-convo-restart { margin-top: 0.6rem; font-size: 0.8125rem; color: var(--s-muted); }
body.bx-surface .bx-convo-restart button { border: 0; background: none; padding: 0; font: inherit; color: var(--s-navy); font-weight: 600; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
body.bx-surface form.bx-composer { border: 1px solid var(--s-border); border-radius: var(--s-r-md); padding: 0.5rem; background: var(--s-surface); align-items: center; }
body.bx-surface .bx-composer input[type="text"] { flex: 1; min-width: 0; border: 0; font: inherit; font-size: 0.9375rem; padding: 0.4rem 0.5rem; color: var(--s-text); background: transparent; }
body.bx-surface .bx-composer input[type="text"]:focus { outline: none; }
body.bx-surface .bx-fill-in { animation: bx-turn-in 0.35s ease-out; }

/* the conversation's frame (Components.convoFrame) */
body.bx-surface .bx-frame { display: flex; flex-direction: column; min-width: 0; min-height: 34rem; padding: 0; border-radius: var(--s-r-lg); box-shadow: var(--s-shadow-card); }
body.bx-surface .bx-frame-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--s-border); }
body.bx-surface .bx-frame-head strong { color: var(--s-ink); }
body.bx-surface .bx-frame-context, body.bx-surface .bx-frame-context a { font-size: 0.8125rem; color: var(--s-muted); text-decoration: none; }
body.bx-surface .bx-frame-context a:hover { color: var(--s-navy); text-decoration: underline; }
body.bx-surface .bx-frame-body { flex: 1; padding: 1.25rem; }
body.bx-surface .bx-frame-foot { padding: 0.9rem 1.25rem; border-top: 1px solid var(--s-border); }
body.bx-surface .bx-apply { display: flex; width: fit-content; margin-top: 0.35rem; }

/* citation */
body.bx-surface .bx-cite { color: var(--s-navy); font-weight: 600; text-decoration: none; }
body.bx-surface .bx-cite:hover { text-decoration: underline; }
body.bx-surface mark.bx-hl { background: var(--s-source); color: var(--s-ink); padding: 0 0.1em; border-radius: 2px; }

/* ── Report typography ────────────────────────────────────────────────────*/
body.bx-surface .bx-report { background: var(--s-surface); border: 1px solid var(--s-border); border-radius: var(--s-r-lg); box-shadow: var(--s-shadow-card); padding: 2rem 2.25rem; }
body.bx-surface .bx-report-title { font-family: "IBM Plex Serif", Georgia, serif; font-weight: 600; font-size: 1.875rem; color: var(--s-ink); margin: 0.4rem 0 0.3rem; }
body.bx-surface .bx-report-meta { font-size: 0.875rem; color: var(--s-muted); }
body.bx-surface .bx-report-h2 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--s-ink);
  margin: 2rem 0 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--s-border);
  display: flex;
  gap: 0.6rem;
}
body.bx-surface .bx-report-h2 .bx-report-n { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.75rem; color: var(--s-muted); align-self: center; }
body.bx-surface .bx-summary-box { background: var(--s-navy-tint-2); border-radius: var(--s-r-md); padding: 1.1rem 1.25rem; }
body.bx-surface .bx-summary-box .bx-rule { border: 0; border-top: 1px solid var(--s-border); margin: 0.9rem 0; }
body.bx-surface .bx-live-dot { color: var(--s-ok); font-weight: 600; }
body.bx-surface .bx-live-dot::before { content: "\25CF"; margin-right: 0.35rem; }
body.bx-surface del { color: var(--s-err); }
body.bx-surface ins { background: var(--s-change); text-decoration: none; }

/* download rail radio cards */
body.bx-surface .bx-radio-card { display: flex; gap: 0.7rem; align-items: flex-start; border: 1px solid var(--s-border); border-radius: var(--s-r-sm); padding: 0.75rem 0.9rem; cursor: pointer; }
body.bx-surface .bx-radio-card.is-on { border-color: var(--s-navy); box-shadow: inset 0 0 0 1px var(--s-navy); }
body.bx-surface .bx-radio-card + .bx-radio-card { margin-top: 0.5rem; }
body.bx-surface .bx-stamp { border: 1px dashed var(--s-border); border-radius: var(--s-r-sm); padding: 0.6rem 0.75rem; font-size: 0.75rem; letter-spacing: 0.04em; color: var(--s-muted); margin-top: 0.7rem; }

/* versions rail + source list (shared report pieces) */
body.bx-surface .bx-version { padding: 0.55rem 0; border-top: 1px solid var(--s-border); font-size: 0.875rem; }
body.bx-surface .bx-version:first-of-type { border-top: 0; }
body.bx-surface .bx-version .bx-chip { margin-left: 0.3rem; }
body.bx-surface .bx-sources { display: flex; flex-direction: column; gap: 0.4rem; }
body.bx-surface .bx-source { font-size: 0.875rem; color: var(--s-text); scroll-margin-top: 5rem; }
body.bx-surface .bx-source:target { background: var(--s-change); border-radius: 3px; }

/* ── Skeleton (deep search pending) ───────────────────────────────────────*/
body.bx-surface .bx-skel { height: 0.7rem; border-radius: 999px; background: linear-gradient(90deg, var(--s-well), var(--s-border), var(--s-well)); background-size: 200% 100%; animation: bx-shimmer 1.4s infinite; }
body.bx-surface .bx-skel + .bx-skel { margin-top: 0.5rem; }
@keyframes bx-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Toast ────────────────────────────────────────────────────────────────*/
body.bx-surface .bx-toast-host { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; z-index: 1100; }
body.bx-surface .bx-toast {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--s-ink);
  color: var(--s-on-navy);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--s-shadow-card);
  animation: bx-toast-in 0.15s ease-out;
}
body.bx-surface .bx-toast-action { border: 0; background: none; padding: 0; font: inherit; color: #a9bbff; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
@keyframes bx-toast-in { from { opacity: 0; transform: translateY(0.4rem); } to { opacity: 1; transform: none; } }

/* a button at work (Demo.busy) */
body.bx-surface .bx-spin { width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: bx-spin 0.7s linear infinite; }
@keyframes bx-spin { to { transform: rotate(360deg); } }

/* ── Notification bell (shared/demo_shell.js) ─────────────────────────────*/
body.bx-surface .bx-bell { position: relative; display: inline-flex; margin-left: auto; }
body.bx-surface .site-nav:has(.nav-user-menu) .bx-bell { margin-left: 0.6rem; }
body.bx-surface .site-nav:has(.bx-bell) .nav-user { margin-left: 0.6rem; }
body.bx-surface .bx-bell-btn { position: relative; display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 999px; background: transparent; color: var(--s-muted); cursor: pointer; }
body.bx-surface .bx-bell-btn:hover, body.bx-surface .bx-bell-btn[aria-expanded="true"] { background: var(--s-well); color: var(--s-ink); }
body.bx-surface .bx-bell-count { position: absolute; top: 0.05rem; right: 0.05rem; min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 999px; background: #c2410c; color: #fff; font-size: 0.625rem; font-weight: 700; line-height: 1rem; text-align: center; }
body.bx-surface .bx-bell-count[hidden] { display: none; }
body.bx-surface .bx-bell-panel { position: absolute; top: calc(100% + 0.4rem); right: -3rem; width: min(23rem, calc(100vw - 2rem)); background: var(--s-surface); border: 1px solid var(--s-border); border-radius: var(--s-r-md); box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16); z-index: 900; overflow: hidden; }
body.bx-surface .bx-bell-panel[hidden] { display: none; }
body.bx-surface .bx-bell-head { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--s-border); font-size: 0.875rem; color: var(--s-ink); }
body.bx-surface .bx-bell-clear { border: 0; background: none; padding: 0; font: inherit; font-size: 0.8125rem; color: var(--s-navy); font-weight: 600; cursor: pointer; }
body.bx-surface .bx-bell-list { max-height: 24rem; overflow-y: auto; }
body.bx-surface .site-nav a.bx-note { display: flex; gap: 0.6rem; padding: 0.75rem 0.9rem; border-radius: 0; color: var(--s-text); text-decoration: none; border-bottom: 1px solid var(--s-border); }
body.bx-surface .site-nav a.bx-note:last-child { border-bottom: 0; }
body.bx-surface .site-nav a.bx-note:hover { background: var(--s-navy-tint-2); }
body.bx-surface .bx-note-dot { flex: none; width: 0.5rem; height: 0.5rem; margin-top: 0.4rem; border-radius: 50%; background: transparent; }
body.bx-surface .bx-note.is-unread .bx-note-dot { background: var(--s-navy); }
body.bx-surface .bx-note-text { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.8125rem; line-height: 1.4; }
body.bx-surface .bx-note-title { font-weight: 600; color: var(--s-ink); font-size: 0.875rem; }
body.bx-surface .bx-note.is-unread .bx-note-title::after { content: " \00b7 new"; color: var(--s-navy); font-weight: 600; font-size: 0.75rem; }
body.bx-surface .bx-note-meta { color: var(--s-muted); font-size: 0.75rem; }
body.bx-surface .bx-note-empty { margin: 0; padding: 1.25rem 0.9rem; color: var(--s-muted); font-size: 0.875rem; }
body.bx-surface .site-nav a.bx-bell-settings { display: block; padding: 0.6rem 0.9rem; border-top: 1px solid var(--s-border); border-radius: 0; font-size: 0.8125rem; font-weight: 600; color: var(--s-navy); }
body.bx-surface .site-nav a.bx-bell-settings:hover { background: var(--s-navy-tint-2); color: var(--s-navy); }

/* The avatar menu's Account link, and a company's name where the screens mention it. */
body.bx-surface .site-nav a.nav-user-account { display: block; }
body.bx-surface .bx-owner-link { color: inherit; text-decoration: underline; text-decoration-color: #94a3b8; text-underline-offset: 0.18em; }
body.bx-surface .bx-owner-link:hover { color: var(--s-navy); text-decoration-color: currentColor; }

/* ── Side panel: a source, or a short scripted chat ───────────────────────*/
body.bx-surface .bx-panel-layer { position: fixed; inset: 0; z-index: 1000; }
body.bx-surface .bx-scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.28); animation: bx-fade 0.15s ease-out; }
body.bx-surface .bx-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(31rem, 100vw);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--s-surface);
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.14);
  overflow-y: auto;
  animation: bx-slide-in 0.2s ease-out;
}
@keyframes bx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bx-slide-in { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
body.bx-surface .bx-panel-close { position: absolute; top: 0.8rem; right: 0.9rem; width: 2rem; height: 2rem; border: 0; border-radius: 999px; background: transparent; color: var(--s-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
body.bx-surface .bx-panel-close:hover { background: var(--s-well); color: var(--s-ink); }
body.bx-surface .bx-panel-head { display: flex; align-items: flex-start; gap: 0.6rem; padding-right: 2.2rem; }
body.bx-surface .bx-panel-head h2 { margin: 0; font-size: 1.0625rem; line-height: 1.35; color: var(--s-ink); }
body.bx-surface .bx-panel-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
body.bx-surface .bx-src-n { flex: none; font-family: var(--s-mono); font-weight: 600; color: var(--s-navy); font-size: 0.875rem; margin-top: 0.1rem; }
body.bx-surface .bx-src-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--s-muted); }
body.bx-surface .bx-src-doc { background: var(--s-well); border: 1px solid var(--s-border); border-radius: var(--s-r-md); padding: 0.9rem 1rem; font-family: "IBM Plex Serif", Georgia, serif; font-size: 0.9375rem; line-height: 1.6; color: var(--s-text); }
body.bx-surface .bx-src-doc p { margin: 0 0 0.6rem; }
body.bx-surface .bx-src-doc p:last-child { margin-bottom: 0; }
body.bx-surface .bx-src-loc { font-family: var(--s-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-muted); margin-bottom: 0.6rem; }
body.bx-surface .bx-src-hint { margin: -0.4rem 0 0; font-size: 0.75rem; color: var(--s-muted); }
body.bx-surface .bx-src-hint::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.35rem; vertical-align: -0.05rem; border-radius: 2px; background: var(--s-source); }
body.bx-surface .bx-src-note { margin: 0; font-size: 0.875rem; color: var(--s-muted); }
body.bx-surface .bx-panel.is-chat { padding-bottom: 1rem; }
body.bx-surface .bx-chat-about { margin: -0.3rem 0 0; font-size: 0.8125rem; color: var(--s-muted); }
body.bx-surface .bx-chat-log { flex: 1; overflow-y: auto; padding-right: 0.25rem; }
body.bx-surface .bx-chat-foot { display: flex; flex-direction: column; gap: 0.6rem; }
body.bx-surface .bx-chat-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
body.bx-surface .bx-chat-chip { border: 1px dashed var(--s-navy); background: var(--s-navy-tint-2); color: var(--s-navy); border-radius: 999px; padding: 0.35rem 0.75rem; font: inherit; font-size: 0.8125rem; font-weight: 600; text-align: left; cursor: pointer; }
body.bx-surface .bx-chat-chip:hover { background: var(--s-navy-tint); }
body.bx-surface .bx-chat-chips:empty { display: none; }

/* ── Responsive: rails wrap under the main column ─────────────────────────*/
@media (max-width: 70rem) {
  body.bx-surface .bx-grid,
  body.bx-surface .bx-grid-3 { grid-template-columns: 1fr; }
}

/* ── Workspace lists (My Searches, Watchlist, Reports) ────────────────────*/
body.bx-surface .ws-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
body.bx-surface .ws-head .bx-lede { max-width: 40rem; }
body.bx-surface .ws-card { padding: 0.4rem 1.4rem 0.6rem; }
body.bx-surface .ws-card + .ws-card { margin-top: 1.25rem; }
body.bx-surface .ws-card-head { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.8rem 0 0.6rem; border-bottom: 1px solid var(--s-border); }
body.bx-surface .ws-card-head h2 { margin: 0; font-size: 1rem; color: var(--s-ink); }
body.bx-surface .ws-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem 1.5rem; padding: 1rem 0; border-top: 1px solid var(--s-border); }
body.bx-surface .ws-card-head + .ws-row { border-top: 0; }
body.bx-surface .ws-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
body.bx-surface .ws-title { align-self: flex-start; border: 0; background: none; padding: 0; font: inherit; font-size: 1rem; font-weight: 600; color: var(--s-ink); text-align: left; text-decoration: none; cursor: pointer; }
body.bx-surface .ws-title:hover { color: var(--s-navy); text-decoration: underline; text-underline-offset: 0.18em; }
body.bx-surface .ws-title.is-plain { font-weight: 500; }
body.bx-surface .ws-sub { font-size: 0.875rem; color: var(--s-muted); overflow-wrap: anywhere; }
body.bx-surface .ws-meta { font-size: 0.8125rem; color: var(--s-muted); }
body.bx-surface .ws-side { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; flex: none; }
body.bx-surface .ws-side .bx-btn { min-height: 2.1rem; padding: 0.35rem 0.75rem; font-size: 0.875rem; }
body.bx-surface .ws-alert { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; color: var(--s-muted); }
body.bx-surface .ws-alert select { font: inherit; font-size: 0.8125rem; padding: 0.3rem 0.4rem; border: 1px solid var(--s-border); border-radius: var(--s-r-sm); background: var(--s-surface); color: var(--s-text); }
body.bx-surface .ws-remove { color: var(--s-muted); font-weight: 500; }
body.bx-surface .ws-empty { margin: 0; padding: 1.25rem 0; color: var(--s-muted); }
@media (max-width: 48rem) {
  body.bx-surface .ws-row { flex-direction: column; }
  body.bx-surface .ws-side { justify-content: flex-start; }
}
body.bx-surface .bx-source-meta { color: var(--s-muted); font-size: 0.8125rem; }
body.bx-surface .bx-scorebar-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.3rem; font-size: 0.9375rem; }
body.bx-surface .bx-scorebar-head strong { color: var(--s-ink); }
body.bx-surface .bx-scorebar-src { margin-top: 0.3rem; font-size: 0.875rem; color: var(--s-muted); }

/* ── Narrow screens: the top bar wraps instead of pushing the page sideways ─*/
@media (max-width: 48rem) {
  body.bx-surface .bx-topbar { flex-wrap: wrap; row-gap: 0.4rem; padding: 0.5rem 0.75rem; }
  body.bx-surface .bx-topbar .site-nav { flex: 1 0 100%; min-width: 0; flex-wrap: wrap; row-gap: 0.3rem; }
  body.bx-surface .bx-topbar .site-nav .nav-logo { padding-right: 0.4rem; }
  body.bx-surface .bx-topbar .site-nav .nav-logo img { width: 80px; height: 16px; }
  body.bx-surface .bx-topbar .site-nav .nav-sep { display: none; }
  body.bx-surface .bx-topbar .site-nav .nav-user-menu a { padding: 0.25rem 0.35rem; font-size: 0.875rem; }
  body.bx-surface .bx-topbar > :not(.site-nav) { min-width: 0; max-width: 100%; }
  body.bx-surface .bx-stepper { flex-wrap: wrap; row-gap: 0.3rem; }
  body.bx-surface .bx-crumb { flex-wrap: wrap; }
  body.bx-surface .bx-page, body.bx-surface .bx-pagebar { padding-left: 1rem; padding-right: 1rem; }
}
@media (max-width: 40rem) {
  body.bx-surface .bx-topbar:not(:has(.sr-topquery)) .nav-user-menu { order: 3; flex-basis: 100%; margin-left: 0; }
  body.bx-surface .bx-topbar:not(:has(.sr-topquery)) .bx-bell { order: 2; margin-left: auto; }
  body.bx-surface .bx-topbar:not(:has(.sr-topquery)) .nav-user { order: 2; margin-left: 0.6rem; }
}
body.bx-surface .bx-topbar .site-nav a { white-space: nowrap; }
body.bx-surface .site-nav a.bx-note { white-space: normal; }

/* -- Tabs: what a search has open, under the top bar ------------------------- */
body.bx-surface .bx-tabs {
  position: sticky;
  top: var(--bx-bar-h, 0px);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  padding: 0.4rem 1.25rem 0;
  background: #e3e7ee;
}
body.bx-surface:has(.bx-tabs) { --bx-chrome-h: calc(var(--bx-bar-h, 0px) + var(--bx-tabs-h, 0px)); }
body.bx-surface .bx-topbar:has(+ .bx-tabs) { position: sticky; top: 0; z-index: 41; }
body.bx-surface .bx-tabs-switch { position: relative; flex: none; padding-bottom: 0.3rem; }
body.bx-surface .bx-tabs-search { display: flex; align-items: center; gap: 0.3rem; max-width: 15rem; padding: 0.25rem 0.5rem; border: 0; border-radius: var(--s-r-sm); background: none; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--s-ink); cursor: pointer; }
body.bx-surface .bx-tabs-search:hover, body.bx-surface .bx-tabs-search[aria-expanded="true"] { background: rgba(255, 255, 255, 0.6); }
body.bx-surface .bx-tabs-search-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.bx-surface .bx-tabs-caret { flex: none; color: var(--s-muted); }
body.bx-surface .bx-tabs-row { flex: 1; display: flex; min-width: 0; gap: 0.15rem; overflow-x: auto; scrollbar-width: none; }
body.bx-surface .bx-tabs-row::-webkit-scrollbar { display: none; }
body.bx-surface .bx-tab { flex: none; display: flex; align-items: center; max-width: 15rem; border-radius: 10px 10px 0 0; color: var(--s-muted); }
body.bx-surface .bx-tab:hover { background: rgba(255, 255, 255, 0.5); color: var(--s-ink); }
body.bx-surface .bx-tab.is-active { background: var(--s-bg); color: var(--s-ink); font-weight: 600; }
body.bx-surface .bx-tab-link { display: flex; align-items: center; gap: 0.45rem; min-width: 0; padding: 0.5rem 0.75rem; font-size: 0.8125rem; color: inherit; text-decoration: none; }
body.bx-surface .bx-tab-link:has(+ .bx-tab-x) { padding-right: 0.25rem; }
body.bx-surface .bx-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.bx-surface .bx-tab-icon { flex: none; }
body.bx-surface .bx-tab-x { flex: none; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-right: 0.4rem; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--s-muted); cursor: pointer; }
body.bx-surface .bx-tab-x:hover { background: rgba(15, 23, 42, 0.1); color: var(--s-ink); }
body.bx-surface .bx-tab-spin { flex: none; width: 12px; height: 12px; border: 2px solid rgba(26, 46, 138, 0.2); border-top-color: var(--s-navy); border-radius: 50%; animation: bx-tab-spin 0.9s linear infinite; }
@keyframes bx-tab-spin { to { transform: rotate(360deg); } }
body.bx-surface .bx-tabs-all { position: relative; flex: none; padding-bottom: 0.3rem; }
body.bx-surface .bx-tabs-all-btn { padding: 0.25rem 0.6rem; border: 0; border-radius: var(--s-r-sm); background: none; font: inherit; font-size: 0.8125rem; color: var(--s-navy); font-weight: 600; cursor: pointer; }
body.bx-surface .bx-tabs-all-btn:hover { background: rgba(255, 255, 255, 0.6); }
body.bx-surface .bx-tabs-menu { position: absolute; top: 100%; right: 0; z-index: 900; min-width: 16rem; padding: 0.35rem; background: var(--s-surface); border: 1px solid var(--s-border); border-radius: var(--s-r-md); box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16); }
body.bx-surface .bx-tabs-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.55rem; border-radius: var(--s-r-sm); font-size: 0.875rem; color: var(--s-text); text-decoration: none; }
body.bx-surface .bx-tabs-item:hover { background: var(--s-navy-tint-2); }
body.bx-surface .bx-tabs-closed { margin-left: auto; font-size: 0.75rem; color: var(--s-muted); }
body.bx-surface .bx-tabs-menu.is-searches { left: 0; right: auto; width: 24rem; max-width: calc(100vw - 2rem); }
body.bx-surface .bx-tabs-picks { max-height: 18rem; overflow-y: auto; scrollbar-width: thin; }
body.bx-surface .bx-tabs-pick-text { display: flex; flex-direction: column; min-width: 0; }
body.bx-surface .bx-tabs-pick-name { font-weight: 600; color: var(--s-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.bx-surface .bx-tabs-pick-meta { font-size: 0.75rem; color: var(--s-muted); }
body.bx-surface .bx-tabs-tick { flex: none; margin-left: auto; color: var(--s-navy); }
body.bx-surface .bx-tabs-every { display: block; margin-top: 0.35rem; padding: 0.55rem; border-top: 1px solid var(--s-border); font-size: 0.875rem; font-weight: 600; color: var(--s-navy); text-decoration: none; }
body.bx-surface .bx-tabs-every:hover { text-decoration: underline; text-underline-offset: 0.18em; }
@media (max-width: 48rem) {
  body.bx-surface:has(.bx-tabs) { --bx-chrome-h: var(--bx-tabs-h, 0px); }
  body.bx-surface .bx-topbar:has(+ .bx-tabs) { position: static; }
  body.bx-surface .bx-tabs { top: 0; }
}
@media (max-width: 40rem) {
  body.bx-surface .bx-tabs { padding-left: 0.75rem; padding-right: 0.75rem; gap: 0.5rem; }
  body.bx-surface .bx-tabs-switch { display: none; }
}

/* -- A chat tab fills the window under the tabs: the conversation scrolls in its
   own column, with the box to type in at the foot of it; the sidebar holds the
   progress and the report's button at the top, and the cards under them scroll
   apart. On a narrow screen these stack and the page scrolls. -- */
body.bx-surface .bx-pagebar > .ad-pager { margin-left: auto; }
body.bx-surface .bx-msg { position: relative; }
body.bx-surface .bx-msg-link { flex: none; align-self: flex-start; margin-left: auto; padding: 0 0.25rem; font-size: 0.875rem; font-weight: 600; color: var(--s-muted); text-decoration: none; opacity: 0; }
body.bx-surface .bx-msg:hover .bx-msg-link, body.bx-surface .bx-msg-link:focus { opacity: 1; }
body.bx-surface .bx-msg-link:hover { color: var(--s-navy); }
body.bx-surface.is-chat .bx-rail-cards > div:empty { display: none; }
body.bx-surface.is-chat .bx-rail-cards { display: flex; flex-direction: column; gap: 1rem; }
body.bx-surface.is-chat .bx-frame { min-height: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
body.bx-surface.is-chat .bx-frame-head { padding: 0 0 1rem; border-bottom: 0; }
body.bx-surface.is-chat .bx-frame-body { padding: 0; }
body.bx-surface.is-chat .bx-frame-foot { position: sticky; bottom: 0; z-index: 20; padding: 1rem 0; border-top: 0; background: linear-gradient(to bottom, transparent, var(--s-bg) 1rem); }
body.bx-surface.is-chat .bx-msg { scroll-margin-top: calc(var(--bx-chrome-h, 0px) + 0.75rem); }
body.bx-surface .bx-chat-progress .bx-stepper { flex-direction: column; align-items: flex-start; gap: 0; margin-top: 0.6rem; flex-wrap: nowrap; }
body.bx-surface .bx-chat-progress .bx-step-rule { width: 1px; height: 0.5rem; margin-left: 0.7rem; }
body.bx-surface .bx-chat-progress #next { margin-top: 0.9rem; }
body.bx-surface .bx-chat-progress .bx-btn:disabled { background: var(--s-well); border-color: var(--s-border); color: var(--s-muted); opacity: 1; cursor: not-allowed; }
/* -- The frame every screen shares (`is-app` on the body) ----------------------
   Width: the header, the tabs and the content all use the same edges. They fill
   the window with a small margin, up to 1,600 pixels, then stay in the middle.
   Scrolling: the window never scrolls. A page is one to three columns
   (`bx-cols`), and each column (`bx-col`) scrolls on its own, with its scrollbar
   beside it. A page of one column scrolls as `main`. The right column
   (`bx-col-side`) has one width and holds cards.
   Surfaces: the centre is white, the side columns are grey, and the right
   column holds white cards. Nothing on the page has a shadow; only what floats
   above it does.
   Narrow windows stack the columns and the page scrolls. -- */
body.bx-surface.is-app {
  --bx-edge: max(1.5rem, calc((100% - 100rem) / 2 + 1.5rem));
  --bx-side: 23rem;
  --bx-bar: 0.625rem;   /* the width of a thin scrollbar: the side column's sits in the margin */
  --s-bg: var(--s-surface);
  --bx-side-grey: #f4f6f9;
}
body.bx-surface.is-app .bx-card.is-lg { border-radius: var(--s-r-md); box-shadow: none; }
body.bx-surface.is-app .bx-report, body.bx-surface.is-app .bx-btn { box-shadow: none; }
body.bx-surface.is-app :is(.bx-report, .bx-sheet) { border: 0; border-radius: 0; }
body.bx-surface .bx-sheet { padding: 2.5rem 3rem; background: var(--s-surface); border: 1px solid var(--s-border); border-radius: var(--s-r-lg); }
body.bx-surface.is-app .bx-col-side .bx-card + .bx-card { margin-top: 0; }
@media (max-width: 72rem) {
  body.bx-surface .bx-sheet { padding: 1.5rem; }
}
@media (max-width: 48rem) {
  body.bx-surface .bx-sheet { padding: 1.25rem 1rem; }
}
@media (min-width: 72.0625rem) {
  body.bx-surface.is-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
  body.bx-surface.is-app:has(.bx-cols) { background: linear-gradient(to right, var(--s-surface) calc(100% - var(--bx-edge) - var(--bx-side) - 0.75rem), var(--bx-side-grey) 0); }
  body.bx-surface.is-app:has(.bx-cols.has-left) { background: linear-gradient(to right, var(--bx-side-grey) calc(var(--bx-edge) + var(--bx-left)), var(--s-surface) 0 calc(100% - var(--bx-edge) - var(--bx-side) - 0.75rem), var(--bx-side-grey) 0); }
  body.bx-surface.is-app:has(.sx-res) { --bx-left: 15rem; }
  body.bx-surface.is-app:has(.dk-grid) { --bx-left: 8.5rem; }
  body.bx-surface.is-app > .bx-topbar, body.bx-surface.is-app > .bx-tabs { flex: none; padding-left: var(--bx-edge); padding-right: var(--bx-edge); }
  body.bx-surface.is-app > .bx-pagebar, body.bx-surface.is-app > .rp-asset-bar { flex: none; width: 100%; max-width: none; margin: 0; padding: 0.75rem var(--bx-edge) 0; }
  body.bx-surface.is-app > main, body.bx-surface.is-app > main.bx-page { flex: 1; width: 100%; max-width: none; min-height: 0; margin: 0; padding: 1.75rem var(--bx-edge) 3rem; overflow-y: auto; scrollbar-width: thin; }
  body.bx-surface.is-app > main:has(> .bx-cols), body.bx-surface.is-app > main.bx-page:has(> .bx-cols) { display: flex; flex-direction: column; padding: 0 var(--bx-edge); overflow: hidden; }
  body.bx-surface.is-app > main:has(> .bx-cols) > .ws-head { flex: none; margin: 1.75rem 0 0.25rem; }
  body.bx-surface.is-app > main > .rp-older { flex: none; margin: 1rem var(--bx-bar) 0 0; }
  body.bx-surface.is-app .bx-cols { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) var(--bx-side); grid-template-rows: minmax(0, 1fr); gap: 0.75rem; height: auto; min-height: 0; margin: 0; align-items: stretch; }
  body.bx-surface.is-app .bx-cols.has-left { grid-template-columns: var(--bx-left) minmax(0, 1fr) var(--bx-side); }
  body.bx-surface.is-app .bx-col { min-width: 0; min-height: 0; padding: 1rem 0 3rem; overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable; }
  body.bx-surface.is-app .bx-col-side { display: flex; flex-direction: column; gap: 1rem; margin-right: calc(-1 * var(--bx-bar)); }
  body.bx-surface.is-app .has-footer .bx-col { padding-bottom: 6rem; }
  body.bx-surface.is-app :is(.bx-report, .bx-sheet) :is(p, li) { max-width: 48rem; }

  /* a chat: its column runs from the tabs to the foot of the window */
  body.bx-surface.is-chat .bx-frame { height: 100%; }
  body.bx-surface.is-chat .bx-frame-body { flex: 1; padding: 1rem 1.25rem 0; }
  body.bx-surface.is-chat .bx-frame-body > *, body.bx-surface.is-chat .bx-frame-foot { width: 100%; max-width: 48rem; margin-left: auto; margin-right: auto; }
  body.bx-surface.is-chat .bx-frame-foot { width: calc(100% - 2.5rem); padding: 0.75rem 0 1rem; background: none; }
  body.bx-surface.is-chat .bx-msg { scroll-margin-top: 0.75rem; }
}
