/* Design tokens: the Moonrise OS design system (Moonrise DESIGN.md, UI revamp UR0, 1 November 2026), copied as its
   roles. Every colour the lab uses is defined here and only here; pages refer to a role, never to a hue.
   tests/test_design_tokens.cjs keeps it that way. There is no dark theme: DESIGN.md proposes none.
   Colours: the Moonrise Bio palette (Moonrise brand-palette 5b02bfc2, docs/implementation/2026-11-12-moonrise-bio-palette.md,
   PL-1 to PL-8; owner, 12 November 2026: "not darker than salmon", "Softer still", "Accept"), with its amendment PL-9 to
   PL-13, "Logo images, stronger" (Moonrise 99fe93170; owner, 14 November 2026), and PL-14, "Deeper B, white" (Moonrise
   6d10d3758; owner, 15 November 2026). Marks, bars and underlines are coral (--secondary, PL-9, PL-11); coral and salmon
   are never text on a light page. --primary is slate navy for text, links and borders, not a fill: the one main action is
   the wordmark's B deepened (--accent, #cc3a24) with white text (--on-accent, 5.0:1), a step deeper on hover, never
   lighter (PL-14). The rail is the logo's night (PL-10). */
:root {
  --primary: #2b3a50; --primary-strong: #0b1422; --primary-container: #fffaf7; --on-primary: #ffffff;
  --accent: #cc3a24; --accent-strong: #b63420; --accent-subtle: #fee2d7; --on-accent: #ffffff;
  --secondary: #fa7153; --secondary-strong: #2b3a50; --secondary-container: #fff4ed;
  --tertiary: #277499; --tertiary-container: #eaf2f7;
  --neutral: #f5f6f8; --surface: #ffffff; --surface-raised: #fbfbfc; --surface-sunken: #eef0f4; --surface-selected: #fff4ed;
  --on-surface: #18212e; --on-surface-strong: #0b1422; --on-surface-muted: #5a6577;
  --outline: #7b8596; --outline-subtle: #e1e5eb; --outline-variant: #c4cad4;
  --nav: #060c14; --nav-hover: #141c28; --nav-rule: #2b3a50; --on-nav: #e8edf3; --on-nav-muted: #9aa7b8; --nav-accent: #fee2d7;
  --focus: #0b1422; --focus-on-dark: #fee2d7;
  --success: #1f5530; --success-container: #e5f2e8; --success-outline: #b9d3c1;
  --warning: #8a5a00; --warning-container: #fff6dc; --warning-outline: #e6c98e;
  --error: #9e3b47; --error-container: #fdf0f1; --error-outline: #ecc5ca; --on-error: #ffffff;
  --info: #1f6283; --info-container: #eaf2f7; --info-outline: #b6d8e9;
  --agent: #3b526e; --agent-strong: #26384d; --agent-container: #eef2f8; --agent-outline: #8aa0bd;
  --development: #5a3e9e; --development-container: #efe9fc;
  --scrim: #060c1466; --veil: #ffffff20; --shadow: #060c141a; --shadow-overlay: #060c1424;
  --ramp-0: #f4f6f8; --ramp-1: #eaf2f7; --ramp-2: #d4e7f1; --ramp-3: #b6d8e9; --ramp-4: #8fc1dc; --ramp-5: #65a8cd;
  --ramp-6: #2c77a1; --ramp-7: #1f6690; --ramp-8: #16506f;
  --space-xxs: 2px; --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px; --space-xl: 24px;
  --space-xxl: 32px; --space-xxxl: 48px;
  --space-control-height: 36px; --space-control-height-touch: 44px; --space-navigation-width: 252px;
  --space-navigation-width-collapsed: 56px;
  --space-content-max: 1440px; --space-field-min: 240px; --space-page-gutter: 24px; --space-page-gutter-phone: 16px;
  --radius-none: 0px; --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-full: 9999px;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif; --font-data: ui-monospace, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--neutral); color: var(--on-surface); font: 14px/1.5 var(--font-body); }
h1, h2, h3, h4 { font-weight: 600; color: var(--on-surface-strong); }
/* Links are navy with a coral underline (PL-3, PL-11); focus is navy on light pages, peach on the rail. */
a { color: var(--primary); text-decoration-color: var(--secondary); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* The shell: the logo's night navigation rail (PL-10) (the header and the tabs) beside the page; below 900px it is a top bar. */
.rail { background: var(--nav); color: var(--on-nav); }
.rail :focus-visible { outline-color: var(--focus-on-dark); }
header { display: flex; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; padding: var(--space-md) var(--space-lg); }
header h1 { margin: 0; font-size: 15px; line-height: 1.3; color: var(--secondary-container); white-space: nowrap; }
/* The brand: the Moonrise Bio logo (owner, 12 November 2026: "add also new logo on UI and replace older one where it was
   used"), cut from the logo file by tools/build_lab_logo.py and never recoloured or redrawn, with the lab's own name as
   text below it. The rail shows the wordmark (its tagline would be under 9px there), the folded rail the joined "OO". */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
.brand img { max-width: 100%; height: auto; }
.brand-logo, .brand-logo-night { display: block; }
.brand-logo { width: 220px; }
.brand-glyph { display: none; }
header p { margin: var(--space-xxs) 0 0; color: var(--on-nav-muted); font-size: 12px; }
.status { color: var(--on-nav-muted); font-size: 12px; align-self: center; }
.rail button { background: transparent; color: var(--on-nav); border-color: var(--on-nav-muted); }
.rail button:hover { background: var(--nav-hover); color: var(--on-nav); }
.rail button.link, .status .status-link { color: var(--nav-accent); font-size: inherit; padding: 0; }
#account-name { color: var(--on-nav); }
/* Approvals: one request per row, its text clipped to two lines; the full payload is on hover and in Detail. */
.egress-table td:nth-child(1) { white-space: nowrap; }
.egress-summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 70ch; }
nav { display: flex; gap: var(--space-xs); padding: 0 var(--space-lg); overflow-x: auto; }
.rail nav button { min-height: 0; border: 0; border-radius: var(--radius-md); background: none; color: var(--on-nav);
                   padding: var(--space-sm) var(--space-md); font: inherit; font-weight: 400; cursor: pointer; }
.rail nav button:hover { background: var(--nav-hover); }
/* The page shown: peach text and a 3px coral bar (PL-2, PL-11). */
.rail nav button[aria-selected="true"] { background: var(--nav-hover); color: var(--nav-accent); font-weight: 600;
                                         box-shadow: inset 3px 0 0 var(--secondary); }
#rail-toggle, .nav-icon { display: none; }
@media (min-width: 901px) {
  body:has(> .rail) { display: grid; grid-template-columns: var(--space-navigation-width) minmax(0, 1fr); min-height: 100dvh; }
  .rail { grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
          display: flex; flex-direction: column; }
  body > .tab { grid-column: 2; grid-row: 1; width: 100%; }
  /* The header's parts join the rail: the name on top, the tabs, then the status line and the account at the foot. */
  .rail > header { display: contents; }
  .rail > header > div:first-child { padding: var(--space-xl) var(--space-lg) var(--space-lg); }
  .rail nav { order: 1; flex: 1 0 auto; flex-direction: column; gap: var(--space-xxs); padding: 0 var(--space-sm) var(--space-lg); overflow: visible; }
  .rail nav button { width: 100%; text-align: left; }
  .rail .status { order: 2; align-self: stretch; padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--nav-rule); }
  .rail #account-controls { order: 3; align-items: center; justify-content: space-between; padding: 0 var(--space-lg) var(--space-lg); }
  /* The rail folds to a strip of section icons and back (pages/header.js keeps the choice); the page takes the freed width. */
  #rail-toggle { order: 1; display: flex; align-items: center; gap: var(--space-sm); min-height: 0; margin: 0 var(--space-sm) var(--space-md);
                 padding: var(--space-sm) var(--space-md); border: 0; border-radius: var(--radius-md); color: var(--on-nav-muted); font: inherit; }
  .rail nav button { display: flex; align-items: center; gap: var(--space-sm); position: relative; }
  .nav-icon { display: block; flex: none; }
  #rail-toggle svg, .nav-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  body.rail-collapsed:has(> .rail) { grid-template-columns: var(--space-navigation-width-collapsed) minmax(0, 1fr); }
  .rail-collapsed .rail { overflow-x: hidden; }
  .rail-collapsed .rail > header > div:first-child { padding: var(--space-xl) 0 var(--space-lg); }
  .rail-collapsed .brand { align-items: center; }
  .rail-collapsed .brand-logo { display: none; }
  .rail-collapsed .brand-glyph { display: block; width: 40px; }
  .rail-collapsed #rail-toggle { justify-content: center; padding: var(--space-sm) 0; }
  .rail-collapsed #rail-toggle svg { transform: scaleX(-1); }
  .rail-collapsed #app-description, .rail-collapsed .rail .status, .rail-collapsed .rail #account-controls { display: none; }
  .rail-collapsed .rail nav button { justify-content: center; padding: var(--space-sm) 0; }
  .rail-collapsed .brand-name, .rail-collapsed .nav-label, .rail-collapsed .rail-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .rail-collapsed .nav-count { position: absolute; top: 0; right: 0; min-width: 18px; margin: 0; padding: 0 var(--space-xs); line-height: 18px;
                               text-align: center; }
}
.tab { max-width: var(--space-content-max); margin: 0 auto; padding: var(--space-xl) var(--space-page-gutter); }
/* A section's pages, as underline tabs at the top of the page shown (core/tabs.js moves the row there). */
.page-tabs { display: flex; gap: var(--space-xs); margin: 0 0 var(--space-lg); border-bottom: 1px solid var(--outline-subtle);
             overflow-x: auto; scrollbar-width: none; }
.page-tabs[hidden], .page-tabs [hidden] { display: none; }
.page-tabs button { flex-shrink: 0; min-height: 40px; padding: 0 var(--space-md); border: 0; border-radius: 0; background: transparent;
                    color: var(--on-surface-muted); font-size: 14px; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; }
.page-tabs button:hover { background: transparent; color: var(--on-surface-strong); }
.page-tabs button[aria-selected="true"] { color: var(--on-surface-strong); box-shadow: inset 0 -2px 0 var(--secondary); }
/* Outbound requests waiting for a person, on the rail's Setup button and the Outbound requests page tab. */
.nav-count { margin-left: var(--space-xs); padding: 0 var(--space-xs); border-radius: var(--radius-full); background: var(--accent);
             color: var(--on-accent); font-size: 12px; font-weight: 600; }
.nav-count[hidden] { display: none; }
.panel { background: var(--surface); border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); padding: var(--space-lg);
         margin-bottom: var(--space-xl); overflow-x: auto; }
.panel h2 { margin: 0 0 var(--space-sm); font-size: 16px; line-height: 1.35; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.help { color: var(--on-surface-muted); font-size: 13px; margin: 0 0 var(--space-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
th, td { text-align: left; padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--outline-subtle); vertical-align: top; }
th { color: var(--on-surface-strong); font-weight: 600; border-top: 0; }
thead th { background: var(--surface-sunken); font-size: 12px; letter-spacing: .02em; vertical-align: bottom; }
td.mono, .mono { font-family: var(--font-data); font-size: 12px; font-variant-numeric: tabular-nums; }
td.wrap { overflow-wrap: anywhere; max-width: 420px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--primary-container); }
/* History rows still running (Query and Benchmark history), and batches cancelled (Benchmark history). */
tr.row-running td { background: var(--info-container); }
tr.row-running td:first-child { box-shadow: inset 3px 0 0 var(--info); }
tr.row-cancelled td { background: var(--error-container); }
tr.row-cancelled td:first-child { box-shadow: inset 3px 0 0 var(--error); }
/* Buttons: secondary (white, navy text, outline) by default; primary for a form's one main action, the deepened B with
   white text and a step deeper on hover, never lighter (PL-14); danger stays outlined rose. */
button, .button { font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; min-height: var(--space-control-height);
                  border: 1px solid var(--outline); background: var(--surface); color: var(--primary);
                  border-radius: var(--radius-md); padding: 0 var(--space-lg); cursor: pointer; display: inline-block; }
.button { display: inline-flex; align-items: center; }
button:hover, .button:hover { background: var(--primary-container); color: var(--primary-strong); }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
/* Danger only for stopping or discarding work: outlined in the muted error rose, never a filled red block (PL-5). */
button.danger { background: var(--surface); color: var(--error); border-color: var(--error-outline); }
button.danger:hover { background: var(--error-container); color: var(--error); border-color: var(--error); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { min-height: 0; border: 0; padding: 0; background: none; color: var(--primary); font-weight: inherit;
              font-size: inherit; text-decoration: underline; text-decoration-color: var(--secondary); text-underline-offset: 2px; }
td button:not(.link) { min-height: 32px; padding: 0 var(--space-md); font-size: 12px; }
td > .actions { flex-wrap: nowrap; }
.actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(var(--space-field-min), 100%), 1fr)); gap: var(--space-sm) var(--space-md);
        align-items: end; margin-top: var(--space-sm); }
.grid label { display: flex; flex-direction: column; gap: var(--space-xs); font-size: 13px; font-weight: 600; color: var(--on-surface); }
.grid label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; font-weight: 400; }
.grid label small, .grid label .help { font-weight: 400; }
.settings-form { align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(var(--space-field-min), 100%), 1fr)); }
.settings-form > label { min-width: 0; }
.field-with-help { position: relative; }
.field-tooltip { position: absolute; bottom: calc(100% + var(--space-xs)); left: 0; width: 100%; padding: var(--space-sm) var(--space-md);
                 border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); background: var(--surface); color: var(--on-surface);
                 box-shadow: 0 8px 30px var(--shadow-overlay); font-size: 12px; font-weight: 400; z-index: 2; visibility: hidden; }
.field-with-help:hover .field-tooltip, .field-with-help:focus-within .field-tooltip { visibility: visible; }
.settings-form input:not([type="checkbox"]), .settings-form select { width: 100%; min-width: 0; }
.settings-form .form-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end;
                               flex-wrap: wrap; gap: var(--space-sm) var(--space-md); }
.settings-form .form-actions > label { margin-right: auto; }
#search-service-status { grid-column: 1 / -1; margin: 0; }
/* Inputs and pulldowns: 36px, a 3:1 outline, labels above. An invalid field is marked on the field itself. */
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; padding: 0 var(--space-md); border-radius: var(--radius-sm);
                          border: 1px solid var(--outline); background: var(--surface); color: var(--on-surface); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { min-height: var(--space-control-height); }
textarea { padding: var(--space-sm) var(--space-md); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
[aria-invalid="true"] { background: var(--error-container); border-color: var(--error); }
.field-error { color: var(--error); font-size: 12px; font-weight: 600; margin: var(--space-xs) 0 0; }
/* Status chips: a word on its status container; colour supports the word and is never the only signal. */
.badge { display: inline-block; border: 1px solid var(--outline-subtle); border-radius: var(--radius-full); padding: 0 var(--space-sm);
         background: var(--surface-sunken); color: var(--on-surface); font-size: 12px; font-weight: 600; line-height: 20px;
         letter-spacing: .02em; white-space: nowrap; }
.met, .ok { color: var(--success); } .blocked, .bad { color: var(--error); } .review, .warn { color: var(--warning); }
.badge.met, .badge.ok { background: var(--success-container); border-color: var(--success-outline); }
.badge.review, .badge.warn { background: var(--warning-container); border-color: var(--warning-outline); }
.badge.blocked, .badge.bad { background: var(--error-container); border-color: var(--error-outline); }
/* An evidence kind (unverified inference, conditional on your facts) is a label, not a state: blush with slate text and
   a peach hairline (PL-4). */
.badge.evidence { border-radius: var(--radius-sm); background: var(--secondary-container); border-color: var(--accent-subtle);
                  color: var(--secondary-strong); }
.detail, dialog pre { background: var(--surface-sunken); padding: var(--space-md); border-radius: var(--radius-md); overflow: auto; max-height: 60vh;
                      font-family: var(--font-data); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-box { margin-top: var(--space-md); border-top: 1px solid var(--outline-subtle); padding-top: var(--space-md); }
/* Dialogs: the one overlay shadow, over the scrim. */
dialog { max-width: min(960px, 95vw); width: 100%; border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg);
         padding: var(--space-xl); background: var(--surface); color: var(--on-surface); box-shadow: 0 8px 30px var(--shadow-overlay); }
dialog::backdrop { background: var(--scrim); }
.meta { color: var(--on-surface-muted); font-size: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; margin-top: var(--space-xs); }
.statement { white-space: pre-wrap; overflow-wrap: anywhere; }
.pending { color: var(--on-surface-muted); font-style: italic; }
/* Notices (core/dom.js): confirmations go after four seconds, a failure stays until it is dismissed or retried. */
#notices { position: fixed; right: var(--space-lg); bottom: calc(var(--space-xxxl) * 2 + env(safe-area-inset-bottom)); z-index: 900;
           display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-sm); max-width: min(480px, 90vw);
           /* Several failures at once never cover the page: the column takes at most 40% of the height and scrolls, and only
              the notices themselves take a touch. */
           max-height: 40vh; overflow-y: auto; pointer-events: none; }
#notices > * { pointer-events: auto; flex: none; }
.toast, .notice { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); font-size: 13px; box-shadow: 0 8px 30px var(--shadow-overlay); }
.toast { background: var(--on-surface); color: var(--surface); }
.notice { display: flex; align-items: center; gap: var(--space-md); background: var(--error-container); color: var(--on-surface);
          border: 1px solid var(--error); }
.notice-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* The server was deployed since this tab loaded (core/api.js): stays until the person reloads. */
#build-notice { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--space-lg); z-index: 1000; background: var(--on-surface); color: var(--surface);
                padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); font-size: 13px; max-width: 90vw; box-shadow: 0 8px 30px var(--shadow-overlay); }
#build-notice button { margin-left: var(--space-sm); }
/* A model the lab's questions need is not ready (core/models-banner.js): a red bar across the top of every page. */
/* Fixed over the top: the body is a grid (rail and page), which an extra child would rearrange. */
#models-banner { position: fixed; inset: 0 0 auto 0; z-index: 1001; background: var(--error); color: var(--on-error);
                 padding: var(--space-sm) var(--space-md); font-size: 14px; box-shadow: 0 2px 8px var(--shadow-overlay); }
#models-banner ul { margin: var(--space-xs) 0; padding-left: var(--space-lg); }
#models-banner button { margin-left: var(--space-xs); background: var(--on-error); color: var(--error); border-color: var(--on-error); }
#models-banner .models-banner-collapse { float: right; margin: 0 0 var(--space-xs) var(--space-md); }
/* Collapsed: a small tab at the top left corner, in the margin above the logo: it lies over no control. */
#models-banner.collapsed { inset: 0 auto auto 0; padding: 0; background: none; box-shadow: none; }
#models-banner.collapsed button { display: block; margin: 0; min-height: 0; padding: 0 var(--space-md); font-size: 12px; line-height: 16px; white-space: nowrap;
                                  border-radius: 0 0 var(--radius-md) 0; background: var(--error); color: var(--on-error); border-color: var(--error); }
@media (max-width: 640px) { th:nth-child(4), td:nth-child(4) { display: none; } }
/* An approval waits on the person: the warning container with a warning inset bar. */
.approval { margin-top: var(--space-md); border: 1px solid var(--warning-outline); border-radius: var(--radius-md); padding: var(--space-md);
            background: var(--warning-container); box-shadow: inset 3px 0 0 var(--warning); }
.approval .help { margin: var(--space-xs) 0 var(--space-sm); }

.file-chip { display: inline-flex; align-items: center; gap: var(--space-sm); max-width: 100%; padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--outline-subtle); background: var(--surface); border-radius: var(--radius-md); font-size: 12px; }
.file-chip span { min-width: 0; overflow-wrap: anywhere; }
.file-chip button { min-height: 0; padding: 0 var(--space-xs); }
/* Images for the next message, as thumbnails above the message box; a sent message shows its images the same way. */
.chat-images { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: var(--space-sm); padding: var(--space-xs) 0; }
.chat-images:empty { display: none; }
.image-chip { position: relative; margin: 0; width: 64px; height: 64px; border: 1px solid var(--outline-subtle); border-radius: var(--radius-md);
  overflow: hidden; background: var(--surface); }
.image-chip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.image-chip.uploading img { opacity: .4; }
.image-chip figcaption { position: absolute; left: 0; right: 0; bottom: 0; font-size: 12px; text-align: center;
  background: var(--surface); color: var(--on-surface-muted); }
.image-chip button { position: absolute; top: var(--space-xxs); right: var(--space-xxs); min-height: 0; padding: 0 var(--space-xs);
  font-size: 12px; line-height: 1.4; }
#file-picker-dialog { max-height: 90dvh; overflow-y: auto; }
#file-list-dialog { max-height: 90dvh; overflow-y: auto; }
#file-list-dialog h2 { font-size: 16px; }
#user-benchmark-dialog { max-height: 90dvh; overflow-y: auto; }
#user-benchmark-form [hidden] { display: none; }  /* .grid label sets a display that [hidden] alone loses to */
#endpoint-form [hidden] { display: none; }
.endpoint-external { grid-column: 1 / -1; margin: 0; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md);
                     background: var(--warning-container); border: 1px solid var(--warning-outline); color: var(--on-surface); }
.frontier-guide { margin: 0 0 var(--space-md); }
.frontier-guide ol { margin: var(--space-sm) 0 0; padding-left: var(--space-xl); }
.question-files ul { margin: 0 0 var(--space-xs); padding-left: var(--space-xl); }
.question-files a { overflow-wrap: anywhere; }
.file-list-link { cursor: pointer; text-decoration: underline; }
#file-picker-dialog h2 { font-size: 16px; }
.file-picker-filters { margin-bottom: var(--space-md); }
#file-picker-rows td:first-child { overflow-wrap: anywhere; max-width: 400px; }
#file-picker-rows small { display: block; color: var(--on-surface-muted); overflow-wrap: anywhere; }
#file-picker-dialog th:nth-child(4), #file-picker-dialog td:nth-child(4) { display: table-cell; }
.file-picker-selection { align-items: center; margin-bottom: var(--space-xs); }
.file-picker-selection .help { margin-right: auto; }
.file-picker-hint { margin: 0 0 var(--space-sm); font-size: 12px; }
/* A dataset's heading: its checkbox selects all its matching files. */
#file-picker-rows tr.file-picker-group td { background: var(--surface-sunken); padding-top: var(--space-sm); }
.file-picker-group label { display: flex; align-items: center; gap: var(--space-sm); font-weight: 600; cursor: pointer; }
.file-picker-group small { display: inline; font-weight: 400; }
#file-picker-rows tr.file-picker-file { cursor: pointer; user-select: none; }
#file-picker-rows tr.file-picker-file.selected td { background: var(--surface-selected); }
.journey-controls { display: grid; gap: var(--space-sm); padding-bottom: var(--space-md); border-bottom: 1px solid var(--outline-subtle); }
.journey-controls label, .journey-stats { font-size: 12px; color: var(--on-surface-muted); }
.journey-controls select { width: 100%; min-width: 0; }
.journey-controls .actions { flex-wrap: nowrap; }
#history-task { flex: 1; }
.journey-title { font-size: 14px; margin: var(--space-md) 0 var(--space-xs); overflow-wrap: anywhere; }
.journey-stats { margin-bottom: var(--space-md); }
.journey-timeline { list-style: none; padding: 0 0 0 var(--space-md); margin: var(--space-sm) 0; }
.journey-step { position: relative; border-left: 2px solid var(--outline-subtle); padding: 0 0 var(--space-md) var(--space-lg); }
.journey-step::before { content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--primary); border: 2px solid var(--surface); }
.journey-step:last-child { border-color: transparent; }
.journey-step[data-outcome="pass"]::before { background: var(--success); }
.journey-step[data-outcome="fail"]::before { background: var(--error); }
.journey-step summary { cursor: pointer; font-size: 13px; overflow-wrap: anywhere; }
.journey-step summary::marker { color: var(--on-surface-muted); }
.journey-step .meta { font-size: 12px; overflow-wrap: anywhere; }
.journey-step .detail { max-height: 320px; margin: var(--space-sm) 0; }
.journey-step .statement { font-size: 12px; margin: var(--space-sm) 0; }
.journey-chart-viewport { max-width: 100%; overflow: auto; max-height: 65vh; margin-top: var(--space-md); border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); background: var(--neutral); }
.journey-chart-dialog { position: fixed; inset: 0; z-index: 20; width: 100%; height: 100dvh; padding: var(--space-lg);
                        display: flex; flex-direction: column; gap: var(--space-sm); background: var(--surface); }
.journey-chart-dialog[hidden] { display: none; }
body.flowchart-expanded { overflow: hidden; }
.journey-chart-dialog h2 { margin: 0; font-size: 16px; }
.journey-chart-dialog > .help { margin: 0; }
#journey-chart-content { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); background: var(--neutral); }
.journey-chart-scale { position: relative; overflow: hidden; margin: 0 auto; }
/* The mounted view (timeline or flowchart host) scales from its top-left corner inside the sized wrapper. */
.journey-chart-scale > * { position: absolute; top: 0; left: 0; margin: 0; transform-origin: top left; }
.journey-chart-zoom { align-items: center; }
#journey-chart-zoom-label { min-width: 55px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
/* The step list (pages/journey/flow.js renderJourneyStepList): the run in the order its steps started, on a rail whose
   mark says where each step stands. A row reads top down: what it did and how long it took, who did it with which
   model, then what went in and what came out, two lines each. */
.journey-step-list { list-style: none; padding: 0; margin: var(--space-md) 0 0; }
.journey-list-step { position: relative; padding: 0 0 var(--space-xs) var(--space-xl); }
.journey-list-step::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--outline-subtle); }
.journey-list-step:first-child::before { top: 14px; }
.journey-list-step:first-child:last-child::before { display: none; }
/* The rail ends at the last row's mark: the row covers what would run on below it. */
.journey-list-step:last-child .journey-list-node::after { content: ''; position: absolute; left: -18px; top: 23px; bottom: calc(0px - var(--space-xs)); width: 4px; background: var(--surface); }
.journey-list-stage { display: block; padding: var(--space-sm) var(--space-sm) var(--space-xxs); font-size: 12px; font-weight: 600; color: var(--primary-strong); }
.journey-list-step:first-child .journey-list-stage { padding-top: 0; }
.journey-list-node { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: var(--space-xxs); width: 100%; height: auto;
                     min-height: 44px; padding: var(--space-sm); border: 0; border-radius: var(--radius-md); background: transparent;
                     color: var(--on-surface); font-weight: 400; text-align: left; overflow-wrap: anywhere; }
.journey-list-node:hover { background: var(--primary-container); color: var(--on-surface); }
.journey-list-node:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
/* The mark on the rail, beside the row's title: filled when done, red when failed, a ring while running or waiting. */
.journey-list-node::before { content: ''; position: absolute; left: -21px; top: 13px; box-sizing: border-box; width: 10px; height: 10px;
                             border: 2px solid var(--primary); border-radius: var(--radius-full); background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }
.journey-list-step[data-state="fail"] .journey-list-node::before { border-color: var(--error); background: var(--error); }
.journey-list-step[data-state="running"] .journey-list-node::before, .journey-list-step[data-state="waiting"] .journey-list-node::before,
.journey-list-step[data-state="open"] .journey-list-node::before { background: var(--surface); }
.journey-list-step[data-state="waiting"] .journey-list-node::before { border-color: var(--warning); }
.journey-list-step[data-state="open"] .journey-list-node::before { border-color: var(--outline); }
.journey-list-step[data-state="running"] .journey-list-node::before { animation: journey-list-running 1.6s ease-in-out infinite; }
@keyframes journey-list-running { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .journey-list-step[data-state="running"] .journey-list-node::before { animation: none; } }
/* The state label of a question (core/run-label.js): a word in its tone and, while it runs, the age of its last step. */
.run-label { display: inline-flex; align-items: center; gap: var(--space-xs); min-width: 0; padding: 0 var(--space-sm); border-radius: var(--radius-full);
             font-size: 12px; line-height: 20px; font-weight: 600; background: var(--info-container); color: var(--info); }
.run-label[hidden] { display: none; }
.run-label-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: var(--radius-full); background: currentColor; }
.run-label-age { font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-label[data-tone="ok"] { background: var(--success-container); color: var(--success); }
.run-label[data-tone="warn"], .run-label[data-quiet="true"] { background: var(--warning-container); color: var(--warning); }
.run-label-age[data-quiet="true"] { color: var(--warning); }
.run-label[data-tone="bad"] { background: var(--error-container); color: var(--error); }
.run-label[data-tone="pending"] .run-label-dot { animation: journey-list-running 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .run-label[data-tone="pending"] .run-label-dot { animation: none; } }
.journey-list-head { display: flex; align-items: baseline; gap: var(--space-sm); }
.journey-list-title { flex: 1; min-width: 0; font-weight: 600; }
.journey-list-time { flex-shrink: 0; font-size: 12px; color: var(--on-surface-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.journey-list-state { align-self: flex-start; padding: 0 var(--space-sm); border-radius: var(--radius-full); font-size: 12px; font-weight: 600;
                      background: var(--secondary-container); color: var(--secondary-strong); }
.journey-list-step[data-state="fail"] .journey-list-state { background: var(--error-container); color: var(--error); }
.journey-list-step[data-state="waiting"] .journey-list-state { background: var(--warning-container); color: var(--warning); }
.journey-list-step[data-state="open"] .journey-list-state { background: var(--surface-sunken); color: var(--on-surface-muted); }
.journey-list-meta { font-size: 12px; color: var(--on-surface-muted); }
/* How a v2 run behaved (pages/journey/behaviour.js): its calls, tokens and time by round, folded above the Steps panel's
   step list and, on the Chat page, beside what the question cost. */
.chatbot-behaviour { margin: var(--space-xs) 0; }
.journey-behaviour { margin: var(--space-sm) 0; font-size: 12px; }
.journey-behaviour > summary { cursor: pointer; color: var(--on-surface-muted); }
.journey-behaviour-round { margin-top: var(--space-sm); }
.journey-behaviour-round p { margin: 0; }
.journey-behaviour-title { font-weight: 600; }
.journey-behaviour-kinds { margin: var(--space-xs) 0 0; padding-left: var(--space-lg); }
.journey-list-io { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); column-gap: var(--space-xs); font-size: 12px; line-height: 1.4; }
.journey-list-io-label { font-weight: 600; color: var(--on-surface-muted); }
.journey-list-io-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.journey-readable-fields dt { font-weight: 600; margin-top: var(--space-md); }
.journey-readable-fields dt::first-letter { text-transform: uppercase; }
.journey-readable-fields dd { margin: var(--space-xs) 0 var(--space-sm) var(--space-md); overflow-wrap: anywhere; }
.journey-readable-fields p { white-space: pre-wrap; }
.journey-raw-details { margin-top: var(--space-xl); border-top: 1px solid var(--outline-subtle); padding-top: var(--space-md); }
.journey-step-explanation { margin-top: var(--space-lg); border-top: 1px solid var(--outline-subtle); padding-top: var(--space-md); }
.journey-step-explanation > summary { cursor: pointer; }
.journey-step-explanation > summary h3 { display: inline; margin: 0; }
.journey-step-explanation > summary .statement { display: block; margin: var(--space-xs) 0 0 var(--space-lg); color: var(--on-surface-muted); }
.journey-step-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; box-sizing: border-box;
                       border: 0; border-radius: 0; padding: var(--space-lg) var(--space-xl); }
.journey-step-dialog[open] { display: flex; flex-direction: column; }
#journey-step-content { flex: 1; min-height: 0; overflow: auto; margin: var(--space-md) 0; }
.journey-step-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.journey-step-ids { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-sm); margin: 0; font-size: 12px; }
.journey-step-ids dt { color: var(--on-surface-muted); }
.journey-step-ids dd { margin: 0 var(--space-md) 0 0; font-family: var(--font-data); overflow-wrap: anywhere; user-select: all; }
/* Post-review and the isolated test: two cards side by side at the bottom of the step, stacked on a narrow screen. */
.journey-step-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: var(--space-lg);
                      align-items: start; margin-top: var(--space-xl); }
.journey-step-cards > section { margin: 0; min-width: 0; background: var(--surface); }
.journey-step-cards > section > h3:first-child { margin-top: 0; }
.journey-step-navigation { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.journey-step-navigation .help { margin: 0; }
.journey-task-tag { border-left: 3px solid var(--task-color, var(--outline-subtle)); padding-left: var(--space-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chat-toolbar { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) 0; flex-shrink: 0; border-bottom: 1px solid var(--outline-subtle); }
.chat-toolbar label { font-size: 12px; color: var(--on-surface-muted); white-space: nowrap; }
.chat-toolbar select { flex: 1; min-width: 0; }
.chat-toolbar button { white-space: nowrap; }
/* The list opens right under the box (top stays at its place in the flow) and spans the toolbar, never the page. */
.chat-toolbar { position: relative; }
.saved-chats { flex: 1 1 var(--space-field-min); min-width: min(var(--space-field-min), 100%); }
.saved-chats input { width: 100%; min-width: 0; text-overflow: ellipsis; }
.saved-chats-popup { position: absolute; left: 0; right: 0; margin-top: var(--space-xs); z-index: 10; overflow: hidden;
                     background: var(--surface); border: 1px solid var(--outline-subtle); border-radius: var(--radius-md);
                     box-shadow: 0 8px 30px var(--shadow-overlay); }
#saved-chats-list { max-height: min(520px, 60dvh); overflow-y: auto; }
.saved-chat-option { display: flex; flex-direction: column; gap: var(--space-xxs); padding: var(--space-xs) var(--space-md);
                     cursor: pointer; border-left: 3px solid transparent; }
.saved-chat-option.active { background: var(--surface-selected); }
.saved-chat-option[aria-selected="true"] { border-left-color: var(--primary); }
.saved-chat-question, .saved-chat-detail { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-chat-question { font-size: 13px; color: var(--on-surface-strong); }
.saved-chat-detail { font-size: 12px; color: var(--on-surface-muted); }
#saved-chats-note { margin: 0; padding: var(--space-xs) var(--space-md); border-top: 1px solid var(--outline-subtle); }
@media (max-width: 640px) { .chat-toolbar label { display: none; } }
.journey-message { border-top: 1px solid var(--outline-subtle); padding: var(--space-md) 0; }
.journey-message > summary { cursor: pointer; overflow-wrap: anywhere; font-size: 13px; }
.journey-message-label { font-weight: 600; margin-right: var(--space-sm); color: var(--primary); }
.journey-message-preview { color: var(--on-surface-muted); display: -webkit-box; -webkit-box-orient: vertical;
                           -webkit-line-clamp: 2; overflow: hidden; margin-top: var(--space-xs); }
.journey-message[open] > summary .journey-message-preview { color: var(--on-surface); }
.journey-message-body { padding-top: var(--space-sm); }
.journey-run + .journey-run { border-top: 1px dashed var(--outline-subtle); margin-top: var(--space-md); padding-top: var(--space-md); }
.journey-run-label { color: var(--on-surface-muted); font-size: 12px; margin: 0; }

#grok-search-options { grid-column: 1 / -1; min-width: 0; margin: var(--space-xs) 0; padding: var(--space-md);
  border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); }
#grok-search-options legend { padding: 0 var(--space-sm); font-weight: 600; }
#grok-search-options .help { grid-column: 1 / -1; margin: 0; }
#grok-search-options[hidden], #search-results-field[hidden] { display: none; }


.corpus-source { border-top: 1px solid var(--outline-subtle); padding: var(--space-md) 0; }
.corpus-source > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.corpus-source table { margin-top: var(--space-sm); table-layout: fixed; }
.corpus-source th:first-child { width: 32%; }
.corpus-source th:nth-child(2), .corpus-source th:nth-child(3) { width: 70px; }
.corpus-source th:last-child { width: 90px; }




.chat-toolbar { flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.benchmark-error { color: var(--error); overflow-wrap: anywhere; }
#batch-history { max-width: 100%; margin: var(--space-sm) 0; }


#suite-subsets, #suite-harnesses { display: flex; flex-wrap: wrap; gap: var(--space-md) var(--space-xl); margin: var(--space-md) 0; padding: var(--space-md) var(--space-lg); border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); }
.suite-subset { display: flex; align-items: baseline; gap: var(--space-sm); flex-wrap: wrap; max-width: 100%; overflow-wrap: anywhere; }
.suite-subset input { width: auto; }
.suite-subset small { flex-basis: 100%; }
.suite-plan { flex-basis: 100%; margin: var(--space-xs) 0; overflow-wrap: anywhere; }
/* One harness's versions (or v1's engine) inside the harness choice; the count of chosen ones below them. */
.suite-harness { display: flex; flex-direction: column; gap: var(--space-xs); border: 0; margin: 0; padding: 0; min-width: 0; max-width: 100%; }
.suite-harness legend { font-weight: 600; padding: 0; overflow-wrap: anywhere; }
#suite-harness-count { flex-basis: 100%; margin: 0; }
.suite-harness-rows { display: flex; flex-direction: column; gap: var(--space-xs); }
.suite-harness-row { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; max-width: 100%; }
.suite-harness-row select { width: auto; max-width: 100%; }
.suite-harness-add { align-self: flex-start; }
/* Batch results: one row per item and harness, its details in the row below. */
.suite-results-table { min-width: 960px; }
.suite-results-table td { vertical-align: top; }
.suite-results-table td:first-child button { white-space: nowrap; font-size: 12px; }
.suite-results-table td:nth-child(n+6):nth-child(-n+8) { white-space: nowrap; }  /* answers are clipped to 25 characters */
.suite-results-table td span[title] { cursor: help; }
.suite-results-table .actions { flex-wrap: nowrap; }
.suite-result td { border-bottom: 0; }
.suite-result-detail td { padding-top: 0; }
.suite-result-detail p { margin: 0 0 var(--space-xs); }
.suite-result-detail pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 400px; overflow-y: auto; font-size: 12px; }
#suite-results h3 { font-size: 14px; }

#suite-question-preview { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 400px; overflow-y: auto; font-size: 12px; }
#suite-question-select { width: 100%; min-width: 0; }
.suite-history-controls { display: flex; align-items: end; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.suite-history-controls[hidden] { display: none; }
.suite-history-controls label { flex: 1 1 260px; min-width: 0; max-width: 720px; display: flex; flex-direction: column; gap: var(--space-xs); }
.suite-history-controls input, .suite-history-controls select { width: 100%; min-width: 0; }
#agent-history .table-scroll { margin: var(--space-md) 0; }
#agent-history-table thead { position: sticky; top: 0; z-index: 1; }
#agent-history-table td { overflow-wrap: break-word; }  /* long IDs wrap; short words never split */
/* Sortable headers are buttons that read as the header text. */
.history-sort { min-height: 0; border: 0; padding: 0; color: inherit; font-weight: 600; background: none; text-align: left; }
.history-sort:hover { background: none; color: var(--primary); }
.agent-history-question { min-width: 160px; max-width: 300px; }
.agent-history-question small { display: block; }
#agent-history-filters { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
#agent-history-filters input, #agent-history-filters select { min-width: 0; width: 100%; }
#question-history-filters { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); margin-top: var(--space-md); }
#question-history-filters input, #question-history-filters select { min-width: 0; width: 100%; }
#batch-history .table-scroll { margin: var(--space-md) 0; }
#batch-history-table thead { position: sticky; top: 0; z-index: 1; }
#batch-history-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }  /* long batch IDs */
#batch-history-filters { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
#batch-history-filters input, #batch-history-filters select { min-width: 0; width: 100%; }
.batch-history-batch { min-width: 120px; max-width: 300px; }
.batch-history-batch small, .batch-history-harness { display: block; }
#query-history-filters { grid-template-columns: repeat(auto-fit,minmax(min(190px,100%),1fr)); }
#query-history-filters input, #query-history-filters select { width: 100%; min-width: 0; }
/* The history tables fit the page's width with no sideways scroll (owner, 7 November 2026: "make lines to fit in all
   width without scroll"): the columns share the width, headers and long values wrap, and identifiers may break. */
#query-history-table, #agent-history-table, #batch-history-table { width: 100%; }
#query-history-table, #agent-history-table, #batch-history-table { font-size: 12px; }
#query-history-table :is(th, td), #agent-history-table :is(th, td), #batch-history-table :is(th, td) { padding: var(--space-xs); }
#query-history-table td { overflow-wrap: break-word; max-width: 280px; }
/* The select column (benchmarks from Query history) takes only its box's width. */
#query-history-table :is(th, td):has(> input.query-history-pick) { width: 1px; padding-inline: var(--space-xxs); }
#query-history-table input.query-history-pick { margin: 0; }
/* A query's star ends its row's actions (Query history's Starred filter), centred on the buttons: no taller than they are. */
#query-history-table button.query-star { align-self: center; min-height: 0; padding: 0 var(--space-xxs); border: 0;
  background: none; font-size: 16px; line-height: 1; color: var(--on-surface-muted); cursor: pointer; }
#query-history-table button.query-star.starred { color: var(--warning); }
/* A row's actions (Open, Repeat) wrap, so the table still fits a 1280-pixel window with no sideways scroll. */
#query-history-table .query-history-actions { flex-wrap: wrap; gap: var(--space-xxs); }
#query-history-table .query-history-actions button:not(.link) { padding-inline: var(--space-sm); }
#query-history-table :is(td.mono, small, code), #agent-history-table :is(td.mono, small, code), #batch-history-table :is(td.mono, small, code) { overflow-wrap: anywhere; }
#query-history-table :is(th, td) button, #agent-history-table :is(th, td) button, #batch-history-table :is(th, td) button { white-space: normal; text-align: left; }
#query-history-table td > .actions, #agent-history-table td > .actions, #batch-history-table td > .actions { flex-wrap: wrap; }
.query-history-question { min-width: 120px; max-width: 350px; }
.query-history-question .link { text-align: left; }
.query-history-question small { display: block; }
.query-history-columns { margin: var(--space-md) 0; }
#query-history-columns { gap: var(--space-sm) var(--space-lg); padding-top: var(--space-sm); }
#query-history-columns label { display: flex; align-items: center; gap: var(--space-xs); }
.query-history-metadata { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: var(--space-xs) var(--space-lg); font-size: 13px; }
.query-history-metadata dt { color: var(--on-surface-muted); }
.query-history-metadata dd { margin: 0; overflow-wrap: anywhere; }


.downloaded-filters { display: flex; flex-wrap: wrap; gap: var(--space-md); margin: var(--space-lg) 0; }
.downloaded-filters label { flex: 1 1 180px; min-width: 0; }
.downloaded-filters input, .downloaded-filters select { display: block; width: 100%; margin-top: var(--space-xs); box-sizing: border-box; }
.downloaded-filters .register-all { flex: 0 0 auto; align-self: flex-end; }
.downloaded-pages { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-md); }
.downloaded-archived { display: block; margin-top: var(--space-xs); color: var(--on-surface-muted); }
#downloaded-datasets td { vertical-align: top; }
#downloaded-datasets td:first-child { min-width: 220px; }
#downloaded-datasets details { min-width: 110px; max-width: 360px; }
#downloaded-datasets details[open] { min-width: 260px; }
.downloaded-files { padding-left: var(--space-xl); font-size: 12px; overflow-wrap: anywhere; }
.downloaded-files small { display: block; }
#downloaded-datasets td:nth-child(6), #downloaded-datasets td:nth-child(7), #downloaded-datasets td:nth-child(8) { white-space: nowrap; }

.journey-workflow-badge { color: var(--secondary-strong); font-weight: 600; padding: var(--space-sm) var(--space-md); background: var(--secondary-container); border-radius: var(--radius-md); }
.journey-inspection-metrics { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr); gap: var(--space-sm) var(--space-lg); }
.journey-inspection-metrics dt { font-weight: 600; }
.journey-inspection-metrics dd { margin: 0; overflow-wrap: anywhere; }
.journey-data-block pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; padding: var(--space-md); background: var(--surface-sunken); border-radius: var(--radius-md); }
.journey-data-readable { max-height: 480px; overflow: auto; padding: var(--space-sm) var(--space-md); background: var(--surface-sunken);
                         border-radius: var(--radius-md); overflow-wrap: anywhere; }
.journey-data-readable > .statement, .journey-data-readable li > .statement { white-space: pre-wrap; margin: var(--space-xs) 0; }
.journey-data-readable > .journey-readable-fields > dt:first-child { margin-top: var(--space-xs); }
.journey-data-raw { margin-top: var(--space-sm); }
.journey-model-message + .journey-model-message { margin-top: var(--space-md); padding-top: var(--space-sm); border-top: 1px solid var(--outline-subtle); }
.journey-model-message h5, .journey-model-message > summary { margin: var(--space-xs) 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--on-surface-muted); }
.journey-model-message > summary { cursor: pointer; }
.journey-model-message-text h6 { margin: var(--space-md) 0 var(--space-xs); font-size: 13px; }
.journey-model-message-text .statement { white-space: pre-wrap; margin: var(--space-xs) 0; }
.journey-data-raw summary { cursor: pointer; font-size: 12px; color: var(--on-surface-muted); }
#purpose-default-form { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
#purpose-default-form .default-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-sm); }
#purpose-default-form .default-actions button { white-space: nowrap; }
#purpose-default-status, #purpose-default-effort-status { grid-column:1 / -1; margin:0; }
.journey-artifact { margin: var(--space-sm) 0; border:1px solid var(--outline-subtle); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); }
.journey-artifact summary { cursor:pointer; font-weight:600; }
.journey-artifact > a { display:inline-block; margin-top: var(--space-sm); font-size:12px; }
.journey-artifact pre { max-height:320px; }
.journey-ranks { width: 100%; table-layout: fixed; font-size: 12px; }
.journey-ranks td, .journey-ranks th { overflow-wrap: anywhere; vertical-align: top; }
@media (max-width: 600px) { .journey-inspection-metrics { grid-template-columns: 1fr; } .journey-inspection-metrics dd { margin-bottom: var(--space-sm); } }

.dataset-source-group th { text-align: left; background: var(--secondary-container); color: var(--secondary-strong); padding: var(--space-sm) var(--space-md); }
.data-visibility { font-weight: 600; white-space: nowrap; }
.data-visibility.private { color: var(--primary); }
/* The labels editor sits on its own row under its dataset, which has no top border so the two read as one. */
.dataset-labels summary { cursor: pointer; width: max-content; }
.dataset-labels-fields { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-lg); margin: var(--space-sm) 0 var(--space-xs); }
.dataset-labels-fields label { display: flex; align-items: center; gap: var(--space-sm); }
.dataset-labels-fields input, .dataset-labels-fields select { width: 180px; box-sizing: border-box; }
.dataset-describe { margin-top: var(--space-md); }
.dataset-describe-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-sm); }
.dataset-describe-head h4 { margin: 0; font-size: 14px; }
.journey-step-review { margin: var(--space-lg) 0; padding: var(--space-lg); border:1px solid var(--outline-subtle); border-radius: var(--radius-lg); }
.journey-step-review label { display:block; margin: var(--space-md) 0; }
.journey-step-review select,.journey-step-review textarea { display:block; width:100%; box-sizing:border-box; margin-top: var(--space-xs); }
.journey-recovery-notice { padding: var(--space-md) var(--space-lg); border:1px solid var(--success-outline); border-radius: var(--radius-md);
                           background: var(--success-container); margin: var(--space-md) 0; }
.journey-recovery-notice h3 { margin-top:0; color: var(--success); }
.login-page { min-height:100vh; display:grid; place-items:center; padding: var(--space-xl) var(--space-page-gutter-phone); }
.login-panel { width:100%; max-width:440px; margin:auto; padding: var(--space-xl); }
.login-panel h1 { margin: 0 0 var(--space-xl); gap: var(--space-md); font-size: 18px; color: var(--on-surface-strong); }
/* The whole logo with its tagline on its own night (the image carries it), never on white. */
.login-panel .brand-logo-night { width: 100%; border-radius: var(--radius-lg); }
.login-panel h2 { margin: 0; font-size: 16px; }
.login-panel label { display:block; margin: var(--space-lg) 0; font-size: 13px; font-weight: 600; }
.login-panel input { display:block; width:100%; margin-top: var(--space-xs); }
.login-panel button { margin: var(--space-sm) var(--space-sm) 0 0; }
#account-controls[hidden] { display:none; }
/* The run stage is the first heading of a recorded step's dialog and of an agent-history row. */
.journey-workflow-heading { margin: 0; width: 100%; min-width: 0; font-size: 13px; line-height: 1.3; text-align: left; white-space: normal; overflow-wrap: anywhere; text-transform: none; }
.journey-step-dialog > .panel-head { align-items: flex-start; }
.journey-step-dialog .panel-head .journey-workflow-heading { padding: var(--space-md); font-size: 16px; }
.journey-event-heading { margin: var(--space-md) 0 0; color: var(--on-surface-muted); font-weight: 600; }
#agent-history-table .journey-workflow-heading { min-width: 0; padding: var(--space-sm); font-size: 12px; }

#app-info-toggle { display: none; }
@media (max-width: 900px) {
  header { padding: var(--space-xs) var(--space-md); gap: var(--space-xs) var(--space-sm); align-items: center; }
  header > div:first-child { flex: 1; min-width: 0; }
  header h1 { font-size: 15px; }
  .brand { gap: var(--space-xs); padding-top: var(--space-xs); }
  .brand-logo { width: 176px; }
  header #app-description, header #status, header #account-controls { display: none; }
  #app-info-toggle { display: block; min-height: 40px; }
  header.mobile-details-open { max-height: 35dvh; overflow-y: auto; }
  header.mobile-details-open #app-description { display: block; }
  header.mobile-details-open #status { display: block; flex-basis: 100%; }
  header.mobile-details-open #account-controls:not([hidden]) { display: flex; flex-basis: 100%; align-items: center; }
  #account-name { min-width: 0; overflow-wrap: anywhere; }
  nav { padding: 0 var(--space-sm); min-height: 44px; gap: 0; scrollbar-width: none; border-top: 1px solid var(--nav-rule); }
  nav::-webkit-scrollbar { display: none; }
  .rail nav button { flex-shrink: 0; min-height: 44px; white-space: nowrap; padding: var(--space-sm) var(--space-md); font-size: 13px; border-radius: 0; }
  .rail nav button[aria-selected="true"] { background: none; box-shadow: inset 0 -3px 0 var(--secondary); }
  .tab { padding: var(--space-lg) var(--space-page-gutter-phone); }
  .chat-toolbar { padding: var(--space-xs) 0; gap: var(--space-sm); }
  .chat-toolbar label { display: none; }
  .chat-toolbar .saved-chats { order: 2; flex: 1; min-width: 0; }
  .chat-toolbar #saved-chats { min-height: 40px; }
  input, select { font-size: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  dialog { max-width: calc(100vw - var(--space-lg)); max-height: 90dvh; padding: var(--space-lg); }
  .journey-step-dialog { max-width: none; max-height: none; padding: var(--space-md); }
}
/* The "Timeline" and "Flowchart" buttons, and the full page's view switch ("Timeline | Flowchart"). */
.journey-view-controls { align-items: center; margin-bottom: var(--space-sm); }
.journey-view-switch { display: inline-flex; gap: var(--space-xs); border-bottom: 1px solid var(--outline-subtle); }
.journey-view-switch button { min-height: 32px; padding: 0 var(--space-sm); border: 0; border-radius: 0; background: transparent;
                              color: var(--on-surface-muted); box-shadow: inset 0 -2px 0 transparent; }
.journey-view-switch button:hover { background: transparent; color: var(--on-surface-strong); }
.journey-view-switch button[aria-pressed="true"] { color: var(--on-surface-strong); box-shadow: inset 0 -2px 0 var(--secondary); }
.journey-view-switch button:disabled { color: var(--on-surface-muted); cursor: not-allowed; }

/* Figure evidence (core/figures.js): a value read from a figure image, with its caption and transcription. */
.figure-evidence { margin: var(--space-sm) 0; }
.figure-card { margin: var(--space-sm) 0; padding: var(--space-sm) 0; border-top: 1px solid var(--outline-subtle); }
.figure-card:first-of-type { border-top: 0; }
.figure-image { display: block; max-width: 100%; max-height: 420px; margin: var(--space-sm) 0; border: 1px solid var(--outline-subtle); background: var(--surface); }
.figure-caption { margin: var(--space-xs) 0; }
.figure-transcription q { font-family: var(--font-data); }
/* Terms and permissions: an error sits next to the field that needs action (terms-register/1). */
.running-step { margin: 0 0 var(--space-xxs); overflow-wrap: anywhere; }
.running-name { font-weight: 600; overflow-wrap: anywhere; }
#running td .help { margin: 0; }
#running table { min-width: 760px; }
#running-questions td:first-child { min-width: 160px; }
#running-questions td:nth-child(4) { min-width: 200px; }
.running-filters { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); margin-bottom: var(--space-sm); }
.running-filters input, .running-filters select { width: 100%; min-width: 0; box-sizing: border-box; }
.running-filters .actions { align-self: end; }
#running-questions td:nth-child(2) { white-space: nowrap; }
#running-questions td:nth-child(3) { min-width: 200px; max-width: 360px; overflow-wrap: anywhere; }
#running-questions td:nth-child(n+5):nth-child(-n+7), #running-batches td:nth-child(5) { white-space: nowrap; }
#terms-raise { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#terms-raise > h3 { margin: 0; }
#terms-raise .span-all { grid-column: 1 / -1; }
#terms-raise textarea { width: 100%; min-width: 0; resize: vertical; }
#terms-raise small.help { margin: var(--space-xxs) 0 0; }
@media (max-width: 700px) { #terms-raise { grid-template-columns: minmax(0, 1fr); } }
#terms-panel [aria-invalid="true"] { outline: 2px solid var(--error); outline-offset: 1px; }
.badge.superseded { color: var(--on-surface-muted); }
.badge.storage-mount { font-family: var(--font-data); font-size: 12px; }

/* Produced files (docs/scientist-files.md): the answer's Files section and a file's own view. */
.file-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-xs) var(--space-md); margin: var(--space-sm) 0; }
.file-facts dt { font-weight: 600; }
.file-facts dd { margin: 0; overflow-wrap: anywhere; }
.produced-figure { display: block; max-width: 100%; height: auto; border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); margin: var(--space-sm) 0; background: var(--surface); }

/* Tools page: one table for every group, so the columns line up; each group's tools follow a heading row. */
.tools-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-sm) var(--space-md); align-items: end;
                 margin-bottom: var(--space-sm); }
.tools-filters label { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; font-size: 13px; font-weight: 600; color: var(--on-surface); }
.tools-filters input, .tools-filters select { width: 100%; min-width: 0; }
@media (max-width: 640px) { .tools-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tools-image-list { margin: var(--space-sm) 0; }
.tools-image-list p { margin: var(--space-xs) 0 0; overflow-wrap: anywhere; }
#readers [hidden] { display: none; }  /* a button and a form set a display that [hidden] alone loses to */
.readers-editor { margin: var(--space-md) 0; }
.readers-editor td input { width: 100%; min-width: 0; }
.readers-editor td:first-child { width: 12rem; }
#readers-facts td:first-child { width: auto; overflow-wrap: anywhere; }
.readers-editor h4 { margin: var(--space-md) 0 var(--space-xs); }
.readers-editor .readers-check { flex-direction: row; align-items: center; gap: var(--space-sm); }
.readers-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; margin-top: var(--space-md); }
.readers-actions > :first-child { margin-right: auto; }
#readers-lists td:last-child { white-space: nowrap; }
#readers-lists td:last-child button { margin-right: var(--space-xs); }
.tools-table { table-layout: fixed; min-width: 820px; }
.tools-table td { overflow-wrap: anywhere; }
.tools-tool { font-weight: 600; }
.tools-about { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
               margin-top: var(--space-xxs); font-size: 12px; color: var(--on-surface-muted); }
.tools-aside { display: block; font-size: 12px; color: var(--on-surface-muted); }
.tools-state::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: var(--space-sm); border-radius: var(--radius-full);
                       background: currentColor; vertical-align: 1px; }
.tools-table tr.selected td { background: var(--surface-selected); }
.tools-table tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.tools-table tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* A tool's rules (GET /api/tools/{id}/rules): one group per kind of rule, read only. */
.tools-rules { margin-top: var(--space-md); }
.tools-rules-group { border-top: 1px solid var(--outline-subtle); padding-top: var(--space-sm); margin-top: var(--space-md); }
.tools-rules-table { table-layout: auto; min-width: 760px; }
.tools-rules-table td:first-child { min-width: 136px; }
.tools-rules-table .tools-state { white-space: nowrap; }
.tools-rules-table td { overflow-wrap: anywhere; vertical-align: top; }
.tools-rules-list { margin: 0; padding-left: var(--space-xl); }
.tools-rules-list li { margin-bottom: var(--space-sm); }
.tools-rules-text { display: block; color: var(--on-surface); }
.tools-rules-quote { font-style: italic; color: var(--on-surface-strong); }

/* Memory page (lab/static/pages/memory.js) */
#memory button[hidden] { display: none; }
.memory-command { flex-wrap: wrap; align-items: center; }

/* Benchmark: a paired batch's dynamic − fixed row */
.suite-delta td { font-style: italic; border-top: 1px dashed var(--outline-subtle); }

/* The issue tracker keeps actions in the table and the case editor in a labelled dialog. */
.issues-filters { grid-template-columns: minmax(200px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; margin-bottom: var(--space-md); }
.issues-table { min-width: 850px; }
.issues-table .issue-title { text-align: left; min-width: 180px; max-width: 300px; }
.issue-actions { flex-wrap: nowrap; }
.issue-refs { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xxs); overflow-wrap: anywhere; }
.issue-detail { margin-top: var(--space-lg); padding: var(--space-lg); border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); }
.issue-detail h3 { margin: 0; font-size: 16px; }
.issue-detail h4 { margin: var(--space-md) 0 var(--space-xs); }
.issue-copy { white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }
.issues-next { margin-top: var(--space-lg); font-size: 13px; color: var(--on-surface-muted); }
#issues-editor { max-height: 90vh; overflow-y: auto; }
.issues-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.issues-fields .issue-wide { grid-column: 1 / -1; }
.issues-fields textarea { width: 100%; resize: vertical; }
.issue-form-actions { justify-content: flex-end; margin-top: var(--space-md); }
.query-history-actions { display: flex; gap: var(--space-sm); white-space: nowrap; }
@media (max-width: 650px) { .issues-filters, .issues-fields { grid-template-columns: 1fr; } }

/* ---- Touch screens: iPhone and iPad ---------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* viewport-fit=cover lets the page reach under the notch, the home indicator and (a home-screen app) the status bar:
   content stays inside the safe area. */
.tab { padding-left: max(var(--space-page-gutter), env(safe-area-inset-left));
       padding-right: max(var(--space-page-gutter), env(safe-area-inset-right)); }
@media (min-width: 901px) {
  .rail > header > div:first-child { padding-top: max(var(--space-xl), env(safe-area-inset-top)); }
  .rail { padding-left: env(safe-area-inset-left); }
}
@media (max-width: 900px) {
  .rail > header { padding: max(var(--space-xs), env(safe-area-inset-top)) max(var(--space-md), env(safe-area-inset-right))
                   var(--space-xs) max(var(--space-md), env(safe-area-inset-left)); }
  .rail nav { padding-left: max(var(--space-sm), env(safe-area-inset-left)); padding-right: max(var(--space-sm), env(safe-area-inset-right)); }
  .tab { padding-left: max(var(--space-page-gutter-phone), env(safe-area-inset-left));
         padding-right: max(var(--space-page-gutter-phone), env(safe-area-inset-right)); }
}
/* A finger, not a mouse: 44px targets, and fields at 16px so Safari does not zoom into the one tapped. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  button, .button, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { min-height: var(--space-control-height-touch); }
  td button:not(.link) { min-height: 40px; }
  #query-history-table button.query-star { min-width: 40px; min-height: 40px; font-size: 21px; }
  .page-tabs button { min-height: var(--space-control-height-touch); }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  summary { padding: var(--space-md) 0; }
  .rail nav button, #rail-toggle, #app-info-toggle { min-height: var(--space-control-height-touch); }
  .history-sort { min-height: 40px; }
}
/* No hover on a touch screen: a tapped row or button must not stay highlighted; a press shows instead. */
@media (hover: none) {
  button:hover, .button:hover { background: var(--surface); color: var(--primary); }
  button.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  button.danger:hover { background: var(--surface); border-color: var(--error-outline); color: var(--error); }
  button.link:hover { background: none; }
  .rail nav button:hover { background: none; }
  tr.clickable:hover:not(.row-running):not(.row-cancelled) td { background: transparent; }
  button:active:not(:disabled), .button:active { background: var(--primary-container); color: var(--primary-strong); }
  button.primary:active:not(:disabled) { background: var(--accent-strong); color: var(--on-accent); }
}
/* Filters fold behind one button on phones and tablets in portrait (core/touch.js); the search field stays. */
.filters-toggle { display: none; }
@media (max-width: 900px) {
  .filters-toggle { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); }
  form.filters-collapsible:not(.filters-open) > :not(.filters-keep) { display: none; }
}
/* A long page explanation shows two lines on a phone, with More to read it all (core/touch.js). */
p.help-long:not(.open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.help-more { display: inline; margin: calc(var(--space-xs) * -1) 0 var(--space-sm); font-size: 13px; }
.help-more[hidden] { display: none; }
/* On a phone a history table is a list of cards: each cell a labelled line (core/touch.js copies the column names),
   the column headings a row of sort buttons. */
@media (max-width: 640px) {
  table.cards { min-width: 0 !important; }  /* the tables' own minimum widths are for the scrolled desktop table */
  table.cards, table.cards tbody, table.cards tr { display: block; width: auto; }
  table.cards thead { display: block; }
  table.cards thead tr { display: flex; flex-wrap: wrap; gap: var(--space-xs); padding: 0 0 var(--space-sm); }
  table.cards thead th { display: block; padding: 0; border: 0; background: none; }
  table.cards thead th:not(:has(button, input)) { display: none; }
  table.cards thead th .history-sort { border: 1px solid var(--outline-subtle); border-radius: var(--radius-full); padding: 0 var(--space-md);
                                       font-size: 12px; background: var(--surface-sunken); }
  table.cards thead th input { margin: var(--space-sm); }
  table.cards tbody tr { margin: 0 0 var(--space-sm); padding: var(--space-xs) var(--space-md); border: 1px solid var(--outline-subtle);
                         border-radius: var(--radius-md); background: var(--surface); }
  table.cards td { display: grid; grid-template-columns: minmax(6.5em, 30%) minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-xxs) 0;
                   border: 0; background: none !important; box-shadow: none !important; max-width: none; white-space: normal !important;
                   overflow-wrap: anywhere; }
  table.cards td::before { content: attr(data-label); color: var(--on-surface-muted); font-size: 12px; font-weight: 600; }
  table.cards td:not([data-label]), table.cards td[data-label=""] { display: block; }
  table.cards td:not([data-label])::before, table.cards td[data-label=""]::before { content: none; }
  table.cards td:empty { display: none; }
  table.cards tr.row-running { background: var(--info-container); box-shadow: inset 3px 0 0 var(--info); }
  table.cards tr.row-cancelled { background: var(--error-container); box-shadow: inset 3px 0 0 var(--error); }
  table.cards .query-history-actions, table.cards td > .actions { flex-wrap: wrap; }
}
/* A phone on its side: one bar for the name and the sections, so the page keeps its height. */
@media (max-width: 900px) and (max-height: 500px) {
  .rail { display: flex; flex-wrap: wrap; align-items: center; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .rail > header { display: contents; }  /* the mark, the sections, then App info */
  .rail > header > div:first-child { flex: none; padding: 0 var(--space-md); }
  #app-info-toggle { order: 2; margin: 0 var(--space-md); }
  .rail > header > .status, .rail > header > #account-controls { order: 3; flex-basis: 100%; padding: 0 var(--space-md) var(--space-xs); }
  .rail .brand-logo { width: 132px; }
  .rail .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .rail nav { flex: 1; order: 1; border-top: 0; padding: 0; }
  .tab { padding-top: var(--space-sm); }
}

/* Chat (pages/chatbot.js): conversations beside one thread, the composer under it; one column on a phone. */
.chatbot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: var(--space-lg); align-items: start; }
.chatbot.chatbot-journey-collapsed { grid-template-columns: minmax(0, 1fr) auto; }
.chatbot.chatbot-no-steps { grid-template-columns: minmax(0, 1fr); }
.chatbot-journey[hidden] { display: none; }
.chatbot-toolbar { padding-top: 0; }
.chatbot-identity { margin: 0; }
.chatbot-identity:empty { display: none; }
.chatbot-question-id { margin: var(--space-xxs) 0 0; text-align: right; }
.chatbot-id { user-select: all; overflow-wrap: anywhere; }
/* Saved chats keeps v1's size, not the page's width; its list opens under the box and is as wide as it. */
.chatbot-toolbar .saved-chats { flex: 0 1 560px; position: relative; }
#chatbot-conversations-status:empty { display: none; }
/* The steps of the question in focus beside the thread (v1's journey panel): v1's step list, live while it works. */
.chatbot-journey { background: var(--surface); border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); padding: var(--space-md);
  position: sticky; top: var(--space-lg); max-height: calc(100dvh - var(--space-xxxl)); overflow: auto; min-width: 0; }
.chatbot-journey-collapsed .chatbot-journey-body { display: none; }
.chatbot-journey-collapsed .chatbot-journey h2 { display: none; }
.chatbot-journey-collapsed .chatbot-journey .run-label-age { display: none; }
.chatbot-journey-question { margin: 0; font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1200px) {
  .chatbot, .chatbot.chatbot-journey-collapsed { grid-template-columns: minmax(0, 1fr); }
  .chatbot-journey { grid-column: 1; position: static; max-height: none; }
  .chatbot-journey-collapsed .chatbot-journey h2 { display: block; }
}
/* On a wide window the Chat page fills the window, as v1's did (owner, 12 November 2026: "steps section should be all
   height til the bottom ... same for chat window...copy from v1"; lab/static/v1/style.css, "#chat"): the page itself
   does not scroll; the thread and the Steps panel reach the bottom and each scrolls on its own, and the composer stays
   at the bottom, resized from its top edge. Below this width the page keeps its one scrolling column. */
@media (min-width: 1201px) {
  body:has(#chatbot:not([hidden])) { height: 100dvh; min-height: 0; overflow: hidden; grid-template-rows: minmax(0, 1fr); }
  body:has(#chatbot:not([hidden])) > .rail { height: 100%; }
  /* It also takes the window's whole width, as v1's "#chat" does (owner, 12 November 2026: "v1 ... using full width on
     larger screens and not leaving empty spaces on the side"): no content-width limit on this page, the Steps panel a
     third of the width instead of at most 360px, and an answer as wide as the thread. */
  #chatbot { height: 100%; min-height: 0; box-sizing: border-box; padding-top: var(--space-lg); padding-bottom: var(--space-lg);
    max-width: none; }
  #chatbot > .chatbot { height: 100%; grid-template-rows: minmax(0, 1fr); align-items: stretch;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  #chatbot > .chatbot.chatbot-journey-collapsed { grid-template-columns: minmax(0, 1fr) auto; }
  #chatbot > .chatbot.chatbot-no-steps { grid-template-columns: minmax(0, 1fr); }
  #chatbot .chatbot-message { max-width: 100%; }
  #chatbot .chatbot-lab { width: 100%; }
  #chatbot .chatbot-main { display: flex; flex-direction: column; min-height: 0; }
  #chatbot .chatbot-main > * { flex-shrink: 0; }
  #chatbot .chatbot-thread { flex: 1 1 0; min-height: 0; max-height: none; }
  #chatbot .chatbot-journey { position: static; max-height: none; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: var(--space-sm); }
  #chatbot .chatbot-journey[hidden] { display: none; }
  #chatbot .chatbot-journey > .panel-head { flex-shrink: 0; }
  #chatbot .chatbot-journey-body { flex: 1; min-height: 0; overflow: auto; }
  #chatbot .chatbot-journey-collapsed .chatbot-journey { align-self: start; }
  #chatbot .chatbot-journey-collapsed .chatbot-journey-body { display: none; }
  /* The composer, v1's ".ask": a bordered box with a handle on its top edge that is dragged up to enlarge the input. */
  #chatbot .chatbot-form { position: relative; border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md) var(--space-md); }
  #chatbot .chatbot-form textarea { resize: none; }
  #chatbot-text-resize { position: absolute; top: 0; left: var(--space-md); right: var(--space-md); height: var(--space-lg);
    display: grid; place-items: center; cursor: ns-resize; touch-action: none; }
  #chatbot-text-resize::after { content: ''; display: block; width: 44px; height: 4px; border-radius: var(--radius-sm); background: var(--outline); }
  #chatbot-text-resize:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--radius-sm); }
}
@media (max-width: 1200px) { #chatbot-text-resize { display: none; } }
.chatbot-main { display: grid; gap: var(--space-md); min-width: 0; }
.chatbot-thread { display: grid; gap: var(--space-lg); align-content: start; max-height: calc(100dvh - 260px); min-height: 240px; overflow-y: auto;
  padding: var(--space-md); background: var(--surface-raised); border: 1px solid var(--outline-subtle); border-radius: var(--radius-lg); }
.chatbot-intro { margin: auto 0; }
.chatbot-turn { display: grid; gap: var(--space-sm); }
.chatbot-message { border-radius: var(--radius-lg); padding: var(--space-md); max-width: min(100%, 880px); min-width: 0; }
.chatbot-person { justify-self: end; background: var(--primary-container); border: 1px solid var(--outline-variant); }
.chatbot-lab { justify-self: start; background: var(--surface); border: 1px solid var(--outline-subtle); width: min(100%, 880px); }
.chatbot-text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* The answer's Markdown as formatted text (pages/chat-answer.js): never parsed as HTML. */
.chatbot-rendering { overflow-wrap: anywhere; }
.chatbot-rendering > :first-child { margin-top: 0; }
.chatbot-rendering .md-paragraph { margin: var(--space-xs) 0; }
.chatbot-rendering .md-heading { margin: var(--space-md) 0 var(--space-xs); }
.chatbot-rendering .md-list { margin: var(--space-xs) 0; padding-left: var(--space-xl); }
.chatbot-rendering .md-quote { margin: var(--space-xs) 0; padding-left: var(--space-sm); border-left: 3px solid var(--outline); }
.chatbot-rendering .md-code { overflow-x: auto; padding: var(--space-sm); background: var(--surface-sunken); border-radius: var(--radius-sm); }
.chatbot-rendering .md-table-wrap { overflow-x: auto; }
.chatbot-rendering .md-table { border-collapse: collapse; }
.chatbot-rendering .md-table th, .chatbot-rendering .md-table td { border: 1px solid var(--outline); padding: var(--space-xxs) var(--space-sm); text-align: left; vertical-align: top; }
.chatbot-progress { margin: var(--space-xs) 0; }
.chatbot-progress-head { margin: 0; font-weight: 600; }
.chatbot-progress-steps { margin: var(--space-xxs) 0 0; padding-left: var(--space-xl); }
.chatbot-files h4 { margin: var(--space-sm) 0 var(--space-xxs); }
.chatbot-file-list { margin: 0; padding-left: var(--space-xl); }
.chatbot-figure { margin: var(--space-xs) 0; }
.chatbot-figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--outline); border-radius: var(--radius-sm); }
.chatbot-cost { margin: var(--space-xs) 0 0; }
.chatbot-earlier { max-height: 30vh; overflow: auto; border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); padding: var(--space-sm); }
.chatbot-earlier-items { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); }
.chatbot-data-files { gap: var(--space-xs) var(--space-sm); }
.chatbot-data-files:empty { display: none; }
.chatbot-earlier-items li { display: flex; gap: var(--space-sm); align-items: baseline; overflow-wrap: anywhere; }
.chatbot-how { margin-top: var(--space-xs); }
.chatbot-sources > summary { cursor: pointer; }
.chatbot-source { border-top: 1px solid var(--outline-subtle); padding: var(--space-sm) 0; }
.chatbot-source:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.chatbot-source-title { margin: 0; overflow-wrap: anywhere; }
.chatbot-source-branches { margin: 0; padding-left: var(--space-xl); }
.chatbot-payload pre { max-height: 40vh; }
.chatbot-fingerprint { overflow-wrap: anywhere; }
.chatbot-how > summary { cursor: pointer; }
.chatbot-state { font-weight: 600; margin: 0 0 var(--space-xs); }
.chatbot-state.ok { color: var(--success); } .chatbot-state.bad { color: var(--error); }
.chatbot-state.warn { color: var(--warning); } .chatbot-state.pending { color: var(--info); }
.chatbot-card { border: 1px solid var(--warning-outline); background: var(--warning-container); border-radius: var(--radius-md);
  padding: var(--space-md); margin: var(--space-sm) 0; display: grid; gap: var(--space-xs); }
.chatbot-card h3, .chatbot-card h4 { margin: 0; }
/* The planner's question is a message in the thread, answered in the chat input: no form, only its words and Cancel. */
.chatbot-card.chatbot-ask { background: transparent; border: 0; border-left: 3px solid var(--warning-outline); border-radius: 0;
  padding: var(--space-xs) var(--space-md); }
/* A card that no longer waits (approved by the person or by the harness settings, changed, cancelled) is not a request
   any more: no warning yellow; an approved plan's heading is in the success colour. */
.chatbot-card.decided { border-color: var(--outline-subtle); background: transparent; }
.chatbot-card.chatbot-ask.decided { border-left-color: var(--outline-variant); }
/* A decided plan folds under its heading: open while its question runs, folded once it ended. */
.chatbot-card.chatbot-plan { display: block; }
.chatbot-plan-summary > h3 { display: inline; }
.chatbot-plan[data-outcome="accept"] .chatbot-plan-summary > h3 { color: var(--success); }
.chatbot-plan-body { display: grid; gap: var(--space-xs); margin-top: var(--space-sm); }
/* A question that failed or was cancelled: the whole turn on a red tint, its state and why, the rest folded. */
.chatbot-lab.chatbot-ended { background: var(--error-container); border-color: var(--error-outline); }
.chatbot-end-reason { margin: 0 0 var(--space-xs); overflow-wrap: anywhere; }
.chatbot-end-reason p { margin: 0 0 var(--space-xxs); }
.chatbot-ended-details { margin: var(--space-xs) 0; }
.chatbot-ended-details > summary { font-weight: 600; }
.chatbot-ask-text { margin: 0; }
.chatbot-card textarea { width: 100%; }
.chatbot-choices { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chatbot-choices button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chatbot-request { border-top: 1px solid var(--warning-outline); padding-top: var(--space-sm); display: grid; gap: var(--space-xs); }
.chatbot-answer { border-top: 1px solid var(--outline-subtle); margin-top: var(--space-sm); padding-top: var(--space-sm); }
.chatbot-answer-kind { font-weight: 600; margin: 0 0 var(--space-xs); }
.chatbot-option { font-weight: 600; }
/* The answer itself leads the card, a little larger, its parts set apart; the other sections fold under their names. */
.chatbot-answer-lead { font-size: 15px; }
.chatbot-answer-lead .md-paragraph { margin: var(--space-sm) 0; }
.chatbot-answer-lead .md-list li + li { margin-top: var(--space-xs); }
.chatbot-answer-notes { margin-top: var(--space-sm); }
.chatbot-answer-section { margin-top: var(--space-xs); }
.chatbot-answer-section > summary { font-weight: 600; }
.chatbot-answer-section > .chatbot-rendering { padding: var(--space-xs) 0 var(--space-xs) var(--space-lg); }
.chatbot-turn-actions { margin-top: var(--space-sm); }
.chatbot-form { display: grid; gap: var(--space-sm); }
.chatbot-form textarea { width: 100%; min-height: var(--space-xxxl); resize: vertical; }
.chatbot-form-actions { align-items: center; }
.chatbot-form-actions .primary { margin-left: auto; }
.chatbot-form.image-drop { outline: 2px dashed var(--primary); outline-offset: 4px; }
.chatbot-turn-images summary { cursor: pointer; color: var(--on-surface-muted); }
.chatbot-turn-image { margin-top: var(--space-xs); }
@media (max-width: 900px) {
  .chatbot, .chatbot.chatbot-journey-collapsed { grid-template-columns: minmax(0, 1fr); }
  .chatbot-journey { grid-column: auto; }
  .chatbot-thread { max-height: none; }
}

/* A history filter only v1 records, hidden while the page shows runtime v2 (pages/history/runtime.js). */
form [data-v1][hidden] { display: none; }
form [data-v2][hidden] { display: none; }
form [data-batches][hidden], form [data-experiments][hidden] { display: none; }

/* Harnesses: each model call's instruction (owner, 7 November 2026: "Instructions should always be editable in the harness"). */
.harness-roles { display: grid; gap: var(--space-sm); }
.harness-role { border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); }
.harness-role > summary { cursor: pointer; }
.harness-role-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-sunken); padding: var(--space-md);
  border-radius: var(--radius-md); max-height: 40vh; overflow: auto; }
.harness-role-edit textarea { width: 100%; }

/* One dataset's page: what is inside, the source's own text, the file's facts. */
.dataset-section { border-top: 1px solid var(--outline-subtle); padding-top: var(--space-md); margin-top: var(--space-lg); }
.dataset-section p, .dataset-section li { max-width: 90ch; overflow-wrap: anywhere; }
.dataset-section h4 { margin: var(--space-md) 0 var(--space-xs); }
.dataset-source-title { font-size: 15px; }
.dataset-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-xs) var(--space-md); margin: 0; }
.dataset-facts dt { color: var(--on-surface-muted); }
.dataset-facts dd { margin: 0; overflow-wrap: anywhere; }

/* One model's page: a section per purpose; each instruction document opens to its exact text. */
.model-purpose { border-top: 1px solid var(--outline-subtle); padding-top: var(--space-md); margin-top: var(--space-lg); }
.model-purpose h4 { margin: var(--space-md) 0 var(--space-xs); }
.model-purpose h5 { margin: var(--space-sm) 0 var(--space-xs); font-size: 13px; }
.model-instruction { margin: var(--space-xs) 0; }
.model-instruction summary { cursor: pointer; overflow-wrap: anywhere; }
.model-instruction pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; padding: var(--space-md);
  background: var(--surface-sunken); border-radius: var(--radius-md); font-size: 12px; }

/* A plan card's flow (deterministic, research, a new method or a mix) and each step in plain words. */
.chatbot-flow { margin: var(--space-xs) 0; }
.chatbot-card .question-steps li + li { margin-top: var(--space-xs); }
.chatbot-step-title { font-weight: 600; }
.chatbot-card .question-steps .help { margin: 0; overflow-wrap: anywhere; }
/* A folded section (a plan step's details, the assumptions of a plan or an answer): its name, opened by the person. */
.chatbot-fold > summary { cursor: pointer; }
.chatbot-fold-count { color: var(--on-surface-muted); font-size: 13px; font-weight: 400; }
.chatbot-other-assumptions, .chatbot-answer-assumptions { margin: var(--space-xs) 0; }
.chatbot-other-assumptions > summary { font-weight: 600; }

/* Code in a step's detail (code_presentation.py): its goal, its language, then the code with its layout kept and lines numbered. */
.journey-code-block { margin: var(--space-sm) 0; }
.journey-code-block > p { margin: 0 0 var(--space-xs); }
.journey-data-block pre.journey-code, pre.journey-code { white-space: pre; overflow-wrap: normal; overflow: auto; tab-size: 4; max-height: 480px;
  font-family: var(--font-data); font-size: 12px; line-height: 1.45; padding: var(--space-md);
  background: var(--surface-sunken); border-radius: var(--radius-md); counter-reset: code-line; }
pre.journey-code .code-line::before { counter-increment: code-line; content: counter(code-line); display: inline-block; width: 4ch; margin-right: 1.5ch;
  text-align: right; color: var(--on-surface-muted); user-select: none; }
.journey-failure { margin: var(--space-sm) 0; padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--error); background: var(--error-container); border-radius: var(--radius-md); }
.journey-failure h4 { margin: 0 0 var(--space-xs); }
.journey-failure pre { white-space: pre-wrap; max-height: 320px; overflow: auto; margin: var(--space-xs) 0 0; }

/* Usability pass (9 Nov): one quiet Refresh with its age, what an empty table says, what a disabled action needs,
   the lab's own question dialogs, and the chat composer's Add menu and recent chats. */
button.quiet { background: none; border-color: transparent; color: var(--primary); font-weight: 400; }
.refresh-control { display: inline-flex; align-items: center; gap: var(--space-sm); margin-left: auto; }
.refresh-age { color: var(--on-surface-muted); font-size: 12px; white-space: nowrap; }
.empty-state { color: var(--on-surface-muted); font-size: 13px; margin: var(--space-sm) 0 var(--space-md); }
.empty-state[hidden], .needs:empty { display: none; }
.needs { margin: var(--space-xs) 0 0; }
dialog.ask-dialog { max-width: min(480px, 95vw); }
.ask-dialog h2 { margin: 0 0 var(--space-sm); font-size: 16px; }
.ask-text { margin: 0 0 var(--space-md); color: var(--on-surface-muted); font-size: 14px; }
.ask-field { display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); font-size: 13px; }
.ask-field input, .ask-field textarea { width: 100%; }
.ask-actions { justify-content: flex-end; }
.add-menu { position: relative; }
.add-menu-list { position: absolute; left: 0; bottom: calc(100% + var(--space-xs)); z-index: 20; display: grid; gap: var(--space-xs);
                 min-width: 220px; padding: var(--space-sm); background: var(--surface); border: 1px solid var(--outline-subtle);
                 border-radius: var(--radius-md); box-shadow: 0 8px 30px var(--shadow-overlay); }
.add-menu-list[hidden] { display: none; }
.add-menu-list > button, .add-menu-list > .button { justify-content: flex-start; text-align: left; border-color: transparent; }
.chatbot-recent-heading { margin: var(--space-lg) 0 var(--space-sm); font-size: 14px; }
.chatbot-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-sm); }
.chatbot-recent li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm); }
.chatbot-recent-open { min-height: var(--space-control-height); text-align: left; }
.chatbot-recent .help { margin: 0; }

/* The harness table: the status control and its two settings stacked in one cell; an archived harness dimmed. */
.harness-status { display: grid; gap: var(--space-xs); min-width: 13rem; max-width: 15rem; }
td > .harness-actions { flex-wrap: wrap; min-width: 9rem; max-width: 15rem; }
.harness-status select { width: 100%; }
.harness-status small { margin: 0; }
.harness-approval-wait { display: flex; gap: var(--space-xs); align-items: center; }
.harness-approval-wait input { width: 5.5rem; }
tr.harness-archived td { color: var(--on-surface-muted); }
.harness-archived-toggle { display: inline-flex; gap: var(--space-xs); align-items: center; margin-bottom: var(--space-sm); }
/* The harness view: any version read only or a draft, shown in place of the table, with its flow, steps, agents, policy,
   runs and versions. */
.harness-view { margin-top: var(--space-sm); }
.harness-back { margin-bottom: var(--space-sm); }
.harness-import { margin-bottom: var(--space-sm); }
.harness-view .panel-head { flex-wrap: wrap; gap: var(--space-sm); }
.harness-view-tabs { display: flex; flex-wrap: wrap; gap: var(--space-xs); border-bottom: 1px solid var(--outline-subtle); margin-bottom: var(--space-md); }
.harness-view-tabs [role="tab"] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; }
.harness-view-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--secondary); color: var(--on-surface-strong); font-weight: 600; }
.harness-view-body td { vertical-align: top; overflow-wrap: anywhere; }
/* The Agents tab: one row per agent and model, under a band for its layer and one for its group (as the Models page). */
.harness-agent-table { width: 100%; }
.harness-agent-table tr.harness-layer th { background: var(--nav); color: var(--on-nav); text-align: left; font-size: 14px; padding: var(--space-sm) var(--space-md); }
.harness-agent-table tr.harness-group th { background: var(--surface-selected); color: var(--on-surface-strong); text-align: left; padding: var(--space-xs) var(--space-md); }
.harness-agent-name { display: grid; gap: var(--space-xxs); min-width: 11rem; max-width: 20rem; }
.harness-agent-name small { margin: 0; }
.harness-docs > summary { cursor: pointer; font-weight: 600; }
.harness-doc { display: grid; gap: var(--space-xs); padding: var(--space-xs) 0; border-top: 1px solid var(--outline-subtle); }
.harness-doc-head { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); align-items: baseline; }
.harness-doc-head details { flex: 1 1 14rem; min-width: 0; }
.harness-doc-head select { max-width: 100%; }
.harness-doc-when { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: baseline; }
.harness-agent-settings > summary { cursor: pointer; font-weight: 600; }
.harness-step-facts h5 { margin: 0 0 var(--space-xs); font-size: 14px; }
.harness-step-detail { margin-bottom: var(--space-md); }
/* A draft in the harness view: one block per step, its settings, tools and condition editable. */
.harness-step { border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); margin: 0 0 var(--space-md); min-width: 0; }
.harness-step legend { font-weight: 600; padding: 0 var(--space-xs); overflow-wrap: anywhere; }
.harness-step h5 { margin: var(--space-sm) 0 var(--space-xs); font-size: 13px; }
.harness-check { display: inline-flex; gap: var(--space-xs); align-items: center; }
.harness-condition { display: grid; gap: var(--space-xs); justify-items: start; }
.harness-clause { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.harness-clause input { min-width: 0; flex: 1 1 10rem; }
.harness-tools { display: grid; gap: var(--space-xs); justify-items: start; max-width: 100%; }
.harness-tools select { max-width: 100%; }
.harness-tool-list { margin: 0; padding-left: var(--space-lg); }
.harness-tool-list li { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-xs); }
.harness-draft > label { display: grid; gap: var(--space-xs); margin-bottom: var(--space-sm); max-width: 40rem; }
.harness-preview-result td:nth-child(-n+3) { white-space: nowrap; }
/* A draft's structure: its inputs and outputs, each step's reads and order as ticks, rules and documents in order. */
.harness-io { border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-md); }
.harness-io > summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.harness-ports td input, .harness-ports td select { min-width: 5rem; max-width: 14rem; }
.harness-checks { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); }
.harness-rules { display: grid; gap: var(--space-xs); justify-items: start; }
.harness-agent td button, .harness-step .actions button { white-space: nowrap; }
/* The flow picture: steps as boxes in columns, the values handed on as lines. It scrolls sideways when it is wide. */
.harness-flow { overflow-x: auto; margin-bottom: var(--space-md); padding: var(--space-sm); border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-md); background: var(--surface-sunken); }
.harness-flow p { margin: var(--space-xs) 0 0; }
.harness-flow-picture { display: block; max-width: none; }
.harness-flow-box rect { fill: var(--surface); stroke: var(--outline); stroke-width: 1; }
.harness-flow-box.port rect { fill: var(--surface-selected); stroke: var(--outline-subtle); }
.harness-flow-box.instruction rect, .harness-flow-box.strategy rect, .harness-flow-box.planned rect { stroke: var(--agent-outline); }
.harness-flow-box.rules rect { stroke: var(--info-outline); }
.harness-flow-box.conditional rect { stroke-dasharray: 5 3; }
.harness-flow-box.pick { cursor: pointer; }
.harness-flow-box.pick:hover rect, .harness-flow-box.pick:focus-visible rect { stroke: var(--primary); stroke-width: 2; }
.harness-flow-box.pick:focus-visible { outline: none; }
.harness-flow-box.selected rect { stroke: var(--primary); stroke-width: 2.5; fill: var(--primary-container); }
.harness-flow-agent { font: 12px var(--font-body); fill: var(--on-surface); }
.harness-flow-name { font: 600 12px var(--font-body); fill: var(--on-surface-strong); }
.harness-flow-detail { font: 12px var(--font-body); fill: var(--on-surface-muted); }
.harness-flow-link { fill: none; stroke: var(--on-surface-muted); stroke-width: 1.25; }
.harness-flow-link.order { stroke-dasharray: 4 3; }
.harness-flow-link:hover { stroke: var(--primary); stroke-width: 2; }
.harness-flow-head { fill: var(--on-surface-muted); }
/* A long list searched by typing: the matches open under the field. */
.harness-picker { position: relative; display: grid; min-width: min(22rem, 100%); max-width: 40rem; }
.harness-picker-list { position: absolute; z-index: 5; top: 100%; left: 0; right: 0; margin: var(--space-xxs) 0 0; padding: var(--space-xs); list-style: none;
  max-height: 18rem; overflow-y: auto; background: var(--surface-raised); border: 1px solid var(--outline); border-radius: var(--radius-md);
  box-shadow: 0 4px 12px var(--shadow); }
.harness-picker-list li { margin: 0; }
.harness-picker-list button { display: grid; gap: var(--space-xxs); width: 100%; text-align: left; border: 0; background: none; padding: var(--space-xs) var(--space-sm);
  min-height: 0; font-weight: 400; white-space: normal; overflow-wrap: anywhere; }
.harness-picker-list button small { margin: 0; }
.harness-pick-many { display: grid; gap: var(--space-xs); }
/* Names as chips with a field to add one. */
.harness-chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.harness-chips input { flex: 1 1 9rem; min-width: 7rem; max-width: 18rem; }
.harness-chip { display: inline-flex; align-items: center; gap: var(--space-xs); padding: var(--space-xxs) var(--space-xs) var(--space-xxs) var(--space-sm);
  border: 1px solid var(--outline-subtle); border-radius: var(--radius-full); background: var(--surface-sunken); overflow-wrap: anywhere; }
.harness-chip button { border: 0; background: none; min-height: 0; padding: 0 var(--space-xs); line-height: 1; }
.harness-obligations { display: grid; gap: var(--space-xs); justify-items: start; }
.harness-runs > label { display: inline-grid; gap: var(--space-xs); margin-bottom: var(--space-sm); }
/* Test runs: the question to run, with its files and datasets, above the tests. */
.harness-test-form { display: grid; gap: var(--space-sm); margin-bottom: var(--space-md); max-width: 60rem; }
.harness-test-form label { display: grid; gap: var(--space-xs); }
.harness-test-form textarea { width: 100%; }
/* The dataset catalogue (owner, 14 November 2026): tags as chips with their ontology ID, a download as a button. */
a.button { text-decoration: none; }
.catalogue-tags { display: inline-flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.catalogue-tag a { font-family: var(--font-data); font-size: 12px; }
.catalogue-problems { margin: var(--space-md) 0; }
.dataset-download { display: flex; align-items: center; gap: var(--space-md); }
/* A dataset's handling note and its editor (owner, 14 November 2026). */
.handling-note textarea { width: 100%; box-sizing: border-box; font-family: var(--font-data); font-size: 12px; }
.dataset-methods .method-step { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-sm) var(--space-md);
  margin: 0 0 var(--space-md); padding: var(--space-sm) var(--space-md); border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); }
.dataset-methods .method-step label { display: flex; flex-direction: column; gap: var(--space-xxs); font-size: 12px; }
.dataset-methods .method-step textarea, .dataset-methods .method-step input, .dataset-methods .method-step select {
  width: 100%; box-sizing: border-box; font-family: var(--font-data); font-size: 12px; }
.dataset-methods table td div { margin: 0 0 var(--space-xxs); }

/* The Dataset Master's conversation (pages/dataset-master-chat.js). */
.dm-chat-log { display: flex; flex-direction: column; gap: var(--space-md); max-height: 60vh; overflow-y: auto; padding: var(--space-sm) 0; }
.dm-chat-message { border: 1px solid var(--outline-subtle); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); max-width: 52rem; }
.dm-chat-person { align-self: flex-end; background: var(--surface-sunken); }
.dm-chat-agent { align-self: flex-start; background: var(--surface-raised); }
.dm-chat-failed { border-color: var(--error-outline); }
.dm-chat-pending { color: var(--on-surface-muted); }
.dm-chat-who { margin: 0 0 var(--space-xs); font-weight: 600; color: var(--on-surface-muted); }
.dm-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-chat-steps { margin-top: var(--space-sm); }
.dm-chat-proposal { margin-top: var(--space-sm); }
.dm-chat-proposal p { margin: var(--space-xs) 0 0; }
.dm-chat-changes { margin-bottom: var(--space-sm); }
.dm-chat-changes ul { margin: var(--space-xs) 0 0; }
.dm-chat-note { max-height: 16rem; overflow: auto; white-space: pre-wrap; }
.dm-chat-form { margin-top: var(--space-md); }
.dm-chat-input { display: block; }
.dm-chat-input textarea { width: 100%; }
