/* The components of DESIGN.md. Values come only from tokens.css; media
   queries name their breakpoint token in a comment, as they cannot read
   custom properties. */

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: var(--radius);
}

html {
  font-synthesis-weight: none;
  font-synthesis-small-caps: none;
  font-synthesis-style: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line-strong) transparent;
}

body {
  margin: 0;
  background: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-regular);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-line-strong) transparent;
}

::selection {
  background: var(--color-accent-dim);
  color: var(--color-text-primary);
}

/* The focus band: one accent band from the border outwards. */
:focus-visible {
  outline: var(--focus-band);
  outline-offset: 0;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.mono,
code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

/* A model by its name, in sans also in a mono context; one no model is
   known by, by its number or text, in mono. */
.model-name {
  font-family: var(--font-sans);
  font-variant-ligatures: normal;
}

.model-name--id {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

/* Fixed, not absolute: Chrome reads text out of flow by absolute
   position as a separate word: "@Lab/members , group". */
.visually-hidden {
  position: fixed;
  width: var(--size-visually-hidden);
  height: var(--size-visually-hidden);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon.icon--filled {
  fill: currentColor;
}

.icon {
  width: var(--size-icon);
  height: var(--size-icon);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: square;
  stroke-linejoin: miter;
  vertical-align: middle;
}

/* An icon or box beside a label that may wrap sits beside its first
   line: the row starts at its top, and this centres the icon on one
   line of the row's line height, which the label shares. */
:is(
    .checkbox-field,
    .message,
    .attachment-tray__note,
    .attachment-tray__refusal,
    .grants__failure,
    .chat-input__flag,
    .entry__failed,
    .entry__error,
    .principal,
    .choice__radio,
    .markdown__image--missing,
    .markdown__image--pending
  )
  > :is(.icon, .checkbox-input, .radio) {
  margin-top: calc((var(--size-line) - var(--size-icon)) / 2);
}

.link {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.link .icon {
  margin-left: var(--space-1);
}

.tertiary {
  color: var(--color-text-tertiary);
}

/* A label set in its container's type: uppercase, its DOM sentence
   case. */
.label-case {
  text-transform: uppercase;
}

/* An uppercase label in a box centres on its cap height: its text box
   is trimmed to the cap line and the baseline, so no room for accents
   or descenders above or below it tips it off the box's centre. */
.badge,
.tab,
.tabs__more-label,
.tab__count,
.switch__option,
.model-menu__level,
.model-button__key,
.button__label,
.button__label .states__state {
  text-box: trim-both cap alphabetic;
}

/* A line of text a row centres beside an icon, a marker or a control
   centres on its cap height too; the row keeps the text's line height
   as its least height (--size-line). */
.nav-heading > .nav-label,
.nav-item__count,
.filter-bar__label,
.empty-state__label > span,
.capability-row__name--boxed > label,
.grants__check-word,
.grants__mark-text,
.grants__remote,
.artifact-name__text,
.user-menu__name,
.model-button__name,
.wordmark__text,
.workspace-switcher__name,
.nav-item__text,
.multi-select__text,
.audit-detail > .truncate,
.capability-row__phrase {
  text-box: trim-both cap alphabetic;
}

.empty-state__label,
.grants__check-label,
.grants__mark,
.artifact-name {
  min-height: var(--size-line);
}

.nav-heading {
  min-height: var(--text-2xs-line);
}

/* A stacked label's states, each a block of its own, so each trims. */
.button__label .states__state {
  display: block;
}

.danger-text {
  color: var(--color-danger);
}

.sentence,
.page-description {
  color: var(--color-text-secondary);
  max-width: var(--measure);
}

.page-description {
  padding: var(--space-4) var(--space-5) 0;
}

.section-label,
.nav-label,
.banner__label,
.code-block__label,
.code-block__count,
.key-values dt,
.table th,
.filter-bar__label,
.pane-header__label,
.nav-heading__link,
.tab__count,
.empty-state__label,
.model-facts dt,
.override-marker,
.field__marker,
.picker__marker,
.advanced__count,
.vm-bar__text,
.vm-marker,
.model-marker,
.capability-row__beyond,
.severity-marker,
.agent-select-bar__label,
.agent-context__label,
.job-bar__label,
.timer-bar__label,
.audit-line__label,
.table__day-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-ligatures: none;
}

.section-label {
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-2);
}

/* Markers and badges */

/* A finding's severity marker, in its tone (DESIGN.md "Markers"). */
.severity-marker--danger {
  color: var(--color-danger);
}

.severity-marker--warning {
  color: var(--color-warning);
}

.severity-marker--quiet {
  color: var(--color-text-tertiary);
}

.marker {
  display: inline-block;
  width: var(--size-marker);
  height: var(--size-marker);
  flex: none;
  background: currentColor;
}

.marker--neutral {
  color: var(--color-line-strong);
}
.marker--accent {
  color: var(--color-accent);
}
.marker--success {
  color: var(--color-success);
}
.marker--warning {
  color: var(--color-warning);
}
.marker--danger {
  color: var(--color-danger);
}

.live {
  animation: pulse var(--duration-pulse) var(--ease-in-out) infinite alternate;
}

/* A busy button's bar: over its bottom border, taking no space. */
.busy-bar {
  position: absolute;
  left: calc(-1 * var(--border-width));
  right: calc(-1 * var(--border-width));
  bottom: calc(-1 * var(--border-width));
  height: var(--border-width-strong);
  background: var(--color-accent);
  pointer-events: none;
}

.busy-bar--idle {
  visibility: hidden;
}

/* A busy row's marker slot is always laid out; idle, it is hidden. */
.busy-marker--idle {
  visibility: hidden;
}

/* Stable layout: every state of a control that changes in place in one
   grid cell, so it takes its largest state's size; the states not
   shown keep their place hidden (and inert). */
.states {
  display: inline-grid;
  align-items: center;
  justify-items: center;
}

.states--end {
  justify-items: end;
}

.states--start {
  justify-items: start;
}

.states__state {
  grid-area: 1 / 1;
  display: inline-flex;
  gap: var(--space-2);
}

.states__state--hidden {
  visibility: hidden;
}

@keyframes pulse {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.35;
  }
}

.badge {
  display: inline-block;
  align-content: center;
  min-height: var(--size-badge);
  padding: 0 var(--space-2);
  border: var(--border-width) solid currentColor;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

/* The marker and an icon, inline before the text, centre on its cap
   height. */
.badge .marker {
  margin-inline-end: var(--space-2);
  vertical-align: calc((1cap - var(--size-marker)) / 2);
  animation: none;
}

/* A badge that changes state in place holds its widest state's width. */
.badge--session {
  min-width: var(--size-badge-session);
}

.badge--vm {
  min-width: var(--size-badge-vm);
}

.badge--job {
  min-width: var(--size-badge-job);
}

.badge--placeholder {
  visibility: hidden;
}

/* A badge whose icon stands in for its marker. */
.badge .icon {
  margin-inline-end: var(--space-1);
  vertical-align: calc((1cap - var(--size-icon)) / 2);
}

.badge.live .marker {
  animation: pulse var(--duration-pulse) var(--ease-in-out) infinite alternate;
}

.badge.live {
  animation: none;
}

.badge--neutral {
  color: var(--color-text-secondary);
  border-color: var(--color-line-strong);
}
.badge--neutral .marker {
  color: var(--color-line-strong);
}
.badge--accent {
  color: var(--color-accent);
  background: var(--color-accent-dim);
}
.badge--success {
  color: var(--color-success);
  background: var(--color-success-dim);
}
.badge--warning {
  color: var(--color-warning);
  background: var(--color-warning-dim);
}
.badge--danger {
  color: var(--color-danger);
  background: var(--color-danger-dim);
}

/* Buttons */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  padding: 0 var(--space-4);
  border: var(--border-width) solid transparent;
  background: transparent;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  /* Centred on its line whatever its first item. */
  vertical-align: middle;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) linear,
    border-color var(--duration-fast) linear,
    color var(--duration-fast) linear;
}

.button--small {
  min-height: var(--size-control-small);
  padding: 0 var(--space-3);
}

/* Its place held while it does not apply, so nothing moves when it
   shows; out of the tab and reading order. */
.button--reserved {
  visibility: hidden;
}

.button--full {
  width: 100%;
}

/* Square; the minimum, so a flex row never shrinks it below its hit
   area. */
.button--icon {
  min-width: var(--size-control);
  padding: 0;
}

.button--icon.button--small {
  min-width: var(--size-control-small);
}

.button--primary {
  background: var(--color-accent);
  color: var(--color-text-on-fill);
}
.button--primary:hover,
.button--primary:active,
.button--primary:focus-visible {
  background: var(--color-text-primary);
}

.button--secondary {
  border: var(--border-control);
}
.button--secondary:hover,
.button--secondary:active,
.button--secondary[aria-pressed="true"] {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
}

.button--ghost {
  color: var(--color-text-secondary);
}
.button--ghost:hover,
.button--ghost:active,
.button--ghost[aria-pressed="true"] {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.button--danger {
  border: var(--border-width) solid var(--color-danger);
  color: var(--color-danger);
}
.button--danger:hover,
.button--danger:active {
  background: var(--color-danger);
  color: var(--color-text-on-fill);
}

.button--destructive:hover,
.button--destructive:active {
  color: var(--color-danger);
}

.button:disabled,
.button[aria-disabled="true"] {
  background: transparent;
  border-color: var(--color-line);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.button--ghost:disabled {
  border-color: transparent;
}

/* Switch: mutually exclusive options in one frame. */
.switch {
  display: inline-flex;
  align-items: stretch;
  flex: none;
  min-height: var(--size-control);
  padding: var(--border-width-strong);
  border: var(--border-control);
  background: var(--color-bg-void);
}

.switch--small {
  min-height: var(--size-control-small);
}

.switch__option {
  align-content: center;
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) linear,
    color var(--duration-fast) linear;
}

.switch--small .switch__option {
  padding: 0 var(--space-2);
}

.switch__option:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.switch__option[aria-checked="true"] {
  background: var(--color-accent);
  color: var(--color-text-on-fill);
}

/* The focus band goes round the whole frame. */
.switch__option:focus-visible {
  outline: none;
}

.switch:has(:focus-visible) {
  outline: var(--focus-band);
  outline-offset: 0;
}

.switch[aria-disabled="true"] {
  border-color: var(--color-line);
}

.switch[aria-disabled="true"] .switch__option {
  color: var(--color-text-disabled);
  background: transparent;
  cursor: not-allowed;
}

.switch[aria-disabled="true"] .switch__option[aria-checked="true"] {
  background: var(--color-bg-hover);
}

/* Checkbox toggle: a label shaped as a small secondary button. */
.checkbox-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  min-height: var(--size-control-small);
  padding: 0 var(--space-3);
  border: var(--border-control);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) linear,
    border-color var(--duration-fast) linear,
    color var(--duration-fast) linear;
}

.checkbox-toggle:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
}

.checkbox-toggle--checked {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.checkbox-toggle .checkbox-input:focus-visible {
  outline: none;
}

.checkbox-toggle:has(:focus-visible) {
  outline: var(--focus-band);
  outline-offset: 0;
}

.checkbox-toggle--disabled,
.checkbox-toggle--disabled:hover {
  background: transparent;
  border-color: var(--color-line);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

/* App shell */

/* Only the shell reads its offset, which moves every frame while a
   page under a keyboard pans: not inherited, so a change restyles the
   shell alone. */
@property --viewport-top {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

/* DESIGN.md "Visual viewport": as tall as the visual viewport and on
   it, which code sets while it is unzoomed, so an on-screen keyboard
   shortens the frame instead of covering it. */
.shell {
  display: grid;
  grid-template-columns: var(--size-sidebar) minmax(0, 1fr);
  grid-template-rows: minmax(var(--size-topbar), auto) minmax(0, 1fr);
  height: 100vh;
  height: var(--viewport-height, 100dvh);
  translate: 0 var(--viewport-top, 0);
}

/* DESIGN.md "Safe areas": the bar runs under the status bar and the
   notch, its content inside them. */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: calc(var(--size-topbar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(var(--space-4) + env(safe-area-inset-right)) 0
    calc(var(--space-4) + env(safe-area-inset-left));
  background: var(--color-bg-void);
  border-bottom: var(--border);
}

/* The lost stream's badge takes the free room before the user menu. */
.topbar__status {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.topbar__status .badge {
  flex-shrink: 0;
}

/* Skip link: first in the tab order, shown at the top bar's left only
   while focused. */
.skip-link {
  position: fixed;
  top: calc((var(--size-topbar) - var(--size-control-small)) / 2);
  left: var(--space-4);
  z-index: var(--layer-toast);
}

.skip-link:not(:focus) {
  width: var(--size-visually-hidden);
  height: var(--size-visually-hidden);
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The page dimmed under the narrow-view menu. */
.sidebar-scrim {
  display: none;
}

.topbar__menu {
  display: none;
}

/* The sidebar beside the page: from --breakpoint-md, from
   --breakpoint-lg on a touch screen. */
/* --breakpoint-md, --breakpoint-lg */
@media (width >= 80em), (width >= 48em) and (not (pointer: coarse)) {
  .shell--navigation-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .shell--navigation-hidden .sidebar {
    display: none;
  }
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  text-decoration: none;
  font-variant-ligatures: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-3);
  background: var(--color-bg-base);
  border-right: var(--border);
}

/* The items keep their text's height; the column scrolls instead. */
.sidebar > * {
  flex-shrink: 0;
}

.version {
  margin-top: auto;
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
}

.main {
  container: main / inline-size;
  overflow: auto;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  background: var(--color-bg-base);
  min-width: 0;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
  grid-template-areas: "title facts actions";
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border);
}

.page-header--breadcrumb {
  grid-template-areas:
    "crumb crumb actions"
    "title facts actions";
}

.page-header__facts {
  grid-area: facts;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.page-header__breadcrumb {
  grid-area: crumb;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
  /* Its line is kept while the names load. */
  min-height: var(--text-xs-line);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

.crumb {
  min-width: 0;
  font-family: var(--font-sans);
  color: var(--color-text-secondary);
  text-decoration: none;
}

.crumb:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.crumb__separator {
  color: var(--color-text-tertiary);
  flex: none;
}

/* The title line keeps its height while the item's name loads. */
.page-header__title {
  grid-area: title;
  outline: none;
  min-width: 0;
  min-height: var(--text-xl-line);
  font-size: var(--text-xl);
  line-height: var(--text-xl-line);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
}

/* An item's name as the title (DESIGN.md "Title box"): at most two
   lines, then cut with "…", a word wider than the line breaking
   anywhere; its tooltip holds the whole name. */
h1.page-header__title:not(.mono, .visually-hidden) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* A title that is an identifier, such as a document's path. */
.page-header__title.mono {
  font-weight: var(--weight-medium);
}

.header-cost {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-variant-ligatures: none;
  white-space: nowrap;
}

/* Held from the first render, up to $9999.99; each further digit
   pushes what follows once. */
.session-cost {
  display: inline-block;
  min-width: var(--size-cost);
}

/* The session's disk total, its place held as the cost's. */
.session-disk {
  display: inline-block;
  min-width: var(--size-disk);
}

.page-header__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* A title box's header: the title column as wide as the title, so the
   facts follow it, and the badge, cost and actions centre on the box. */
.page-header--title-box {
  align-items: start;
}

.page-header--title-box.page-header--breadcrumb {
  grid-template-areas:
    "crumb crumb crumb"
    "title facts actions";
}

.page-header--title-box .page-header__facts,
.page-header--title-box .page-header__actions {
  min-height: var(--size-control);
  align-items: center;
}

/* The title box starts its padding and border before the content edge,
   so its text lines up with the breadcrumb. */
.page-header--title-box .page-header__title {
  margin-inline-start: calc(-1 * (var(--space-3) + var(--border-width)));
}

/* An item's name, its rename button inline after its last word or its
   "…", centred on that line without growing it. */
.rename-title {
  min-width: 0;
}

/* The rename button hangs from a zero-width anchor after the last
   character, so it never changes where the lines break: it lies in the
   room the box keeps at each line's end (.title-box--pen). */
.rename-title__anchor {
  position: relative;
  display: inline-block;
  width: 0;
  height: var(--text-xl-line);
  vertical-align: top;
}

.rename-title__button {
  position: absolute;
  top: calc((var(--text-xl-line) - var(--size-control-small)) / 2);
  left: var(--space-1);
}

/* The "More actions" menu holds what does not fit a phone's header. */
.page-header__more {
  display: none;
}

.page-body {
  padding: var(--space-5);
}

.page-body--form {
  max-width: calc(var(--size-column) + 2 * var(--space-5));
}

/* Navigation */

.nav-label {
  color: var(--color-text-tertiary);
  margin: var(--space-4) 0 var(--space-2);
}

.nav-label:first-child {
  margin-top: 0;
}

.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.nav-heading__link {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color var(--duration-fast) linear;
}

.nav-heading__link:hover {
  color: var(--color-accent);
}

.nav-heading__link[aria-current="page"] {
  color: var(--color-text-primary);
}

/* Its height, --size-control, a touch target's in the narrow-view menu
   and on a touch screen; a session's under its project is smaller. */
.sidebar {
  --nav-item-height: var(--size-control);
  --nav-session-height: var(--size-control-small);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--nav-item-height, var(--size-control));
  padding: 0 var(--space-3);
  border-left: var(--border-width-strong) solid transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  text-decoration: none;
  transition:
    background-color var(--duration-fast) linear,
    color var(--duration-fast) linear;
}

.nav-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.nav-item[aria-current="page"] {
  background: var(--color-bg-selected);
  color: var(--color-text-primary);
  border-left-color: var(--color-accent);
}

.nav-item--mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.nav-item__marker {
  display: inline-flex;
  flex: none;
}

.nav-item__text {
  flex: 1;
  min-width: 0;
}

.nav-item__count {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* A row of the tree: the toggle's slot, then the item. The row starts at
   its top, as a long name wraps. */
.nav-project {
  display: flex;
  align-items: flex-start;
}

.nav-project__toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size-control-small);
  min-height: var(--size-control-small);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
}

.nav-project__toggle:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* The toggle's slot of an item with nothing under it, so names align. */
.nav-project__spacer {
  flex: none;
  width: var(--size-control-small);
  min-height: var(--size-control-small);
}

/* The toggle's slot and the add button are centred on the item's first
   line, which the item's height centres, at every item height. */
.nav-project__toggle,
.nav-project__spacer,
.nav-project__add {
  margin-top: calc((var(--nav-item-height, var(--size-control)) - var(--size-control-small)) / 2);
}

/* "My sessions" has an icon in its toggle slot, as it has no toggle. */
.nav-project__icon {
  display: inline-grid;
  place-items: center;
  color: var(--color-text-tertiary);
}

.nav-project__link {
  flex: 1;
  min-width: 0;
}

.nav-item--session {
  min-height: var(--nav-session-height, var(--size-control-small));
  margin-left: var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.nav-empty {
  display: flex;
  align-items: center;
  min-height: var(--size-control-small);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}

/* The tree's failure: `// ERROR`, then "Retry". */
.nav-error {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--size-control-small);
  padding: 0 var(--space-3);
}

.nav-error__label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-danger);
  text-transform: uppercase;
}

/* User menu */

.menu-button {
  position: relative;
}

.user-menu__trigger {
  text-transform: none;
  letter-spacing: normal;
}

.user-menu__name {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.menu {
  /* In the top layer (popover), placed from the trigger's rect. */
  position: fixed;
  inset: auto;
  margin: 0;
  overflow: visible;
  color: inherit;
  min-width: min(var(--size-sidebar), 100%);
  max-width: calc(100vw - 2 * var(--space-4));
  padding: var(--space-1) 0;
  background: var(--color-bg-raised);
  border: var(--border);
}

.menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* Items of one composite abut: their band is drawn inside. */
.menu__item:focus-visible,
.tab:focus-visible,
.tabs__more-trigger:focus-visible,
.nav-item:focus-visible,
.nav-project__toggle:focus-visible,
.nav-project__add:focus-visible,
.side-pane__collapse:focus-visible,
.send-split .button:focus-visible {
  outline-offset: var(--focus-offset-inset);
}

.menu__item--danger,
.menu__item--danger:hover,
.menu__item--danger:focus-visible {
  color: var(--color-danger);
}

.menu__divider {
  margin: var(--space-1) 0;
  border: 0;
  border-top: var(--border-subtle);
}

/* Tabs */

/* The row clips until its fit is measured; then the tabs that do not
   fit are in its More menu. */
.tabs {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border-bottom: var(--border);
}

.tab,
.tabs__more-trigger {
  display: inline-block;
  flex: none;
  align-content: center;
  min-height: var(--size-control);
  white-space: nowrap;
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: var(--border-width-strong) solid transparent;
  background: transparent;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--duration-fast) linear;
}

a.tab {
  text-decoration: none;
}

.tab:hover,
.tabs__more-trigger:hover {
  color: var(--color-text-primary);
}

.tab[aria-selected="true"],
.tab[aria-pressed="true"],
.tab[aria-current="page"],
.tabs__more--current .tabs__more-trigger {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-accent);
}

/* More: after the last tab that fits, its label then its chevron. */
.tabs__more {
  flex: none;
  align-self: stretch;
  display: flex;
}

.tabs__more .menu-button {
  display: flex;
}

.tabs__more-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.tabs__more-trigger .tab__count {
  margin-left: var(--space-1);
}

/* A tab in More: the tab's type, its count at the item's end as a
   navigation item's; the shown tab's item as a current one. */
.tabs__item {
  border-inline-start: var(--border-width-strong) solid transparent;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.tabs__item .tab__count {
  margin-left: auto;
  padding-left: var(--space-3);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  text-align: end;
}

.tabs__item[aria-current="page"],
.tabs__item[aria-current="true"] {
  background: var(--color-bg-selected);
  color: var(--color-text-primary);
  border-inline-start-color: var(--color-accent);
}

.tab__count {
  display: inline-block;
  margin-left: var(--space-2);
  color: var(--color-text-tertiary);
  font-weight: var(--weight-regular);
  font-variant-numeric: tabular-nums;
}

/* A count of things waiting on the user, in their tone. */
.tab__count--attention {
  color: var(--color-accent);
}

.tabs__spacer {
  flex: 1;
}

/* A row's controls after its tabs and More, at its end; a section
   row's keeps its width whatever shows, so tabs never move. */
.tabs__end {
  flex: none;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  inline-size: var(--size-tabs-end);
  padding-inline: var(--space-1);
}

.tabs--section .tabs__end {
  inline-size: var(--size-tabs-end-section);
}

/* Data tables */

/* Paint containment makes it the containing block of the visually
   hidden text inside (position: fixed), which it then clips, so text in
   a column scrolled out of view never widens the page. */
.table-scroll {
  overflow-x: auto;
  contain: paint;
}

/* The scroll box contains fixed descendants, so visually hidden text
   (a Breakable's whole, a secret end's words) sits at its start, never
   at its place past a cell cut short, where it would scroll the box. */
.table-scroll .visually-hidden {
  inset-block-start: 0;
  inset-inline-start: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.table th {
  position: sticky;
  top: 0;
  z-index: var(--layer-sticky);
  height: var(--size-row);
  padding: 0 var(--space-3);
  background: var(--color-bg-raised);
  border-bottom: var(--border);
  color: var(--color-text-tertiary);
  text-align: left;
  white-space: nowrap;
}

.table td {
  height: var(--size-row);
  padding: var(--space-1) var(--space-3);
  border-bottom: var(--border-subtle);
  color: var(--color-text-secondary);
  vertical-align: middle;
}

.table__row {
  transition: background-color var(--duration-fast) linear;
}

.table__row:hover {
  background: var(--color-bg-hover);
}

.table__row--selected,
.table__row--selected:hover {
  background: var(--color-bg-selected);
}

.table .primary {
  color: var(--color-text-primary);
}

.table .numeric {
  font-family: var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A sortable header: the header's own text, a button; the sorted
   column's arrow in the accent colour. */
.table__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.table__sort svg {
  color: var(--color-accent);
}

/* The arrow's room is laid out on every sortable column, so sorting
   moves nothing. */
.table__sort-arrow {
  display: inline-flex;
}

.table__sort-arrow--hidden {
  visibility: hidden;
}

.table .truncate,
.truncate {
  max-width: var(--measure);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* An identifier or name: it breaks only at the <wbr> after each
   separator, never inside a word. */
.breakable {
  overflow-wrap: normal;
  word-break: normal;
}

/* The whole text for screen readers; the shown copy is the one copied. */
.breakable__whole {
  user-select: none;
}

.row-link {
  color: inherit;
  text-decoration: none;
}

.row-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* The box a row link's cover fills (DESIGN.md "Data table"): every row
   or block holding a .row-link is one. A VM's body holds its row and,
   for a phone, its details line, one hover and one link; a grants
   block's name cell, never the block, whose controls take their own
   taps. */
.table__row,
.vm-table__item,
.grants__block-name {
  position: relative;
}

button.row-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.row-link:focus-visible {
  outline: none;
}

.row-link:focus-visible::after {
  outline: var(--focus-band);
  outline-offset: var(--focus-offset-inset);
}

.table__action,
.table__icon {
  width: var(--size-control);
  color: var(--color-text-tertiary);
}

/* Every control in a row link's box sits above its cover, so it takes
   its own clicks (DESIGN.md "Data table"): a checkbox or radio with its
   label, a field, a select, a switch, a button and a link. */
:is(.table__row, .vm-table__item, .grants__block-name)
  :is(
    .button,
    button:not(.row-link),
    .checkbox-input,
    .radio,
    label:has(> :is(.checkbox-input, .radio)),
    .input,
    .select,
    .switch,
    .table__inner-link,
    a:not(.row-link)
  ) {
  position: relative;
  z-index: var(--layer-row);
}

/* An identifier column of a page's data table: each value one line up
   to --size-identifier, then breaking at its separators, so the column
   is never squeezed below that beside the name column, which wraps. */
.table .table__identifier > * {
  display: block;
  width: max-content;
  max-width: var(--size-identifier);
}

/* A list's name takes the room the other columns leave, and wraps. */
.table .table__fill {
  width: 100%;
}

/* Free text in a table cell wraps. */
.table .table__text {
  white-space: normal;
}

/* A sentence column (a key state): never squeezed below its minimum
   while the name column has room. */
.table .table__sentence > * {
  display: block;
  min-width: var(--size-column-text);
}

/* A value that changes in place (ticking or polled) holds the width of
   its widest form, so its column never resizes. */
.table td > .relative-time,
.table td > .table__duration,
.table td > .table__disk {
  display: inline-block;
}

.table td > .relative-time {
  min-width: var(--size-relative-time);
}

.relative-time {
  font-variant-numeric: tabular-nums;
}

.table td > .table__duration {
  min-width: var(--size-duration);
}

.table td > .table__disk {
  min-width: var(--size-disk);
}

/* Row actions: end-aligned, centred on the row; two icon-only buttons
   --space-1 apart, any pair with a text button --space-2. */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
}

.row-actions > :not(.button--icon) + *,
.row-actions > * + :not(.button--icon) {
  margin-inline-start: var(--space-1);
}

/* Shown only below --breakpoint-md (-lg, or the main pane's
   --breakpoint-main-xl), where it stacks in the name's cell. */
.table__narrow,
.table__narrow-lg,
.table__narrow-xl {
  display: none;
}

/* --breakpoint-main-xl */
@container main (width < 80rem) {
  .table__wide-xl {
    display: none;
  }

  .table__narrow-xl {
    display: block;
  }
}

.table__narrow-inline {
  display: none;
}

/* A cell that stacks lines (status, name, details) gets room above
   and below them. */
.table td.table__stack {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

/* A name cell keeps the default padding though it stacks, as the
   list's icon beside its first line expects. */
.table td.table__name {
  padding-block: var(--space-1);
}

.session-row__badge {
  margin-bottom: var(--space-2);
}

/* Details under a row's name: its secondary values, quieter. */
.table .table__details {
  margin: var(--space-1) 0 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-regular);
  color: var(--color-text-tertiary);
}

.table .table__details.mono {
  font-family: var(--font-mono);
}

/* A details line's short values stay whole; a long one is Breakable or
   a block value of its own, and a span holding a Breakable does not
   keep it whole either (Firefox breaks no <wbr> under nowrap). */
.table
  .table__details
  :is(span, time):not(
    .table__narrow-inline,
    .breakable,
    .breakable *,
    .visually-hidden,
    :has(.breakable)
  ) {
  white-space: nowrap;
}

/* A long value (URL, path, branch) under the name, on a line of its
   own, so it takes the name column's width, never a narrow column's. */
.table .table__value {
  display: block;
  font-family: var(--font-mono);
}

/* A command and its Copy button, beside its last line or under it,
   clear of its lines. */
.table .table__command {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

/* A details line outside a table, under its name. */
.details-line {
  margin: var(--space-1) 0 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  overflow-wrap: break-word;
}

.details-line.mono {
  font-family: var(--font-mono);
}

/* In the artifact list, details align with the name after its
   chevron's place. */
.artifact-row__details {
  padding-left: calc(var(--size-icon) + var(--space-1));
}

/* A session in a list, indented by its depth in its session graph's
   tree, so children stand below their parent. */
.session-tree {
  padding-left: min(calc(var(--tree-depth, 0) * var(--space-4)), var(--size-tree-indent-max));
}

/* A session's id after its name, where another session of its project has
   the same name. */
.session-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
}

.session-label > :first-child {
  flex: 0 1 auto;
  min-width: 0;
}

.session-id {
  flex: none;
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-regular);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.table__title {
  max-width: var(--measure);
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.table__id {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
}

.table--dense td,
.table--dense th {
  height: var(--size-row-dense);
}

/* The audit log fits its width: fixed columns, every cell one line,
   truncated, its full value in its tooltip. Column widths are set in the
   cells' font, on the table's columns. */
.table--audit {
  table-layout: fixed;
  width: 100%;
}

.table--audit col {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* A dense row holds --text-xs, so a control in it keeps its clearance. */
.table--audit td {
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  white-space: nowrap;
}

/* YYYY-MM-DD HH:MM:SS, its spare ch and its padding. */
.audit-column--time {
  width: var(--size-column-datetime);
}

/* The action's share takes the fifths of the session and target columns
   not laid out (--audit-share). */
.audit-column--fifth {
  width: min(
    calc(var(--size-sidebar) * var(--audit-share, 1)),
    calc((100% - var(--size-column-datetime)) / 5 * var(--audit-share, 1))
  );
}

/* HH:MM:SS, its spare ch and its padding. */
.table--audit-pane .audit-column--time {
  width: var(--size-column-time);
}

.audit-column--third {
  width: min(var(--size-sidebar), calc((100% - var(--size-column-time)) / 3));
}

/* The actor's column, where it is no fifth: as wide as its widest
   actor (--audit-actor), at most --size-sidebar, so the action takes
   the rest. */
.table--audit-pane .audit-column--actor {
  width: min(var(--size-sidebar), calc(var(--audit-actor) + 2 * var(--space-3)));
}

/* A day separator: before each UTC day's first entry where the time
   column shows HH:MM:SS. On the global log only below
   --breakpoint-md. */
.table .table__day td {
  height: var(--size-row-dense);
  background: var(--color-bg-raised);
  color: var(--color-text-tertiary);
}

.table__day--narrow {
  display: none;
}

.table--static th {
  position: static;
}

.table--static tr:hover {
  background: transparent;
}

.table__expansion td {
  padding: var(--space-3);
  background: var(--color-bg-raised);
}

.table--audit .audit-detail {
  max-width: 100%;
}

.table--audit .audit-detail .truncate {
  min-width: 0;
}

.table--audit .session-name,
.table--audit .audit-action-cell {
  font-family: var(--font-sans);
}

/* The expanded row's lines: the global log's session, then the action's
   id, each after its mono label. */
.audit-line {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  margin-bottom: var(--space-3);
}

.audit-line:last-child {
  margin-bottom: 0;
}

.audit-line__label {
  flex: none;
  color: var(--color-text-tertiary);
}

.audit-line .session-name,
.audit-line__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actor--person {
  color: var(--person-color) !important;
}
.actor--agent {
  color: var(--color-accent) !important;
}
.actor--system {
  color: var(--color-text-secondary) !important;
}
.actor--removed {
  font-family: var(--font-sans);
  color: var(--color-text-tertiary) !important;
}

.audit-detail {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  max-width: var(--measure);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.audit-detail:hover {
  color: var(--color-text-primary);
}

/* A verification's problems under its counts: mono lines, no bullets. */
.problem-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

/* What a snapshot's outcome means, above its problems. */
.problems-lead {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

.choice__radio {
  width: var(--size-control);
}

/* The box sits beside the name's first line (see the icon rule), the
   name's details under it. */
.choice .choice__radio,
.choice .choice__radio + td {
  vertical-align: top;
}

.choice__radio > :is(.radio, .checkbox-input) {
  display: grid;
}

.choice label {
  cursor: pointer;
}

/* A choice row: the name, then its details (description, or OS and
   version) under it; both wrap, an image's name only at its
   separators, a model's name at spaces. */
.choice__name {
  font-family: var(--font-mono);
  color: var(--color-text-primary);
}

.choice__name--sans {
  font-family: var(--font-sans);
}

/* The selects of a column share one width: their cell's, which the
   widest option sizes, at most a long control's. */
.choice .select {
  display: flex;
  max-width: var(--size-input-long);
}

/* As wide as its widest option at least, so its column is too. */
.choice .select select {
  width: auto;
  min-width: 100%;
}

.empty-state.empty-state--inline {
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-3) 0;
  text-align: left;
  background-image: none;
}

.file-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.file-picker__size {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.path-bar {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.path-bar__separator {
  color: var(--color-text-tertiary);
}

.commit-line {
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.stream__budget {
  margin-top: var(--space-4);
}


.choice__details {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.load-more {
  display: flex;
  justify-content: center;
  padding: var(--space-4);
}

/* Filter bar */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border);
}

/* After the filters, the search takes the rest of the line. */
.filter-bar__search {
  flex: 1;
  min-width: min(var(--size-sidebar), 100%);
}

/* A filter's label and its select: one unit that never wraps inside. */
.filter-bar__filter {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.filter-bar__label {
  color: var(--color-text-tertiary);
}

/* A filter's select is at most a sidebar wide; its shown text
   truncates, the open list keeps the options whole. */
.filter-bar__filter .select,
.filter-bar__filter select {
  max-width: var(--size-sidebar);
}

.filter-bar__filter select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A multi-select filter's button: a select's look, naming the choice. */
.multi-select {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: auto;
  max-width: var(--size-sidebar);
  cursor: pointer;
  text-align: left;
}

.multi-select__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select .icon {
  flex: none;
  color: var(--color-text-secondary);
}

/* The side pane's bar: one line, the search shrinking first. */
.filter-bar--pane {
  flex-wrap: nowrap;
}

.filter-bar--pane > * {
  flex: none;
}

.filter-bar--pane .filter-bar__search {
  flex: 1 1 auto;
  min-width: 0;
}

/* Forms */

/* A form is at most --size-form wide; its one submit is start-aligned
   under the last field, --space-5 below it (the form's gap and
   --space-1), and a failure's banner goes below the submit, which so
   never moves. */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: var(--size-form);
}

.form--measure {
  max-width: var(--measure);
}

/* An account form (password). */
.form--column {
  max-width: var(--size-column);
}

.form__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field__label {
  display: block;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-ligatures: none;
  color: var(--color-text-primary);
}

/* Label to control --space-2: the field's gap and this. */
.field > label.field__label {
  margin-bottom: var(--space-1);
}

fieldset.field > legend.field__label {
  margin-bottom: var(--space-2);
}

.field__required {
  margin-left: var(--space-1);
}

.field > .input,
.field > .textarea,
.field > .select {
  width: 100%;
  max-width: var(--size-input-long);
}

.field > .select select {
  width: 100%;
}

.field--short > .input,
.field--short > .select {
  width: min(var(--size-input-short), 100%);
}

.field > .switch {
  align-self: flex-start;
}

.field__note {
  display: block;
  min-height: var(--text-sm-line);
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-tertiary);
  overflow-wrap: break-word;
}

.field__note--error {
  color: var(--color-danger);
}

.field__note--stacked {
  display: grid;
}

.field__note-state {
  display: block;
  grid-area: 1 / 1;
  min-width: 0;
}

.field__note-state--hidden {
  visibility: hidden;
}

.input,
.textarea {
  width: 100%;
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  background: var(--color-bg-void);
  border: var(--border-control);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  transition: border-color var(--duration-fast) linear;
}

.input.mono,
.textarea.mono {
  font-family: var(--font-mono);
}

.textarea {
  padding: calc((var(--size-control) - var(--text-md-line)) / 2 - var(--border-width))
    var(--space-3);
  resize: vertical;
}

/* A Markdown text of a page (an engagement's scope): grows with its
   text from four lines. */
.textarea--grows {
  field-sizing: content;
  min-height: calc(
    4 * var(--text-md-line) + var(--size-control) - var(--text-md-line)
  );
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-tertiary);
}

.input:hover,
.textarea:hover {
  border-color: var(--color-text-secondary);
}

/* Fields take keys after a click, so they show the band on any focus. */
.input:focus,
.textarea:focus,
.title-input__input:focus {
  outline: var(--focus-band);
  outline-offset: 0;
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
}

/* A disabled field is greyed out: its own fill, a quiet border, and its
   value still readable (DESIGN.md "Forms"). */
.input:disabled,
.textarea:disabled {
  background: var(--color-bg-disabled);
  border-color: var(--color-line);
  color: var(--color-text-tertiary);
  cursor: not-allowed;
}

.select:has(select:disabled) .icon {
  color: var(--color-text-disabled);
}

.select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select select {
  appearance: none;
  padding-right: calc(var(--space-3) * 2 + var(--size-icon));
  cursor: pointer;
}

.select .icon {
  position: absolute;
  right: var(--space-3);
  pointer-events: none;
  color: var(--color-text-secondary);
}

/* A radio: a diamond frame, drawn by ::before in the icon's square so
   it lays out as a checkbox; chosen, an accent frame round an accent
   dot, never filled, so it never reads as a checked box. */
.radio {
  appearance: none;
  flex: none;
  /* The label's line height, for centring on its first line. */
  font: inherit;
  display: inline-grid;
  place-content: center;
  width: var(--size-icon);
  height: var(--size-icon);
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.radio::before {
  content: "";
  box-sizing: border-box;
  width: var(--size-radio);
  height: var(--size-radio);
  padding: calc((var(--size-radio) - 2 * var(--border-width) - var(--size-marker)) / 2);
  border: var(--border-control);
  background-clip: content-box;
  rotate: 45deg;
}

.radio:checked::before {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
}

/* The band follows the diamond. */
.radio:focus-visible {
  outline: none;
}

.radio:focus-visible::before {
  outline: var(--focus-band);
  outline-offset: 0;
}

.radio:checked:focus-visible::before {
  border-color: var(--color-text-primary);
  background-color: var(--color-text-primary);
}

.radio:is(:disabled, [aria-disabled="true"]) {
  cursor: not-allowed;
}

.radio:is(:disabled, [aria-disabled="true"])::before {
  border-color: var(--color-line);
}

.radio:is(:disabled, [aria-disabled="true"]):checked::before {
  border-color: var(--color-line);
  background-color: var(--color-text-disabled);
}

.panel {
  padding: var(--space-5);
  border-bottom: var(--border);
  background: var(--color-bg-raised);
}

/* Empty, loading and error states */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  background-image: radial-gradient(var(--color-line) var(--border-width), transparent 0);
  background-size: var(--space-5) var(--space-5);
}

.empty-state__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-tertiary);
}

/* The `// ` before a label keeps its space, as the last text of its
   own box. */
.label-prefix {
  white-space: pre;
}

.empty-state__label--danger {
  color: var(--color-danger);
}

.empty-state__sentence {
  max-width: var(--measure);
  color: var(--color-text-secondary);
}

/* A missing permission's word in its sentence. */
.no-access__word {
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.banner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid;
}

.banner--danger {
  background: var(--color-danger-dim);
  border-color: var(--color-danger);
}

.banner--warning {
  background: var(--color-warning-dim);
  border-color: var(--color-warning);
}

.banner__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.banner__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.banner--danger .banner__label {
  color: var(--color-danger);
}

.banner--warning .banner__label {
  color: var(--color-warning);
}

.banner__sentence {
  flex: 1;
  min-width: 0;
  color: var(--color-text-primary);
}

.banner__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --breakpoint-md: the label with the dismiss at the top right, the
   sentence full width under it, the actions on their own line. */
@media (width < 48em) {
  .banner__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-3);
  }

  .banner__label,
  .banner__dismiss {
    grid-row: 1;
  }

  .banner__label {
    grid-column: 1;
    justify-self: start;
  }

  .banner__dismiss {
    grid-column: 2;
  }

  .banner__sentence,
  .banner__actions {
    grid-column: 1 / -1;
  }
}

.banner__details summary {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.banner__details pre {
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  background: var(--color-bg-void);
  border: var(--border);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.main > .banner,
.main > .page-body > .banner {
  margin: var(--space-3) var(--space-5) 0;
}

.chat > .banner {
  margin: var(--space-3) var(--chat-inset) 0;
}

/* A banner that comes without the user's action overlays the top edge
   of the area it reports on, reserving no space: a zero-high sticky
   slot its banner hangs from. */
.overlay-banner {
  position: sticky;
  top: 0;
  z-index: var(--layer-sticky-raised);
  flex: none;
  height: 0;
  overflow: visible;
}

.overlay-banner > .banner {
  margin: var(--space-3) var(--space-3) 0;
}

/* An overlay hung from the bottom edge of a sticky bar, its parent,
   which it follows as the bar sticks or wraps. */
.overlay-banner--below {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
}

/* Dialogs */

/* Top-anchored, --space-8 below the viewport's top (--space-4 below
   --breakpoint-md), so a dialog grows only downward; --space-4 at least
   is left below it. */
.dialog {
  width: min(var(--measure), calc(100vw - 2 * var(--space-4)));
  max-width: none;
  max-height: calc(100dvh - var(--space-8) - var(--space-4));
  margin: var(--space-8) auto auto;
  padding: var(--space-5);
  background: var(--color-bg-raised);
  border: var(--border);
  color: var(--color-text-primary);
  z-index: var(--layer-overlay);
  /* Never sideways: its content fits its width. */
  overflow-x: hidden;
}

.dialog::backdrop {
  background: var(--color-scrim);
}

/* On a touch screen a dialog opens with focus on its title, as a page
   on its title: no band. */
.dialog__title {
  outline: none;
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}

.dialog__title,
.dialog__sentence {
  overflow-wrap: anywhere;
}

.dialog__sentence {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}



.dialog__loss .dialog__sentence {
  margin-bottom: var(--space-2);
}

.dialog__list {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.dialog__buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

/* A failure's banner goes below the buttons, which so never move. */
.dialog__buttons ~ .banner {
  margin-top: var(--space-4);
}

/* A long control takes the dialog's width, so its end edge is the
   buttons'. */
.dialog .field > .input,
.dialog .field > .textarea,
.dialog .field > .select,
.dialog .picker {
  max-width: none;
}

/* Where the fields scroll, the blocks edge-aligned with them reserve the
   same scrollbar gutter, so a scrollbar shifts none of them; padded by
   --space-1 for the focus band, which the box clips, the buttons keep
   --space-5 above them. */
.dialog--form .dialog__buttons,
.question-dialog .dialog__buttons {
  /* Clipping, a flex item may shrink below its buttons; it never does. */
  flex: none;
  overflow: hidden;
  scrollbar-gutter: stable;
  padding: var(--space-1);
  margin: var(--space-4) calc(-1 * var(--space-1)) calc(-1 * var(--space-1));
}

/* A form dialog's banner below the buttons ends where they do: the
   same gutter, --space-4 below them. */
.dialog__banner {
  flex: none;
  overflow: hidden;
  scrollbar-gutter: stable;
  padding: var(--space-1);
  margin: calc(var(--space-4) - var(--space-1)) calc(-1 * var(--space-1))
    calc(-1 * var(--space-1));
}

/* Auth pages */

/* The panel is top-anchored, --space-8 below the viewport's top
   (--space-4 below --breakpoint-md), so it grows only downward. */
.auth-page {
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-8) var(--space-4) var(--space-4);
  background-image: radial-gradient(var(--color-line) var(--border-width), transparent 0);
  background-size: var(--space-5) var(--space-5);
}

.auth-panel {
  width: min(var(--size-column), calc(100vw - 2 * var(--space-4)));
  padding: var(--space-5);
  background: var(--color-bg-raised);
  border: var(--border);
}

.auth-panel .wordmark {
  display: flex;
}

.auth-panel__title {
  margin: var(--space-5) 0 var(--space-4);
  font-size: var(--text-xl);
  line-height: var(--text-xl-line);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
}

.auth-panel__sentence {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

/* A second action under the form's ("Log out"). */
.auth-panel form + .button--secondary {
  margin-top: var(--space-2);
}

/* --breakpoint-md: dialogs and the auth panel --space-4 below the
   viewport's top. */
@media (width < 48em) {
  .dialog {
    max-height: calc(100dvh - 2 * var(--space-4));
    margin-top: var(--space-4);
  }

  .auth-page {
    padding-top: var(--space-4);
  }
}

/* Key-value lists */

.key-values {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
}

.key-values dt {
  color: var(--color-text-tertiary);
}

.details-group {
  margin-top: var(--space-3);
}

.details-group[hidden] {
  display: none;
}

.key-values dd {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  overflow-wrap: break-word;
}

.key-values--columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--size-column), 100%), 1fr));
  align-items: start;
  gap: var(--space-3) var(--space-5);
}

.prose-small {
  white-space: pre-wrap;
  max-width: var(--measure);
}

.sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.disclosure__toggle,
.reasoning__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--size-control-small);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  cursor: pointer;
}

.disclosure__toggle:hover,
.reasoning__toggle:hover {
  color: var(--color-text-primary);
}

.disclosure__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

/* Inference request detail */

.inference-more {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.inference-more__count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* Code and log blocks */

.code-block {
  background: var(--color-bg-void);
  border: var(--border);
  min-width: 0;
}

.code-block__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control-small);
  padding-left: var(--space-3);
  background: var(--color-bg-raised);
  border-bottom: var(--border);
}

.code-block__label,
.code-block__count {
  color: var(--color-text-tertiary);
}

.code-block__spacer {
  flex: 1;
}

.code-block__detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.code-block__note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-tertiary);
}

.code-block__size {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.code-block__header > .code-block__size:last-child {
  padding-right: var(--space-3);
}

.code-block__banner {
  padding: var(--space-3) var(--space-3) 0;
}

.loading-line {
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.loading-line .empty-state__label {
  margin: 0;
}

.code-block__scroll {
  display: flex;
  overflow: auto;
}

.code-block__scroll--capped {
  max-height: calc(20 * var(--text-sm-line) + 2 * var(--space-3));
}

.code-block__body,
.code-block__numbers {
  margin: 0;
  padding: var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  tab-size: 4;
  white-space: pre;
}

.code-block__body {
  flex: 1;
  color: var(--color-text-primary);
}

.code-block__body--wrap {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  padding-left: calc(var(--space-3) + var(--space-4));
  text-indent: calc(-1 * var(--space-4));
}

.code-block__numbers {
  padding-right: 0;
  color: var(--color-text-disabled);
  text-align: right;
  user-select: none;
}

/* Session view */

.session {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.session-tabs {
  display: none;
}

/* The view tab row and, in the compact view while it offers a choice,
   the agent select before it, which code mounts there only in one
   column; laid out only in one column. */
.session-views {
  display: contents;
}

/* Chat and side pane, and the agent list before them once the session
   has a subagent (at --breakpoint-lg and up); the pane's track takes
   its width up to --pane-width, --size-column by default, leaving the
   chat at least --size-chat-min. The width is the pane's content, so
   its container query sees it; the track adds the pane's separator, a
   band at its left (DESIGN.md "Resize separators"). */
.session__body {
  --pane-separator: calc(var(--space-2) + var(--border-width));
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns:
    minmax(min(var(--size-chat-min), 100% - var(--size-column)), 1fr)
    minmax(
      var(--size-column),
      calc(var(--pane-width, var(--size-column)) + var(--pane-separator))
    );
}

.session__body > * {
  min-width: 0;
  min-height: 0;
}

.session__body:has(> .side-pane--collapsed) {
  grid-template-columns: minmax(0, 1fr) var(--size-control);
}

/* --breakpoint-lg */
@media (width >= 80em) {
  .session__body--agents {
    grid-template-columns:
      var(--size-sidebar)
      minmax(min(var(--size-chat-min), 100% - var(--size-sidebar) - var(--size-column)), 1fr)
      minmax(
        var(--size-column),
        calc(var(--pane-width, var(--size-column)) + var(--pane-separator))
      );
  }

  .session__body--agents:has(> .side-pane--collapsed) {
    grid-template-columns: var(--size-sidebar) minmax(0, 1fr) var(--size-control);
  }

  .session__body--agents .agent-select-bar {
    display: none;
  }
}

.agent-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: var(--border);
}

.agent-list__items {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--space-3);
  overflow-y: auto;
}

/* Pinned to the column's bottom, so agents coming and going never move
   it. */
.agent-list__actions {
  flex: none;
  padding: var(--space-3);
  border-top: var(--border);
}

.agent-item {
  border-left: var(--border-width-strong) solid transparent;
}

.agent-item--selected {
  background: var(--color-bg-selected);
  border-left-color: var(--color-accent);
}

.agent-item__link {
  display: grid;
  grid-template-columns: var(--size-marker) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: background-color var(--duration-fast) linear;
}

.agent-item:not(.agent-item--selected) .agent-item__link:hover {
  background: var(--color-bg-hover);
}

.agent-item__marker {
  display: inline-flex;
}

.agent-item__name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
}

.agent-select-bar__cost {
  margin-left: auto;
}

.agent-item__cost,
.agent-select-bar__cost {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  font-variant-ligatures: none;
}

/* The selected agent's context use: three lines (four when narrow) of
   fixed height at a given width from the first render, inset to the
   agent name. */
.agent-context {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: 0 var(--space-3) var(--space-2) calc(var(--space-3) + var(--size-marker) + var(--space-2));
}

.agent-context__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  min-height: var(--text-2xs-line);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The tokens and compactions line: two fixed slots, so in a narrow
   card the compactions wrap whole by the card's width only. */
.agent-context__line--usage {
  flex-wrap: wrap;
}

.agent-context__label,
.agent-context__compactions {
  color: var(--color-text-tertiary);
}

/* Its text at its slot's start, so wrapped it starts at the card's. */
.agent-context__compactions {
  min-width: var(--size-compactions);
}

.agent-context__tokens {
  min-width: var(--size-context-tokens);
  color: var(--color-text-secondary);
}

.agent-context__tokens.tertiary {
  color: var(--color-text-tertiary);
}

.context-percent {
  display: inline-block;
  min-inline-size: var(--size-percent);
  text-align: end;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* The meter: a track in the line colour, filled to the percentage,
   updated without transition. */
.context-meter {
  height: var(--space-1);
  background: var(--color-line);
  overflow: hidden;
}

.context-meter__fill {
  height: 100%;
  max-width: 100%;
  background: var(--color-accent);
}

/* An agent's jobs: the toggle, padded as the details toggle, and the
   rows inset to the agent name. */
.agent-jobs {
  padding: 0 0 var(--space-2);
}

.agent-jobs__toggle {
  margin-left: calc(var(--space-3) + var(--size-marker));
  color: var(--color-text-tertiary);
}

/* Disabled, the count and its word stay readable; only the chevron
   takes the disabled colour. */
.agent-jobs__toggle:disabled {
  color: var(--color-text-tertiary);
}

.agent-jobs__toggle:disabled .icon {
  color: var(--color-text-disabled);
}

.agent-jobs__count {
  display: inline-block;
  min-inline-size: var(--size-count);
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.agent-jobs__list {
  max-height: var(--size-job-list-max);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

.job-row {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: var(--size-job-row);
  padding: var(--space-1) var(--space-3) var(--space-1)
    calc(var(--space-3) + var(--size-marker) + var(--space-2) - var(--border-width-strong));
  border-left: var(--border-width-strong) solid transparent;
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  text-decoration: none;
  transition: background-color var(--duration-fast) linear;
}

.job-row:hover {
  background: var(--color-bg-hover);
}

.job-row--selected,
.job-row--selected:hover {
  background: var(--color-bg-selected);
  border-left-color: var(--color-accent);
}

.job-row__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-secondary);
}

.job-row--ended .job-row__label {
  color: var(--color-text-tertiary);
}

.job-row--selected .job-row__label {
  color: var(--color-text-primary);
}

.job-row__line {
  display: flex;
  gap: var(--space-2);
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
}

.job-row__runtime {
  flex: none;
  min-width: var(--size-duration);
  font-variant-numeric: tabular-nums;
}

.job-row__state--success {
  color: var(--color-success);
}

.job-row__state--danger {
  color: var(--color-danger);
}

/* The main agent's timers: as its jobs, a note above the next fire
   and repeat mark. */
.agent-timers {
  padding: 0 0 var(--space-2);
}

.agent-timers__toggle {
  margin-left: calc(var(--space-3) + var(--size-marker));
  color: var(--color-text-tertiary);
}

.agent-timers__toggle:disabled {
  color: var(--color-text-tertiary);
}

.agent-timers__toggle:disabled .icon {
  color: var(--color-text-disabled);
}

.agent-timers__count {
  display: inline-block;
  min-inline-size: var(--size-count);
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.agent-timers__list {
  max-height: var(--size-timer-list-max);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

.timer-row {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: var(--size-timer-row);
  padding: var(--space-1) var(--space-3) var(--space-1)
    calc(var(--space-3) + var(--size-marker) + var(--space-2) - var(--border-width-strong));
  border-left: var(--border-width-strong) solid transparent;
  text-decoration: none;
  transition: background-color var(--duration-fast) linear;
}

.timer-row:hover {
  background: var(--color-bg-hover);
}

.timer-row--selected,
.timer-row--selected:hover {
  background: var(--color-bg-selected);
  border-left-color: var(--color-accent);
}

.timer-row__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-secondary);
}

.timer-row--ended .timer-row__label,
.timer-row__label--empty {
  color: var(--color-text-tertiary);
}

.timer-row--selected .timer-row__label {
  color: var(--color-text-primary);
}

.timer-row__line {
  display: flex;
  gap: var(--space-2);
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
}

.timer-row__next {
  flex: none;
  min-width: var(--size-timer-next);
  font-variant-numeric: tabular-nums;
}

/* The agent's stream and chat input, kept while a job shows. */
.chat__agent {
  display: contents;
}

.chat__agent[hidden] {
  display: none;
}

/* The job view: the output above the job bar, as the stream above the
   chat input. */
.job-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.job-output {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-3) var(--chat-inset);
  background: var(--color-bg-void);
}

.job-output__text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-variant-ligatures: none;
  color: var(--color-text-primary);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  tab-size: 4;
}

.job-output__note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.job-bar {
  position: sticky;
  bottom: 0;
  z-index: var(--layer-sticky);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--chat-inset);
  background: var(--color-bg-base);
  border-top: var(--border);
}

.job-bar__info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.job-bar__label {
  color: var(--color-text-tertiary);
}

.job-bar__name {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-primary);
}

/* Slots held from the first render, so an end moves nothing. */
.job-bar__runtime,
.job-bar__end {
  display: inline-block;
  min-height: var(--text-sm-line);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-variant-numeric: tabular-nums;
}

.job-bar__runtime {
  min-width: var(--size-duration);
}

.job-bar__end {
  min-width: var(--size-job-end);
  color: var(--color-text-secondary);
}

.job-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.job-bar__kill .icon {
  display: none;
}

/* The command line: the tool-call line's look, the full width. */
.job-bar__command {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: var(--size-row-dense);
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  text-align: left;
  cursor: pointer;
}

.job-bar__command:hover {
  color: var(--color-text-secondary);
}

.job-bar__command-text {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-secondary);
}

.job-bar__command-block {
  grid-column: 1 / -1;
}

.job-bar__command-block .code-block {
  max-height: var(--size-job-command-max);
  overflow-y: auto;
}

/* The timer view: the note and facts above the timer bar. */
.timer-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.timer-detail {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--chat-inset);
  background: var(--color-bg-base);
}

.timer-detail .section-label {
  margin: 0;
}

.timer-detail__note {
  max-width: var(--measure);
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  color: var(--color-text-primary);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.timer-detail__note--empty {
  color: var(--color-text-tertiary);
}

.timer-bar {
  position: sticky;
  bottom: 0;
  z-index: var(--layer-sticky);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--chat-inset);
  background: var(--color-bg-base);
  border-top: var(--border);
}

.timer-bar__info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.timer-bar__label {
  color: var(--color-text-tertiary);
}

.timer-bar__repeat,
.timer-bar__next {
  display: inline-block;
  min-height: var(--text-sm-line);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-variant-numeric: tabular-nums;
}

.timer-bar__repeat {
  color: var(--color-text-secondary);
}

.timer-bar__next {
  min-width: var(--size-timer-next);
  color: var(--color-text-primary);
}

.timer-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.timer-bar__cancel .icon {
  display: none;
}

/* --breakpoint-md: "Cancel timer" is icon-only. */
@media (width < 48em) {
  .timer-bar__cancel {
    width: var(--size-control);
    padding: 0;
    justify-content: center;
  }

  .timer-bar__cancel .icon {
    display: inline-block;
  }

  .timer-bar__cancel-text {
    position: absolute;
    width: var(--size-visually-hidden);
    height: var(--size-visually-hidden);
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* --breakpoint-md: "Kill job" is icon-only. */
@media (width < 48em) {
  .job-bar__kill {
    width: var(--size-control);
    padding: 0;
    justify-content: center;
  }

  .job-bar__kill .icon {
    display: inline-block;
  }

  .job-bar__kill-text {
    position: absolute;
    width: var(--size-visually-hidden);
    height: var(--size-visually-hidden);
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.chat {
  position: relative;
  container: chat / inline-size;
  display: flex;
  flex-direction: column;
  /* The chat inset: the inline padding of everything in the column, so
     one text edge runs down it. */
  --chat-inset: var(--space-5);
}

/* --size-pane */
@container chat (width < 30rem) {
  .chat > * {
    --chat-inset: var(--space-3);
  }
}

/* Side pane */

.side-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: var(--border);
  background: var(--color-bg-base);
  container: side-pane / inline-size;
}

/* Open, its left border is its separator's band. */
.side-pane:has(> .side-pane__separator) {
  border-left: 0;
  padding-left: var(--pane-separator);
}

/* A narrow pane's tables keep their state, name, a time and the row
   action, as lists below --breakpoint-md do. */
/* --size-pane */
@container side-pane (width < 30rem) {
  .table__wide {
    display: none;
  }

  .table__narrow {
    display: block;
  }
}

.side-pane__tabs {
  flex: none;
}

.side-pane__content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.side-pane__content > * {
  flex-shrink: 0;
}

.side-pane__content > .vm-pane {
  flex: 1;
  flex-shrink: 1;
  min-height: 0;
}

/* The pane's left border: a band of its own, the whole band its hit
   area, so it covers neither the chat's scrollbar nor the pane; its line
   at the band's centre. */
.side-pane__separator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--pane-separator);
  cursor: col-resize;
  touch-action: none;
}

.side-pane__separator::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc((var(--pane-separator) - var(--border-width)) / 2);
  width: var(--border-width);
  background: var(--color-line);
}

/* Grown toward the chat, its right where the line's is. */
.side-pane__separator:hover::before,
.side-pane__separator--dragging::before,
.side-pane__separator:focus-visible::before {
  left: calc((var(--pane-separator) + var(--border-width)) / 2 - var(--border-width-strong));
  width: var(--border-width-strong);
  background: var(--color-accent);
}

.side-pane__separator:focus-visible {
  outline: none;
}

@media (pointer: coarse) {
  .session__body {
    --pane-separator: calc(var(--size-target) + var(--border-width));
  }
}

.side-pane--collapsed {
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-1);
}

.side-pane__rail-tab {
  writing-mode: vertical-rl;
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) 0;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
  transition: color var(--duration-fast) linear;
}

.side-pane__rail-tab .tab__count {
  margin: var(--space-2) 0 0;
}

.side-pane__rail-tab:hover {
  color: var(--color-text-primary);
}

.pane-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  background: var(--color-bg-raised);
  border-bottom: var(--border);
}

.pane-header__path {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-variant-ligatures: none;
}

.pane-header__tab {
  flex: none;
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-decoration: none;
  text-transform: uppercase;
}

.pane-header__tab:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.pane-header__name {
  min-width: 0;
  outline: none;
  color: var(--color-text-primary);
}

.pane-header__name--label {
  text-transform: uppercase;
}


.pane-header__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.pane-header__size,
.pane-header__fact {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  font-variant-ligatures: none;
}

.pane-header__fact--model {
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.pane-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.pane-header__label {
  color: var(--color-text-tertiary);
  margin-right: var(--space-1);
}

.pane-body {
  padding: var(--space-5);
}

.select--small select {
  min-height: var(--size-control-small);
  padding-left: var(--space-2);
  font-size: var(--text-xs);
}

/* A small input, inside a row: as high as a small select. */
.input--small {
  width: auto;
  min-height: var(--size-control-small);
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

.input--count {
  width: var(--size-input-count);
}

/* Pop-out window */

.popout {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-base);
}

.popout > * {
  min-height: 0;
}

.popout-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  background: var(--color-bg-void);
  border-bottom: var(--border);
  white-space: nowrap;
}

.popout__name {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  font-variant-ligatures: none;
}

.popout__session {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.popout-bar__facts {
  display: flex;
  flex: none;
  gap: var(--space-3);
}

.popout-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.popout__body {
  flex: 1;
  overflow: auto;
}

/* What --measure comes to in the viewer's font, for a pop-out's width. */
.measure-probe {
  position: absolute;
  visibility: hidden;
  width: calc(var(--measure) + 2 * var(--space-5));
  font-family: var(--font-sans);
  font-size: var(--text-lg);
}

/* Agent stream */

/* The stream's scroller, with the scroll-to-bottom button over its
   bottom right corner. */
.stream-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* A touch scroll past either end stays in the stream: the page around
   it never takes it over or bounces. */
.stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4) var(--chat-inset);
}

/* The lost connection's banner overlays the stream's top edge. */
.stream__banner {
  position: absolute;
  top: var(--space-3);
  right: var(--chat-inset);
  left: var(--chat-inset);
  z-index: var(--layer-sticky);
}

.stream__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Entries of one sender's run sit --space-2 apart, lines stack with no
   gap, and a header starts --space-4 below what is above it. */
.stream__log,
.stream__queue {
  display: flex;
  flex-direction: column;
}

.stream__item + .stream__item {
  margin-top: var(--space-2);
}

.stream__item--ends-line + .stream__item--leads-line {
  margin-top: 0;
}

.stream__item + .stream__item--headed {
  margin-top: var(--space-4);
}

.stream__bottom {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: var(--layer-sticky);
  background: var(--color-bg-raised);
}

.stream__bottom:hover {
  background: var(--color-bg-hover);
}

/* An entry fills the column; its wrapping text keeps the measure (see
   .markdown--message). */
.entry {
  position: relative;
}

/* A message or notice: its hover fill reaches the stream's edges and
   --space-1 above and below, behind its content. */
.entry--agent,
.entry--user,
.entry--subagent-notice,
.entry--notices {
  isolation: isolate;
}

.entry--agent::before,
.entry--user::before,
.entry--subagent-notice::before,
.entry--notices::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--space-1)) calc(-1 * var(--chat-inset));
  z-index: var(--layer-behind);
  pointer-events: none;
  background: transparent;
  transition: background-color var(--duration-fast) linear;
}

.entry--user::before {
  left: calc(-1 * var(--chat-inset) - var(--border-width-strong));
}

@media (hover: hover) {
  .entry--agent:hover::before,
  .entry--user:hover::before,
  .entry--subagent-notice:hover::before,
  .entry--notices:hover::before {
    background: var(--color-bg-hover-subtle);
  }

  .entry:hover > .entry__header--quiet .entry__time {
    background: var(--color-bg-hover-subtle);
  }
}

/* An entry that continues its sender's run: its time shows at its first
   line's end on hover and on focus within it, reserving no space. */
.entry__header--quiet {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
  pointer-events: none;
}

.entry__header--quiet .entry__author {
  display: none;
}

.entry__header--quiet .entry__time {
  visibility: hidden;
  padding-left: var(--space-2);
  background: var(--color-bg-base);
  transition: background-color var(--duration-fast) linear;
}

.entry:hover > .entry__header--quiet .entry__time,
.entry:focus-within > .entry__header--quiet .entry__time {
  visibility: visible;
}

@media (hover: none) {
  .entry:hover > .entry__header--quiet .entry__time,
  .entry:focus-within > .entry__header--quiet .entry__time {
    visibility: hidden;
  }
}

.entry__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.entry__author {
  min-width: 0;
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

.entry__author--agent {
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
}

.entry__author--person {
  font-family: var(--font-mono);
  color: var(--person-color);
}

.entry__author--removed {
  font-family: var(--font-sans);
  color: var(--color-text-tertiary);
}

.entry__author--system {
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.entry__time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
}

.entry--user {
  border-left: var(--border-width-strong) solid var(--person-color);
  padding-left: var(--space-3);
}

.entry__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-label);
}

.entry__meta:empty {
  display: none;
}

/* The viewer's own message until received: the row holds a small
   button's height, its button at the end. */
.entry__meta--actionable {
  min-height: var(--size-control-small);
  max-width: var(--measure);
}

.entry__meta--actionable .button {
  margin-left: auto;
}

.entry__state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  text-transform: uppercase;
}

.entry--queued .entry__body {
  color: var(--color-text-secondary);
}

.entry--queued.entry--user,
.entry--queued .subagent-notice__message {
  border-left-style: var(--border-style-queued);
}

.entry__failed,
.entry__error {
  display: inline-flex;
  max-width: var(--measure);
  align-items: flex-start;
  gap: var(--space-1);
  color: var(--color-danger);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: normal;
}

.entry__live-text {
  max-width: var(--measure);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.cursor {
  display: inline-block;
  width: var(--size-marker);
  height: var(--text-md-line);
  margin-left: var(--space-1);
  vertical-align: text-bottom;
  background: var(--color-accent);
  animation: blink var(--duration-blink) steps(2) infinite;
}

@keyframes blink {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.entry--system {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  overflow-wrap: break-word;
}

/* `//` lines sit on dense rows, as tool lines do. */
p.entry--system,
.startup-step__line,
.job__line {
  padding-block: calc((var(--size-row-dense) - var(--text-xs-line)) / 2);
}

.startup-step {
  display: flex;
  flex-direction: column;
}

/* Wraps between items; an item breaks only when wider than the line. */
.startup-step__item {
  display: inline-block;
  max-width: 100%;
}

.startup-step__number,
.startup-step__state {
  font-variant-numeric: tabular-nums;
}

.startup-step__state--running {
  color: var(--color-accent);
}

.startup-step__state--done {
  color: var(--color-success);
}

.startup-step__state--failed,
.startup-step__error {
  color: var(--color-danger);
}

.startup-step__error {
  white-space: pre-wrap;
}

/* A command's line: its words, then a cleared conversation's rule
   filling the rest of the line, centred on it. */
.command-line__line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-block: calc((var(--size-row-dense) - var(--text-xs-line)) / 2);
}

.command-line__text {
  min-width: 0;
}

.command-line__rule {
  flex: 1 1 0;
  min-width: var(--space-4);
  border-top: var(--border-width) solid var(--color-line);
}

.command-line__who--session {
  color: var(--color-accent);
}

.command-line__running {
  color: var(--color-accent);
}

.command-line__command {
  color: var(--color-text-primary);
}

.command-line__failed,
.command-line__error {
  color: var(--color-danger);
}

.command-line__error {
  margin-top: var(--space-1);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.command-line__time {
  font-variant-numeric: tabular-nums;
}

/* A queued command's body: the command, mono, no Markdown. */
.entry__command {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

.job {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The line as a button: the system line's look, wrapping between items. */
.job__line {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.job__line:hover {
  color: var(--color-text-secondary);
}

.job__line .icon {
  vertical-align: middle;
}

/* Agent-chosen text: one item that never wraps, cut at the line's width. */
.job__label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--color-text-secondary);
}

.job__outcome--success {
  color: var(--color-success);
}

.job__outcome--failed {
  color: var(--color-danger);
}

.job__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.notices {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.notice {
  max-width: var(--measure);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.notice__label {
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.notice__text {
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.reasoning__toggle {
  min-height: var(--size-row-dense);
}

.reasoning__text {
  max-width: var(--measure);
  margin: 0 0 var(--space-2) calc(var(--size-icon) + var(--space-1));
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  white-space: pre-wrap;
}

.reasoning + .entry__body:has(> *) {
  margin-top: var(--space-2);
}

/* Tool lines: one borderless mono row each, stacked with no gap. */
.tool-line {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

.tool-line__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--size-row-dense);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-tertiary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tool-line__row .icon {
  margin-right: calc(var(--space-1) - var(--space-2));
  color: var(--color-text-tertiary);
}

.tool-line__row:hover {
  color: var(--color-text-secondary);
}

.tool-line__name {
  flex: none;
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.tool-line__row:hover .tool-line__name {
  color: var(--color-text-primary);
}

/* The argument truncates first; name, state and duration never do. */
.tool-line__argument {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-line__state,
.tool-line__duration {
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tool-line__state {
  min-width: var(--size-tool-state);
}

.tool-line__duration {
  min-width: var(--size-duration);
}

.tool-line__state--running {
  color: var(--color-accent);
}

.tool-line__state--failed,
.tool-line__error {
  color: var(--color-danger);
}

.tool-line__error,
.tool-line__body,
.own-line__error,
.own-line__body {
  margin-left: calc(var(--size-icon) + var(--space-1));
}

.tool-line__error {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-line__body,
.own-line__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

/* ethologist tool lines: `//` lines whose chevron and duration are the
   button; a click elsewhere on the line toggles it too. */
.own-line__line {
  min-height: var(--size-row-dense);
  padding: calc((var(--size-row-dense) - var(--text-xs-line)) / 2) 0;
  cursor: pointer;
}

.own-line__line:hover {
  color: var(--color-text-secondary);
}

.own-line__chosen {
  color: var(--color-text-secondary);
}

.own-line__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  vertical-align: bottom;
  cursor: pointer;
}

.own-line__error {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-danger);
}

/* An entry of lines under its sender's header. */
.entry--lines .entry__header {
  margin-bottom: var(--space-1);
}

/* Chat input */

.chat-input {
  position: sticky;
  container-type: inline-size;
  bottom: 0;
  z-index: var(--layer-sticky);
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--chat-inset);
  background: var(--color-bg-base);
  border-top: var(--border);
}

/* In place of the chat input for a viewer who may only read the
   session: the same dock, one wrapping sentence after a lock. */
.read-only-note {
  position: sticky;
  bottom: 0;
  z-index: var(--layer-sticky);
  padding: var(--space-3) var(--chat-inset);
  background: var(--color-bg-base);
  border-top: var(--border);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

/* DESIGN.md "Safe areas": a dock at the viewport's bottom clears the
   home indicator, its padding the larger of its own and the inset;
   over the on-screen keyboard, which covers the indicator, it keeps
   --space-2, the model row's gap above. */
:is(.chat-input, .read-only-note, .job-bar, .timer-bar) {
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
}

.shell--keyboard :is(.chat-input, .read-only-note, .job-bar, .timer-bar) {
  padding-bottom: var(--space-2);
}

.chat-input > .attachment-tray {
  margin-bottom: var(--space-2);
}

/* The composer flag: over the stream, its bottom edge on the input's
   top edge, its sides the frame's; it moves nothing. */
.chat-input__flag {
  position: absolute;
  bottom: calc(100% + var(--border-width));
  left: var(--chat-inset);
  right: var(--chat-inset);
  z-index: var(--layer-overlay);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-danger-dim);
  border: var(--border-width) solid var(--color-danger);
  color: var(--color-danger);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

.chat-input__flag-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Dismiss takes one line of the sentence's height, centred on its first
   line, its overflow in the flag's padding. */
.chat-input__flag .button {
  flex: none;
  margin-block: calc((var(--size-line) - var(--size-control-small)) / 2);
}

/* The activity scanner sits on the top border, so it neither reserves
   space nor moves content. */
.chat-activity__scanner {
  position: absolute;
  top: calc(-1 * var(--border-width));
  left: 0;
  right: 0;
  height: var(--border-width-strong);
  overflow: hidden;
  pointer-events: none;
}

.chat-activity__scanner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: var(--space-8);
  height: 100%;
  background: var(--color-accent);
  animation: scan var(--duration-scan) var(--ease-in-out) infinite alternate;
}

@keyframes scan {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(100cqw + 2 * var(--chat-inset) - var(--space-8)));
  }
}

.button--abort[aria-busy="true"] .icon {
  animation: pulse var(--duration-pulse) var(--ease-in-out) infinite alternate;
}

/* Agent select bar: in the agent list's place below --breakpoint-lg and
   while the main agent is alone. */
.agent-select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--chat-inset);
  border-bottom: var(--border);
}

.agent-select-bar__label {
  color: var(--color-text-tertiary);
  flex: none;
}

.agent-select-bar .select {
  flex: 1 1 var(--size-sidebar);
  min-width: 0;
}

.agent-select-bar .select select {
  width: 100%;
}

.key-values--row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

/* The chat input's frame: attach, the text, then the action cell, in
   one row; the cells end-aligned, centred on the text's last line. */
.composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-bg-void);
  border: var(--border-control);
  transition: border-color var(--duration-fast) linear;
  --composer-line: calc(var(--text-md-line) + 2 * var(--space-1));
}

.composer:hover {
  border-color: var(--color-text-secondary);
}

.composer:has(.composer__text:focus) {
  outline: var(--focus-band);
  outline-offset: 0;
}

.composer--invalid,
.composer--invalid:hover {
  border-color: var(--color-danger);
}

/* Closed: a disabled field, its controls disabled. */
.composer:has(.composer__text:disabled) {
  background: var(--color-bg-disabled);
  border-color: var(--color-line);
}

.composer__attach,
.composer__action {
  flex: none;
  margin-bottom: calc((var(--composer-line) - var(--size-control-small)) / 2);
}

.composer__attach {
  display: inline-flex;
}

.composer__text {
  flex: 1;
  min-width: 0;
  min-height: var(--composer-line);
  max-height: calc(8 * var(--text-md-line) + 2 * var(--space-1));
  overflow-y: auto;
  resize: none;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: 0;
  outline: none;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
}

.composer__text:disabled {
  color: var(--color-text-tertiary);
  cursor: not-allowed;
}

/* The new session's first message grows with its text. */
.composer__text--start {
  field-sizing: content;
}

/* The placeholder (or the closed input's reason) is one line. */
.composer__text::placeholder {
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer__text:disabled::placeholder {
  color: var(--color-text-secondary);
}

/* The action cell: its states stacked in one cell as wide as the
   widest, the split button, end-aligned, so nothing moves as the state
   changes. */
.composer__action {
  display: grid;
  justify-items: end;
  align-items: end;
}

.composer__state {
  grid-area: 1 / 1;
}

.composer__state--hidden {
  visibility: hidden;
}

/* The split button: send in the delivery mode, joined to its chevron
   by a base-coloured line. */
.send-split {
  display: flex;
}

.send-split .menu-button {
  display: flex;
}

.send-split__delivery {
  border-left: var(--border-width) solid var(--color-bg-base);
}

/* A delivery mode: its diamond beside the label's line, the label over
   its sentence. */
.send-menu__item {
  align-items: flex-start;
  height: auto;
  min-height: var(--size-control);
  padding: var(--space-2) var(--space-3);
}

.send-menu__item .menu__check {
  margin-top: calc((var(--text-2xs-line) - var(--size-marker)) / 2);
}

.send-menu__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.send-menu__label {
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  font-variant-ligatures: none;
}

.send-menu__sentence {
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

/* A narrow chat: the sends are icon-only, so the text keeps room and
   the row stays one line. */
/* --size-pane */
@container chat (width < 30rem) {
  .composer__send,
  .send-split__send {
    min-width: var(--size-control-small);
    padding: 0;
    justify-content: center;
  }

  .composer__label {
    position: absolute;
    width: var(--size-visually-hidden);
    height: var(--size-visually-hidden);
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}


/* Reference completion: above the frame, its left edge at the
   textarea's (after the attach button). */
.completion {
  position: absolute;
  bottom: calc(100% + var(--space-1));
  left: calc(2 * var(--space-1) + var(--size-control-small));
  right: 0;
  max-width: var(--size-pane);
  max-height: var(--size-completion-max);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: var(--layer-overlay);
  padding: var(--space-1) 0;
  background: var(--color-bg-raised);
  border: var(--border);
}

.completion__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-row-dense);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}

.completion__folder {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: normal;
  color: var(--color-text-secondary);
}

.completion__option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  border-left: var(--border-width-strong) solid transparent;
  cursor: pointer;
}

.completion__option:hover {
  background: var(--color-bg-hover);
}

.completion__option--active,
.completion__option--active:hover {
  background: var(--color-bg-selected);
  border-left-color: var(--color-accent);
}

.completion__option .icon {
  flex: none;
  color: var(--color-text-tertiary);
}

.completion__name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.completion__match {
  color: var(--color-accent);
}

/* A command's option: the command, then its sentence, wrapping and
   never cut. */
.command-option {
  height: auto;
  min-height: var(--size-control);
  padding: var(--space-2) var(--space-3);
  align-items: baseline;
}

.command-option__name {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-primary);
}

.command-option__sentence {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.completion__slash {
  color: var(--color-text-tertiary);
}

.completion__detail {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.completion__detail--empty {
  font-family: var(--font-mono);
}

.completion__facts {
  flex: none;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-tertiary);
}

.completion__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.completion__status--warning {
  color: var(--color-warning);
}

.completion__status--error {
  font-family: var(--font-sans);
  color: var(--color-danger);
}


.completion__retrying {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--color-warning);
}

/* --breakpoint-md */
@media (width < 48em) {
  .completion {
    left: 0;
    max-width: none;
  }
}

/* An @ reference in a sent message: mono, apart from inline code; it
   moves whole to the next line and, wider than the line, breaks at its
   separators. */
.reference {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  font-family: var(--font-mono);
  font-size: var(--text-code-inline);
  color: var(--color-text-primary);
}

.link .reference {
  color: inherit;
}

/* Artifact viewer */

.viewer-banner {
  padding: var(--space-3) var(--space-5) 0;
}

.viewer-body {
  padding: var(--space-6) var(--space-5);
}

.viewer-body--pane {
  padding: var(--space-5);
}

.viewer-text {
  padding: var(--space-5);
}

/* A pane tab's lists, one below the other (DESIGN.md "Sections", pane
   sections). */
.pane-section + .pane-section {
  border-top: var(--border);
}

/* A collapsible pane section's header: its toggle, then its facts, tab
   row or actions (DESIGN.md "Sections", collapsible pane sections). */
.pane-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: var(--size-pane-section-header);
  padding: 0 var(--space-3);
}

.pane-section--open > .pane-section__header {
  border-bottom: var(--border);
}

.pane-section__header > .section-label {
  flex: none;
  align-self: stretch;
  display: flex;
  margin: 0;
}

.pane-section__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.pane-section__toggle .icon {
  color: var(--color-text-tertiary);
}

.pane-section__toggle:hover:not([aria-disabled="true"]) {
  color: var(--color-text-primary);
}

.pane-section__toggle:focus-visible {
  outline: var(--focus-band);
  outline-offset: var(--focus-offset-inset);
}

.pane-section__toggle[aria-disabled="true"],
.pane-section__toggle[aria-disabled="true"] .icon {
  color: var(--color-text-disabled);
  cursor: default;
}

.pane-section__reason {
  min-width: 0;
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.pane-section__fact {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.pane-section__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-section__body > .empty-state {
  flex: 1;
}

/* A section's tab row takes the header's room after the toggle; the
   header's line is its line (DESIGN.md "Tabs", section tab row). */
.pane-section__tabs {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
}

.tabs--section {
  flex: 1;
  border-bottom: 0;
}

.tabs--section .tab,
.tabs--section .tabs__more-trigger {
  padding: 0 var(--space-2);
}

.pane-section > .section-label {
  display: block;
  margin: 0;
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.pane-section > .empty-state.empty-state--inline {
  padding: var(--space-3);
}

.pane-section > .banner {
  margin: var(--space-3);
}

.viewer-versions {
  padding: var(--space-5);
  border-top: var(--border);
}

/* An image fills at most this much of the viewport's height in the pane. */
.image-body {
  --image-body-height: var(--size-image-max);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: var(--space-4);
  background: var(--color-bg-void);
}

.image-body__image {
  display: block;
  max-width: 100%;
  max-height: var(--image-body-height);
  border: var(--border);
}

.image-body--actual {
  display: block;
  max-height: calc(var(--image-body-height) + 2 * var(--space-4));
  overflow: auto;
}

.image-body--actual .image-body__image {
  max-width: none;
  max-height: none;
  height: auto;
}

.image-body--sizeless .image-body__image {
  width: 100%;
  height: var(--image-body-height);
}

.image-body--window {
  --image-body-height: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
}

.image-body--window.image-body--actual {
  max-height: none;
}

/* Artifact list */

.artifact-name {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  max-width: 100%;
}

.artifact-name__chevron {
  flex: none;
  width: var(--size-icon);
}

.artifact-name--toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.artifact-name--toggle:hover,
.artifact-name__link:hover {
  color: var(--color-accent);
}

.artifact-name__link {
  color: inherit;
  text-decoration: none;
}

.artifact-name__link:hover {
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.table--list .table__icon .icon {
  display: block;
}

/* A row of several lines has its icon beside its first line, as the
   rule for icons beside a wrapping label does. */
.table--list .table__icon {
  padding-top: calc(var(--space-1) + (var(--size-line) - var(--size-icon)) / 2);
  vertical-align: top;
}

/* A header-less list (artifacts, uploads) fits the pane's width: icon
   and action columns set by its <colgroup>, the name takes the rest
   and wraps at its separators. */
.table--list {
  table-layout: fixed;
  width: 100%;
}

.table--list .table__icon-column {
  width: calc(var(--size-icon) + 2 * var(--space-3));
}

.table--list .table__action-column {
  width: calc(var(--size-control-small) + 2 * var(--space-3));
}

/* A file's size, up to 1023.9 KiB, in the cells' font. */
.table--list .table__size-column {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  width: calc(var(--size-disk) + 2 * var(--space-3));
}

/* Two icon-only row actions, --space-1 apart. */
.table--list .table__action-column--pair {
  width: calc(2 * var(--size-control-small) + var(--space-1) + 2 * var(--space-3));
}

.table--list .table__name {
  overflow: hidden;
}

/* An artifact's versions fit the pane's width: the other columns as
   wide as their values, the description the rest, wrapping. */
.table--versions {
  width: 100%;
}

.table--versions td {
  white-space: nowrap;
}

.table--versions td.table__text {
  width: 100%;
  white-space: normal;
}

/* Attachments */

.menu__item .icon {
  margin-right: var(--space-2);
}

.attach-button {
  display: inline-flex;
}

.attachment-tray {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.attachment-tray__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  max-height: calc(3 * var(--size-control-small) + 2 * var(--space-1));
  overflow-y: auto;
}

.attachment-tray__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.attachment-tray__count {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-secondary);
}

.attachment-tray__refusal {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin: 0;
  color: var(--color-danger);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control-small);
  max-width: var(--size-column);
  padding-left: var(--space-2);
  background: var(--color-bg-raised);
  border: var(--border);
}

.attachment-chip__icon {
  display: inline-flex;
  color: var(--color-text-tertiary);
}

.attachment-chip__name {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
}

.attachment-chip__size {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
}

.attachment-chip__not-shown {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-warning);
}

.attachment-tray__note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin: 0;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
}

.attachment-tray__note .icon {
  flex: none;
  color: var(--color-warning);
}

.session-prompt__attach {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.drop-zone {
  position: relative;
}

.drop-target {
  position: absolute;
  inset: var(--space-3);
  z-index: var(--layer-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-scrim);
  border: var(--border-width-strong) var(--border-style-drop) var(--color-accent);
  text-align: center;
  pointer-events: none;
}

.drop-target__label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  color: var(--color-accent);
  text-transform: uppercase;
}

.drop-target__sentence {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--color-text-secondary);
}

.drop-target--refused {
  border-color: var(--color-line-strong);
}

.drop-target--refused .drop-target__label {
  color: var(--color-text-tertiary);
}

.attachments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  max-width: var(--measure);
}

.attachments__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.attachment {
  display: flex;
  align-items: center;
  min-height: var(--size-thumb);
  max-width: var(--size-column);
  background: var(--color-bg-raised);
  border: var(--border);
}

.attachment__thumb {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--size-thumb);
  height: 100%;
  background: var(--color-bg-void);
  border-right: var(--border);
  color: var(--color-text-tertiary);
}

.attachment__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.attachment__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 var(--space-2);
}

.attachment__name {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
}

.attachment__name--pending {
  color: var(--color-text-secondary);
}

.attachment__link {
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.attachment__link:hover {
  color: var(--color-accent);
}

.attachment__facts {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
}

.attachment__action {
  flex: none;
  margin-right: var(--space-1);
}

.upload-progress {
  width: 100%;
  max-width: var(--measure);
  height: var(--space-1);
  margin-top: var(--space-2);
  background: var(--color-line);
}

.upload-progress__fill {
  height: 100%;
  background: var(--color-accent);
}

.upload-progress__text {
  text-transform: none;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
}

.upload-progress__retrying {
  color: var(--color-warning);
}

.upload-group th {
  padding: var(--space-2) var(--space-3);
  white-space: normal;
  background: var(--color-bg-raised);
  border-bottom: var(--border-subtle);
  text-align: left;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

.upload-group__line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

.upload-group__user {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--person-color);
}

.upload-group__time,
.upload-group__count,
.upload-group__none {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
}

.upload-group__count {
  margin-left: auto;
}

/* The message's first line, whole, wrapping. */
.upload-group__text {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.upload-row--nested {
  padding-left: var(--space-4) !important;
}

/* --breakpoint-md */
@media (width < 48em) {
  .attachment,
  .attachment-chip {
    max-width: 100%;
  }
}

/* Markdown */

.markdown {
  max-width: var(--measure);
  overflow-wrap: break-word;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown > :last-child {
  margin-bottom: 0;
}

.markdown--viewer {
  font-size: var(--text-lg);
  line-height: var(--text-lg-line);
}

/* A message fills the column: its wrapping text keeps the measure,
   its code blocks and tables grow with their content up to the column,
   then scroll sideways. */
.markdown--message {
  max-width: none;
  font-size: var(--text-md);
  line-height: var(--text-md-line);
}

.markdown--message p,
.markdown--message h1,
.markdown--message h2,
.markdown--message h3,
.markdown--message h4,
.markdown--message h5,
.markdown--message h6,
.markdown--message .markdown__task,
.markdown--message .markdown__html {
  max-width: var(--measure);
}

.markdown--message .code-block,
.markdown--message .markdown__table {
  width: fit-content;
  min-width: min(100%, var(--measure));
  max-width: 100%;
}

/* A table's cells keep their lines, as code does. */
.markdown--message .table {
  width: max-content;
  min-width: 100%;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown .code-block,
.markdown__table,
.markdown__html,
.markdown__footnote {
  margin: 0 0 var(--space-4);
}

.markdown ul,
.markdown ol {
  padding-left: var(--space-5);
}

.markdown li::marker {
  color: var(--color-text-tertiary);
}

.markdown li > p {
  margin-bottom: var(--space-1);
}

.markdown__task {
  list-style: none;
}

.markdown__task .read-only-square {
  margin-left: calc(-1 * var(--space-5));
  margin-right: var(--space-2);
}

.markdown__task > p {
  display: inline;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: var(--space-6) 0 var(--space-3);
  font-weight: var(--weight-semibold);
}

.markdown--viewer h1 {
  font-size: var(--text-2xl);
  line-height: var(--text-2xl-line);
  letter-spacing: var(--tracking-title);
}

.markdown--viewer h2 {
  font-size: var(--text-xl);
  line-height: var(--text-xl-line);
  letter-spacing: var(--tracking-title);
  padding-bottom: var(--space-2);
  border-bottom: var(--border);
}

.markdown--viewer h3 {
  font-size: var(--text-lg);
  line-height: var(--text-lg-line);
}

.markdown--viewer h4,
.markdown--viewer h5,
.markdown--viewer h6 {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

/* In the side pane, one step down the type scale. */
.markdown--pane {
  font-size: var(--text-md);
  line-height: var(--text-md-line);
}

.markdown--pane h1 {
  font-size: var(--text-xl);
  line-height: var(--text-xl-line);
}

.markdown--pane h2 {
  font-size: var(--text-lg);
  line-height: var(--text-lg-line);
  letter-spacing: normal;
}

.markdown--pane h3 {
  font-size: var(--text-md);
  line-height: var(--text-md-line);
}

.markdown--message h1,
.markdown--message h2,
.markdown--message h3,
.markdown--message h4,
.markdown--message h5,
.markdown--message h6 {
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  margin: var(--space-4) 0 var(--space-2);
}

.markdown a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.markdown code {
  font-size: var(--text-code-inline);
  padding: 0 var(--space-1);
  background: var(--color-bg-raised);
  border: var(--border);
}

.markdown .code-block code,
.markdown pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.markdown .code-block {
  font-size: var(--text-md);
}

.markdown blockquote {
  padding-left: var(--space-4);
  border-left: var(--border-width-strong) solid var(--color-line-strong);
  color: var(--color-text-secondary);
}

.markdown hr {
  margin: var(--space-6) 0;
  border: 0;
  border-top: var(--border);
}

.markdown__table {
  overflow-x: auto;
}

.markdown .table {
  font-size: var(--text-sm);
}

.markdown .align-center {
  text-align: center;
}

.markdown .align-right {
  text-align: right;
}

.markdown__html {
  white-space: pre-wrap;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.markdown__footnote {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.markdown__footnote-label {
  font-family: var(--font-mono);
}

/* Markdown images: natural size, scaled down to the prose width and
   the image height bound, aspect kept. */
.markdown__image {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.markdown a.markdown__image {
  text-decoration: none;
}

.markdown__image-picture {
  display: block;
  max-width: 100%;
  max-height: var(--size-markdown-image-max);
  width: auto;
  height: auto;
  border: var(--border);
  transition: border-color var(--duration-fast) linear;
}

.markdown__image:hover .markdown__image-picture {
  border-color: var(--color-accent);
}

.markdown__images {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
}

.markdown__image--missing,
.markdown__image--pending {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: var(--border);
}

.markdown__image--missing {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-secondary);
  background: var(--color-bg-void);
}

.markdown__image--pending {
  border-style: var(--border-style-pending);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-tertiary);
}

/* Narrow viewports */

/* --breakpoint-lg */
@media (width < 80em) {
  /* A wide-only column's values join the name's cell. */
  .table__wide-lg {
    display: none;
  }

  .table__narrow-lg {
    display: block;
  }

  .agent-list {
    display: none;
  }
}

/* A narrow main pane: the facts (a session's badge, cost and badges)
   take their own row under the title, so they never squeeze beside
   it. */
/* --breakpoint-session-panes */
@container main (width < 48rem) {
  .page-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "facts facts";
    row-gap: var(--space-2);
  }

  .page-header--breadcrumb {
    grid-template-areas:
      "crumb actions"
      "title actions"
      "facts facts";
  }

  .page-header--title-box.page-header--breadcrumb {
    grid-template-areas:
      "crumb crumb"
      "title actions"
      "facts facts";
  }
}

/* The narrow-view menu (design/pages/shell.md): below --breakpoint-md,
   and on a touch screen below --breakpoint-lg. As wide as a column but
   always leaving the page a touch target's width, its items touch
   targets, its edges inside the safe area. */
/* --breakpoint-md, --breakpoint-lg */
@media (width < 48em), (pointer: coarse) and (width < 80em) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar__toggle {
    display: none;
  }

  .topbar__menu {
    display: inline-flex;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: calc(var(--size-topbar) + env(safe-area-inset-top));
    bottom: 0;
    left: 0;
    width: min(calc(var(--size-column) + env(safe-area-inset-left)), 100% - var(--size-target-touch));
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
    padding-left: calc(var(--space-3) + env(safe-area-inset-left));
    z-index: var(--layer-overlay);
    --nav-item-height: var(--size-target-touch);
    --nav-session-height: var(--size-target-touch);
  }

  .sidebar--open {
    display: flex;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: calc(var(--size-topbar) + env(safe-area-inset-top)) 0 0 0;
    z-index: var(--layer-overlay);
    background: var(--color-scrim);
  }
}

/* --breakpoint-md */
@media (width < 48em) {
  /* While the stream badge shows, the wordmark keeps only its square;
     its text stays the link's name. */
  .topbar:has(.topbar__status .badge) .wordmark__text {
    position: absolute;
    width: var(--size-visually-hidden);
    height: var(--size-visually-hidden);
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }


  .page-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "facts facts";
    row-gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }

  .page-header--breadcrumb {
    grid-template-areas:
      "crumb crumb"
      "title actions"
      "facts facts";
  }

  /* One action and the "More actions" menu, on the title's row. */
  .page-header__actions {
    flex-wrap: nowrap;
    align-self: start;
  }

  .page-header__overflow {
    display: none;
  }

  .page-header__more {
    display: block;
  }

  .user-menu__name {
    display: none;
  }
}

/* A table stacks by the main pane's width, not the viewport's, so the
   sidebar's width never squeezes its name column. */
/* --breakpoint-md */
@container main (width < 48rem) {
  /* Lists keep their name, a time and the row action; the state and
     the other values stack in the name's cell. */
  .table__wide,
  .table .table__identifier > .table__wide {
    display: none;
  }

  .table__narrow {
    display: block;
  }

  .table__narrow-inline {
    display: inline;
  }

  /* The global audit log takes the pane's columns: its session and detail
     (.table__wide) show only in the expanded row, the time is HH:MM:SS. */
  .table--audit .audit-column--time {
    width: var(--size-column-time);
  }

  .table--audit .audit-column--who {
    width: min(var(--size-sidebar), calc((100% - var(--size-column-time)) / 3));
  }

  .table--audit .audit-column--actor {
    width: min(var(--size-sidebar), calc(var(--audit-actor) + 2 * var(--space-3)));
  }

  /* With no target laid out, the action takes the rest. */
  .table--audit .audit-column--rest {
    width: auto;
  }

  .table__day--narrow {
    display: table-row;
  }

  .table--audit .audit-column--target {
    width: auto;
  }
}

/* The session view in one column, chat or pane, wherever the main pane
   is too narrow for the chat's --size-chat-min beside the pane's
   --size-column; after --breakpoint-lg's columns, so it wins. */
/* --breakpoint-session-panes */
@container main (width < 48rem) {
  .session-tabs {
    display: flex;
  }

  .session-views {
    display: flex;
    align-items: center;
    min-width: 0;
    border-bottom: var(--border);
  }

  .session-views > .session-tabs {
    flex: 1;
    border-bottom: 0;
  }

  .session-views > .agent-select-bar {
    flex: 0 1 var(--size-sidebar);
    max-width: calc(100% - var(--size-sidebar));
    padding: 0 0 0 var(--space-3);
    border-bottom: 0;
  }


  .session-tabs .tab,
  .session-tabs .tabs__more-trigger {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .session__body,
  .session__body:has(> .side-pane--collapsed) {
    grid-template-columns: minmax(0, 1fr);
  }

  .session__body--chat > .side-pane,
  .session__body:not(.session__body--chat) > .chat {
    display: none;
  }

  /* One column: the pane's own tabs, rail and border give way to the
     session's tab row. */
  .side-pane,
  .side-pane--collapsed,
  .side-pane:has(> .side-pane__separator) {
    border-left: 0;
    padding-left: 0;
    align-items: stretch;
  }

  .side-pane__tabs,
  .side-pane__separator,
  .side-pane--collapsed > * {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
  }

  .chat-activity__scanner::before {
    width: 100%;
    animation: none !important;
  }

  .button--abort[aria-busy="true"] .icon,
  .live,
  .badge.live .marker,
  .cursor {
    animation: none !important;
    opacity: 1 !important;
  }
}

/* Model settings */

.model-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0;
}

.model-facts dt {
  color: var(--color-text-tertiary);
}

.model-facts dd {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.override-marker {
  margin-left: var(--space-2);
  color: var(--color-text-secondary);
}

/* A field a pick filled: `FROM <SOURCE>` after its label, legend or
   checkbox text, the override marker's style; a label holding one may
   wrap before it. */
.field__marker {
  display: inline-block;
  margin-left: var(--space-2);
  color: var(--color-text-secondary);
}

.field__label:has(> .field__marker) {
  white-space: normal;
}

.advanced__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.advanced__count {
  color: var(--color-text-tertiary);
}

.advanced__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.advanced__fields[hidden] {
  display: none;
}

/* An advanced part's one sentence, first among its fields. */
.advanced__note {
  margin: 0;
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-tertiary);
}

.add-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}

.add-bar > .field {
  min-width: 0;
}

/* Its text on the labels' start edge. */
.advanced__toggle > .button,
.legend > .button {
  margin-left: calc(-1 * var(--space-3));
}

.checkbox-input {
  appearance: none;
  flex: none;
  /* The label's line height, for centring on its first line. */
  font: inherit;
  display: inline-grid;
  place-content: center;
  width: var(--size-icon);
  height: var(--size-icon);
  margin: 0;
  border: var(--border-control);
  background: var(--color-bg-void);
  cursor: pointer;
}

.checkbox-input:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* A checked box apart from the focus band around it. */
.checkbox-input:checked:focus-visible {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
}

/* The mark is laid out unchecked too, so checking does not move the
   box: an empty inline grid sits on another baseline. */
.checkbox-input::before {
  content: "";
  width: var(--size-marker);
  height: var(--size-marker);
}

.checkbox-input:checked::before {
  background: var(--color-text-on-fill);
}

/* Disabled, unless a grants row's box is only busy saving. */
.checkbox-input:is(:disabled, [aria-disabled="true"]):not(.grants__check *, .grants__check-label *) {
  border-color: var(--color-line);
  cursor: not-allowed;
}

.checkbox-input:is(:disabled, [aria-disabled="true"]):not(.grants__check *, .grants__check-label *):checked {
  background: var(--color-text-disabled);
}

/* Subagents */

.key-values__line {
  display: block;
}

.key-values__none {
  color: var(--color-text-tertiary);
}

.subagent-notice__line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.subagent-notice__label,
.subagent-notice__truncated {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}

.subagent-notice__name {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  min-width: 0;
}

.subagent-notice__stopped {
  margin: var(--space-2) 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.subagent-notice__message {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
  border-left: var(--border-width-strong) solid var(--color-line-strong);
  padding-left: var(--space-3);
}

.audit-settings {
  padding: var(--space-3);
}

/* VM list */

.vm-bar__text {
  color: var(--color-text-tertiary);
}

.vm-bar__updated {
  margin-left: auto;
}

/* The list of a session's unsaved files, each item on its own line. */
.unsaved-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.unsaved-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
}

.vm-marker {
  margin-left: var(--space-2);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.vm-marker--warning {
  color: var(--color-warning);
}

/* The VM tables fit the pane's width: the state and OS columns as wide
   as their widest values, the name the rest, breaking
   at its separators and between its markers. Widths are set in the
   cells' fonts, on the tables' columns. */
.vm-table {
  table-layout: fixed;
}

.vm-table__state-column {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  width: calc(var(--size-badge-vm) + 2 * var(--space-3));
}

/* "windows" and "android". */
.vm-table__os-column {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  width: var(--size-column-os);
}

/* In a table cell, the gap before a marker sits at the end of what
   precedes it, where a line break hides it, so a marker that wraps
   starts flush with the cell. */
.vm-table td > :has(+ .vm-marker) {
  margin-right: var(--space-2);
}

.vm-table td > .vm-marker {
  margin-left: 0;
}

/* A VM is its own body, its row inside it not positioned, so its row
   link covers the body. */
.vm-table__item > .table__row {
  position: static;
}

.vm-table__item:hover > .table__row {
  background: var(--color-bg-hover);
}

.vm-table__item--details > .table__row:first-child > td {
  border-bottom: 0;
}

.vm-table .vm-table__details-row > td {
  height: auto;
  padding-top: 0;
}

.vm-table__details-row .table__details {
  margin: 0;
  overflow-wrap: normal;
}

.vm-banner {
  padding: var(--space-3) var(--space-5);
}

/* The sandbox VM, below the lab's VMs behind its disclosure. */
.vm-sandbox {
  padding-top: var(--space-4);
}

.vm-sandbox__table {
  margin-top: var(--space-2);
}

/* VM page and its screen */

/* A VM's pane: its sections stacked, scrolling as one under the pane
   header. One section open takes the pane's height left by the others'
   headers (design/pages/vms.md "VM pane"). */
.vm-pane {
  display: flex;
  flex-direction: column;
  overflow: auto;
  container-type: size;
}

.vm-pane > .empty-state {
  flex: 1;
}

.vm-pane > .pane-section {
  flex: none;
  display: flex;
  flex-direction: column;
}

.vm-pane > .pane-section--open {
  flex: 1 1 0;
  min-height: 0;
}

.vm-pane > .pane-section--open > .pane-section__body {
  flex: 1;
  min-height: 0;
}

/* Both open: SCREEN as tall as its picture at the pane's width, at most
   the pane's height or the divider's; SHELLS takes the rest, never less
   than its toolbar and least area, the pane scrolling past that. */
.vm-pane--stacked > .vm-pane__screen.pane-section--open {
  flex: none;
  /* token-lint: allow the VM pane's own height, a container unit */
  max-height: var(--vm-screen-height, 100cqh);
}

.vm-pane--stacked > .vm-pane__screen > .pane-section__body,
.vm-pane--stacked > .vm-pane__screen .live-pane,
.vm-pane--stacked > .vm-pane__screen .live-stage,
.vm-pane--stacked > .vm-pane__screen .live-area {
  flex: 0 1 auto;
  min-height: 0;
}

.vm-pane--stacked > .vm-pane__screen .live-notices {
  flex: none;
}

/* The screen's area keeps its least height, the picture centred in
   it. */
.vm-pane--stacked > .vm-pane__screen .live-area {
  flex-direction: column;
  justify-content: center;
  min-height: var(--size-live-area-min);
}

.vm-pane--stacked > .vm-pane__screen .live-area__host,
.vm-pane--stacked > .vm-pane__screen .live-area__still--fit {
  flex: 0 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: var(--vm-screen-aspect);
}

/* The host's height comes from its width, which percentages inside
   cannot resolve against: the screen client's box fills it absolutely. */
.vm-pane--stacked > .vm-pane__screen .live-area__host > div {
  position: absolute;
  inset: 0;
}

.vm-pane--stacked > .vm-pane__shells.pane-section--open {
  flex: 1 0 auto;
}

/* The terminal's area lends SHELLS its least height, never its
   terminal's, which follows the area. */
.vm-pane--stacked > .vm-pane__shells .live-area {
  min-height: var(--size-live-area-min);
}

.vm-pane--stacked > .vm-pane__shells .live-area__host {
  contain: size;
}

/* The divider: a resize separator (DESIGN.md "Resize separators"), a
   band of its own between SCREEN and SHELLS in place of SHELLS' top
   border (SHELLS follows no section then), the whole band its hit area,
   so it covers neither the screen's scrollbars nor SHELLS' header; its
   line at the band's centre. */
.vm-pane__divider {
  --divider-band: var(--space-2);
  position: relative;
  flex: none;
  height: calc(var(--divider-band) + var(--border-width));
  cursor: row-resize;
  touch-action: none;
}

.vm-pane__divider::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  top: calc(var(--divider-band) / 2);
  height: var(--border-width);
  background: var(--color-line);
}

/* Grown toward SCREEN, its bottom where the line's is. */
.vm-pane__divider:hover::after,
.vm-pane__divider--dragging::after,
.vm-pane__divider:focus-visible::after {
  top: calc(var(--divider-band) / 2 + var(--border-width) - var(--border-width-strong));
  height: var(--border-width-strong);
  background: var(--color-accent);
}

.vm-pane__divider:focus-visible {
  outline: none;
}

@media (pointer: coarse) {
  .vm-pane__divider {
    --divider-band: var(--size-target);
  }
}

/* A pop-out window's screen or terminal fills the window below its bar,
   with no stack to divide the pane's height between. */
.vm-pane--window {
  flex: 1;
  container-type: normal;
}

.vm-marker--accent {
  color: var(--color-accent);
}

.live-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* A live view's toolbar: the VM list's bar, wrapping; at its end the
   facts, then the actions, on a line of its own when narrow. */
.live-bar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border);
}

/* Bars inside the side pane: its narrower padding. */
.side-pane .live-bar,
.side-pane .terminal-keys {
  padding: var(--space-2) var(--space-3);
}

/* In a pop-out window, the bar is the window's: one line. */
.live-bar--window {
  flex-wrap: nowrap;
  gap: var(--space-3);
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  background: var(--color-bg-void);
  white-space: nowrap;
}

/* DESIGN.md "Toolbars and docks": the end group wraps, its actions
   whole on a line of their own after a fact too wide. */
.live-bar__end {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-left: auto;
  min-width: 0;
}

/* --breakpoint-md */
@media (width < 48em) {
  /* A narrow window's bar wraps, each item whole; the session name, in
     the window's title, goes. */
  .live-bar--window,
  .popout-bar {
    flex-wrap: wrap;
    row-gap: var(--space-2);
    height: auto;
    min-height: var(--size-control);
    padding: var(--space-2) var(--space-3);
  }

  .popout__session {
    display: none;
  }
}

/* Data, not a label: mono, without the label's case and tracking. */
.live-bar__facts {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-variant-ligatures: none;
  display: flex;
  gap: var(--space-3);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* The view's notices in flow between the toolbar and the area, as
   video this browser cannot play. */
.live-notices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg-void);
}

.live-notices:empty {
  display: none;
}

/* The live area and the banners overlaying its top edge. */
.live-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.live-banners {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  padding: var(--space-3) var(--space-3) 0;
  z-index: var(--layer-sticky);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.live-banners > * {
  pointer-events: auto;
}

/* The first connection opening: its loading line centred over the
   area, under the banners. */
.live-connecting {
  position: absolute;
  inset: 0;
  z-index: var(--layer-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* The area a VM's screen or a shell's terminal draws in, on the void,
   unframed: an edge-to-edge view (DESIGN.md "Borders"), padded just the
   focus band's width, its content and scrollbars inside. While it or its
   content holds the focus, the inset band lies on that padding, never
   over its content, and a focus scrolls any ancestor that clips it into
   showing it. */
.live-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  padding: var(--focus-width);
  background: var(--color-bg-void);
}

.live-area:focus-within {
  outline: var(--focus-band);
  outline-offset: var(--focus-offset-inset);
}

.live-area__host {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* A still in place of the screen's picture, drawn as the picture is:
   scaled to the area with its aspect kept (FIT), or in device pixels,
   its box scrolling (1:1). */
.live-area__stills {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: auto;
}

.live-area__still {
  display: block;
  margin: auto;
}

.live-area__still--fit {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* The picture on the void, unframed, centred where it fills one way
   only. */
.live-area--screen .live-area__host {
  --vivarist-screen-background: var(--color-bg-void);
  --vivarist-screen-outline: none;
}

/* A terminal fills its area; one larger than a viewer's area scrolls. */
.live-area--terminal .live-area__host {
  overflow: auto;
}

.live-area__host .xterm .xterm-viewport {
  background-color: var(--color-bg-void);
}

/* Logs that scroll on their own under their filter bar, with the "New
   entries" band between: the audit log and its vivarist events. */

/* A page that fills the main pane, its log scrolling on its own. */
.page-fill {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.page-fill > * {
  flex-shrink: 0;
}

.page-fill > .log-scroll,
.side-pane__content > .log-scroll {
  flex: 1;
  flex-shrink: 1;
  min-height: 0;
}

.log-scroll {
  overflow: auto;
}

/* Floats over the table's top, reserving no space. */
.log-new {
  position: sticky;
  top: 0;
  z-index: var(--layer-sticky-raised);
  display: flex;
  justify-content: center;
  height: 0;
  overflow: visible;
}

.log-new > .button {
  margin-top: var(--space-3);
}

/* vivarist events: with a VM column of every VM's, without one of one
   VM's or of the lab's own */

.table--events th:nth-child(2) {
  width: var(--size-column-event-vm);
}

.table--events th:nth-child(3) {
  width: var(--size-column-event);
}

.table--events-one-source th:nth-child(2) {
  width: var(--size-column-event-wide);
}

.table--events-one-source th:nth-child(3) {
  width: auto;
}

.event-log__detail {
  color: var(--color-text-secondary);
}

.event-gap__label {
  margin-left: 0;
  margin-right: var(--space-2);
}

.event-gap__text {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-secondary);
}

.person {
  color: var(--person-color);
}

.pane-header__parent {
  min-width: 0;
  color: var(--color-text-secondary);
  text-decoration: none;
}

/* A pane section's step, as the tab label before it. */
.pane-header__parent--label {
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.pane-header__parent:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.popout__vm {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
  font-variant-ligatures: none;
}

/* The touch key row, only under a coarse pointer. */
.terminal-keys {
  display: none;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-5);
  border-bottom: var(--border);
}

@media (pointer: coarse) {
  .terminal-keys:not([hidden]) {
    display: flex;
  }
}

/* Data, not a label: as typed, without the label's case and tracking,
   one line cut with an ellipsis. */
.terminal-closed__label {
  text-transform: uppercase;
}

/* After the area, in flow: the area shrinks by its height, so it never
   covers the terminal's output. */
.terminal-closed {
  flex: none;
  display: flex;
  align-items: center;
  min-height: var(--size-row-dense);
  margin: 0;
  padding: 0 var(--space-3);
  border-top: var(--border);
  background: var(--color-bg-raised);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  font-variant-ligatures: none;
}

.terminal-closed__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

/* Access: names, principals, permissions, the picker, the grants
   editor, effective access, page tabs and the access pages. */

/* A workspace, project, session or group name: sans, wrapping at spaces
   only; a word wider than its box breaks only at a Breakable's <wbr>. */
.name {
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  overflow-wrap: normal;
  word-break: normal;
}

.nav-item__text.name {
  font-weight: var(--weight-regular);
  color: inherit;
  padding: var(--space-1) 0;
}

/* A name in the sidebar (DESIGN.md "Navigation items", item name): one
   line, never cut with "…", taking the room the marks after it leave;
   while it overflows, it fades out over its last --size-fade. Clipped
   inline only, and padded, so descenders and accents stay. */
.fading-name {
  flex: 1;
  min-width: 0;
  padding-block: var(--space-1);
  white-space: nowrap;
  overflow-x: clip;
}

.fading-name--cut {
  /* token-lint: allow a mask reads only alpha, not a colour */
  mask-image: linear-gradient(to right, #000 calc(100% - var(--size-fade)), transparent);
}

/* A name ethologist made up in place of a typed one, in every state of
   what holds it (DESIGN.md "Provisional name"); as specific as the
   rules above, which it follows. */
.name--provisional,
.name.name--provisional,
.inline-name.name--provisional,
.nav-item__text.name--provisional,
.table__title.name--provisional,
.title-box__text.name--provisional,
.crumb.name--provisional:hover {
  color: var(--color-text-secondary);
}

.nav-heading--label {
  margin: var(--space-4) 0 var(--space-2);
}

.nav-heading--label:first-child {
  margin-top: 0;
}

.nav-heading--label .nav-label {
  margin: 0;
}

.principal {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

.principal > .icon {
  color: var(--color-text-tertiary);
}

.principal__text {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.principal__name {
  color: var(--color-text-primary);
}

.principal__link {
  color: inherit;
  text-decoration: none;
}

.principal__link:hover .principal__name,
.principal__link:hover .group-ref {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.principal__marker {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-text-tertiary);
}

.group-ref {
  font-family: var(--font-sans);
}

.group-ref__sign {
  color: var(--color-text-tertiary);
}

/* A checkbox shown, not edited (a held permission, a task list's
   item): never accent, as accent marks only what can be changed. */
.read-only-square {
  display: inline-grid;
  place-content: center;
  width: var(--size-icon);
  height: var(--size-icon);
  border: var(--border);
  vertical-align: middle;
}

.read-only-square--checked::before {
  content: "";
  width: var(--size-marker);
  height: var(--size-marker);
  background: var(--color-text-secondary);
}

.legend {
  margin-top: var(--space-3);
}

.legend__body {
  margin-top: var(--space-2);
  max-width: var(--measure);
}

/* The rest of a long explanation, under its note's disclosure: its
   paragraphs --space-2 apart. */
.explanation__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
  max-width: var(--measure);
}

.legend__id {
  margin-left: var(--space-2);
  font-size: var(--text-2xs);
  font-weight: var(--weight-regular);
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-text-tertiary);
}

.legend__list {
  margin-bottom: var(--space-4);
}

.legend__reach {
  margin: 0;
  padding-left: var(--space-4);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

.picker {
  min-width: 0;
  max-width: var(--size-input-long);
}

.picker__input {
  width: 100%;
}

.picker__picked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding-right: var(--space-1);
}

.picker__popup {
  position: fixed;
  inset: auto;
  margin: 0;
  color: inherit;
  max-width: min(var(--size-pane), calc(100vw - 2 * var(--space-4)));
  max-height: var(--size-completion-max);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-1) 0;
  background: var(--color-bg-raised);
  border: var(--border);
}

.picker__label {
  display: flex;
  align-items: center;
  min-height: var(--size-row-dense);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
}

.picker__option {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--size-control);
  padding: var(--space-1) var(--space-3);
  border-left: var(--border-width-strong) solid transparent;
  cursor: pointer;
}

.picker__option:hover {
  background: var(--color-bg-hover);
}

.picker__option--active,
.picker__option--active:hover {
  background: var(--color-bg-selected);
  border-left-color: var(--color-accent);
}

.picker__option[aria-disabled="true"] {
  cursor: default;
  color: var(--color-text-disabled);
}

.picker__details {
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  padding-left: calc(var(--size-icon) + var(--space-2));
}

.picker__match {
  color: var(--color-accent);
}

/* A suggesting input's option: its value, then markers, over its
   name. */
.picker__id {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  font-variant-ligatures: none;
  color: var(--color-text-primary);
  overflow-wrap: anywhere;
}

.picker__marker {
  margin-left: var(--space-2);
  color: var(--color-text-tertiary);
}

.picker__details--flush {
  padding-left: 0;
}

.picker__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.picker__status--error {
  font-family: var(--font-sans);
  color: var(--color-danger);
}

/* An add bar, then its one message line; in an editor, the table
   follows it --space-4 below, as in a section. */
.grants__add {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.grants > .grants__add {
  margin-bottom: var(--space-4);
}

.add-bar__picker {
  flex: 1 1 var(--size-column);
  max-width: var(--size-input-long);
}

.add-bar__picker > .picker {
  max-width: none;
}

.grants__failure {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  flex-basis: 100%;
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-danger);
}

.grants__failure:empty {
  display: none;
}

.grants .table td {
  vertical-align: middle;
}

.grants__busy {
  width: calc(var(--size-marker) + 2 * var(--space-2));
  padding-inline: var(--space-2) 0;
}

.grants__check {
  text-align: center;
  white-space: nowrap;
}

.grants__check .checkbox-input {
  vertical-align: middle;
}

.grants__check .checkbox-input[aria-disabled="true"],
.grants__check-label .checkbox-input[aria-disabled="true"] {
  cursor: progress;
}

.select--small select {
  min-height: var(--size-control-small);
}

.grants__preset-text {
  font-size: var(--text-sm);
  white-space: nowrap;
}

.grants__action {
  white-space: nowrap;
}

.grants__read-only,
.access-note {
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

.grants__read-only {
  margin-bottom: var(--space-3);
}

.access-note {
  margin-top: var(--space-3);
  max-width: var(--measure);
}

.grants__help,
.grants__own {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

/* Laid out from the first render, one line high; shown only while
   the caller's own row holds nothing. */
.grants__own {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--text-xs-line);
  color: var(--color-text-secondary);
}

.grants__own .icon {
  color: var(--color-warning);
}

.grants__own--hidden {
  visibility: hidden;
}

/* Below --breakpoint-md (the instance editor below
   --breakpoint-grants), each grant is a block. */
.grants__blocks {
  display: none;
}

.grants__block {
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
}

.grants__block fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.grants__block-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

/* The action is centred on the name's first line (DESIGN.md "Icons"). */
.grants__block-head > .grants__action {
  margin-block: calc((var(--size-line) - var(--size-control-small)) / 2);
}

.grants__block-name {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.grants__block .select {
  width: var(--size-input-short);
  max-width: 100%;
}

.grants__block select {
  width: 100%;
}

.grants__checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.grants__check-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.grants__check-word {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-text-secondary);
}

/* A permission shown, not edited: its square, then its label. */
.grants__mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  vertical-align: middle;
}

/* The repository grants table: its permission headers wrap at spaces,
   as the instance editor's; a grant's remotes, a mark each, wrap. */
.grants--repository thead .grants__check {
  height: auto;
  padding: var(--space-2) var(--space-3);
  vertical-align: bottom;
  white-space: normal;
}

.grants--repository .grants__remotes-cell {
  text-align: start;
}

.grants__remotes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

.grants__remote {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

/* A grants table stacks by the main pane's width, as tables do. */
/* --breakpoint-md */
@container main (width < 48rem) {
  .grants__table {
    display: none;
  }

  .grants__blocks {
    display: block;
  }

  .add-bar__picker {
    flex-basis: 100%;
    max-width: none;
  }
}

/* Every access editor lays out by its own width: the full table from
   --breakpoint-lg; narrower, without SET BY and SET, whose values join
   the grantee's cell; narrower still (--breakpoint-grants for the
   instance's, --breakpoint-md for the others), blocks. The instance and
   workspace editors' permission headers wrap at spaces, so a column is
   as wide as its longest word. */
.grants--editor {
  container: grants / inline-size;
}

.grants--wrap thead .grants__check {
  height: auto;
  padding: var(--space-2) var(--space-3);
  vertical-align: bottom;
  white-space: normal;
}

/* As wide as its longest option. */
.grants--wrap .grants__preset .select select.input {
  width: auto;
  min-width: 0;
}

/* --breakpoint-lg */
@container grants (width < 80rem) {
  .grants--editor .table__wide-lg {
    display: none;
  }

  .grants--editor .table__narrow-lg {
    display: block;
  }
}

/* --breakpoint-grants */
@container grants (width < 70rem) {
  .grants--wide .grants__table {
    display: none;
  }

  .grants--wide .grants__blocks {
    display: block;
  }
}

/* --breakpoint-md */
@container grants (width < 48rem) {
  .grants--editor .grants__table {
    display: none;
  }

  .grants--editor .grants__blocks {
    display: block;
  }
}

.through,
.through__item {
  white-space: nowrap;
}

/* One line: Chrome breaks at a <wbr> even under nowrap. */
.through wbr {
  display: none;
}

/* Laid out while its item loads, before it has tabs. */
.page-tabs {
  min-height: calc(var(--size-control) + var(--border-width));
  padding: 0 var(--space-3);
}

.page-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* A block's own actions, under it. */
.block__actions {
  margin-top: var(--space-3);
}

.page-section {
  padding: var(--space-5);
}

.page-body > .page-section {
  padding: 0;
}

.page-summary {
  padding: var(--space-2) var(--space-5) 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
}

.page-sentence {
  padding: var(--space-5);
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  max-width: var(--measure);
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  max-width: var(--size-form);
}

.section-heading {
  padding-bottom: var(--space-2);
  border-bottom: var(--border);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: var(--text-lg-line);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

/* Its line height 1, so its smaller font never makes the heading's
   line taller. */
.section-heading__count {
  margin-left: var(--space-2);
  line-height: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--color-text-tertiary);
}

.section-note {
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
  overflow-wrap: break-word;
}

.section-note--warning {
  color: var(--color-warning);
}

.section__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.group {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* A wrapper of fields, such as those a checkbox shows. */
.fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.group-heading {
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

/* A rendered legend is no flex item: its margin is the gap. */
fieldset.group > legend.group-heading {
  margin-bottom: var(--space-4);
}

/* A header-less list in a section: its items one under the other. */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Data in text: a value embedded in text, styled by its kind so it
   looks different from the words around it. */
.inline-code,
.inline-data {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  color: var(--color-text-primary);
}

.inline-data {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inline-name {
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

/* A value that links takes the link's colour. */
:any-link :is(.inline-code, .inline-data, .inline-name) {
  color: inherit;
}

/* In emphasised text a name keeps the text's weight and stands in
   quotes that screen readers skip. */
:is(
    h1,
    h2,
    h3,
    h4,
    .page-header__title,
    .dialog__title,
    .section-heading,
    .group-heading,
    .table__title,
    .item-block__heading,
    .title-box,
    .question__title,
    .question-tray__title,
    .auth-panel__title
  )
  .inline-name {
  font-weight: inherit;
}

:is(
    h1,
    h2,
    h3,
    h4,
    .page-header__title,
    .dialog__title,
    .section-heading,
    .group-heading,
    .table__title,
    .item-block__heading,
    .title-box,
    .question__title,
    .question-tray__title,
    .auth-panel__title
  )
  .inline-name::before {
  content: "\201C" / "";
}

:is(
    h1,
    h2,
    h3,
    h4,
    .page-header__title,
    .dialog__title,
    .section-heading,
    .group-heading,
    .table__title,
    .item-block__heading,
    .title-box,
    .question__title,
    .question-tray__title,
    .auth-panel__title
  )
  .inline-name::after {
  content: "\201D" / "";
}

/* In mono text, code and data stand out by weight. */
:is(.mono, code, .table__details.mono, .details-line.mono, .facts dt, .table--audit td)
  :is(.inline-code, .inline-data) {
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

/* The cap height of the mono text around a name, in pixels, so the
   name can centre on it in its own face. */
@property --mono-cap {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

/* In mono text a name's sans face sets no line of its own: the mono
   line box alone places the line, and the name's cap height centres
   on the mono text's, so a centred line stays centred. */
:is(.mono, code, .table__details.mono, .details-line.mono, .facts dt, .table--audit td) {
  --mono-cap: 1cap;
}

:is(.mono, code, .table__details.mono, .details-line.mono, .facts dt, .table--audit td)
  .inline-name {
  line-height: 0;
  vertical-align: calc((var(--mono-cap) - 1cap) / 2);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
}

/* Facts: a key-value table, one row a pair, the keys one column as
   wide as the longest, so no key reads as another value's. */
.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  max-width: var(--size-input-long);
  margin: 0;
  border: var(--border);
}

.facts__pair {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  min-width: 0;
}

.facts__pair + .facts__pair {
  border-top: var(--border-subtle);
}

/* The key's line centred on the value's first line. */
.facts dt {
  padding: calc(var(--space-2) + (var(--text-md-line) - var(--text-2xs-line)) / 2) var(--space-3)
    var(--space-2);
  background: var(--color-bg-raised);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-ligatures: none;
  color: var(--color-text-tertiary);
}

/* A key naming an item (a VM's disk): its name as typed, breaking as
   identifiers do. */
.facts dt.facts__item {
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
}

.facts dd {
  min-width: 0;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  color: var(--color-text-primary);
  overflow-wrap: break-word;
}

/* --breakpoint-md: each row its key over its value. */
@media (width < 48em) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts__pair {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
  }

  .facts dt,
  .facts dd {
    padding: 0;
    background: none;
  }
}

/* Item blocks: like items of a section (a repository's remotes), each
   framed, its name alone as its heading. */
.item-blocks {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.item-blocks[hidden] {
  display: none;
}

.item-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-4);
  border: var(--border);
}

.item-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.item-block__heading {
  min-width: 0;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: var(--text-lg-line);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.item-block__heading.mono {
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  font-variant-ligatures: none;
}

/* A missing value: none, in sans, also in a mono fact. */
.facts__none,
.mono .facts__none,
.mono.facts__none {
  font-family: var(--font-sans);
  color: var(--color-text-tertiary);
}

/* One of a fact's several values, each on a line of its own (the
   repositories in scope). */
.facts__line {
  display: block;
}

.facts__failure {
  color: var(--color-danger);
}

/* A count over a ghost small item disclosure of the first names it
   counts, one a line (a remote's tag conflicts). */
.names-disclosure,
.names-disclosure__list,
.names-disclosure__items {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}

.names-disclosure__list[hidden] {
  display: none;
}

.names-disclosure__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.names-disclosure__more {
  margin: 0;
  color: var(--color-text-tertiary);
}

/* The browser's `BRANCHES OF` and `BRANCH` selects, side by side while
   they fit. */
.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
}

.field-row > .field {
  flex: 0 1 var(--size-input-long);
}


.member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.member-chips:empty {
  display: none;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding-left: var(--space-2);
  border: var(--border-control);
  background: var(--color-bg-raised);
}

.table__actions {
  white-space: nowrap;
  text-align: right;
}

.page-body--banner {
  padding-bottom: 0;
}

.auth-panel__sentence {
  margin-bottom: var(--space-4);
}

.auth-panel__username {
  font-size: var(--text-md);
}

/* A standing fact about a tab: the page note's style, above its content. */
.tab-note {
  max-width: var(--measure);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

/* A section body under a tab note: the note's padding is the gap. */
.tab-note + .page-body.page-sections {
  padding-top: 0;
}

.page-description + .page-tabs {
  margin-top: var(--space-2);
}

.grants__preset .select select.input {
  min-width: var(--size-select-preset);
}

.grants .select--small select.input {
  min-height: var(--size-control-small);
}

.grants__block .select--small select.input {
  min-height: var(--size-control);
}

.grants__block-name .table__details,
.grants .table__stack .table__narrow-lg {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

/* Where an editor of few permission columns has the room (the
   instance's has not), the grantee's details line `set by <user> ·
   <time>` is one line: GRANTEE is at least as wide. */
/* --breakpoint-grants-details */
@container grants (width >= 56rem) {
  .grants--editor:not(.grants--wide) .table__stack .table__narrow-lg {
    white-space: nowrap;
  }
}

/* Providers and models pages */

.page-header--note {
  grid-template-areas:
    "title facts actions"
    "note note actions";
}

.page-header--note.page-header--breadcrumb {
  grid-template-areas:
    "crumb crumb actions"
    "title facts actions"
    "note note actions";
}

.page-header--note.page-header--breadcrumb.page-header--title-box {
  grid-template-areas:
    "crumb crumb crumb"
    "title facts actions"
    "note note actions";
}

/* An item's identifier (a repository's slug), its own line above the
   note. */
.page-header__identifier {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.page-header__note {
  grid-area: note;
  margin-top: var(--space-1);
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

.field__note--warning {
  color: var(--color-warning);
}

.key-state {
  font-family: var(--font-sans);
  white-space: normal;
}

.key-state__part {
  white-space: nowrap;
}

.key-state .badge {
  margin-right: var(--space-1);
}

/* A row action's outcome: the table's done note, one line under it
   (DESIGN.md "Data table", row result); empty, it takes no room but
   stays in the tree, so its status is announced. */
.row-result {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

.row-result:empty {
  margin: 0;
}

.row-result > .marker {
  flex: none;
  margin-top: calc((var(--size-line) - var(--size-marker)) / 2);
}

.row-result > .icon {
  flex: none;
  margin-top: calc((var(--size-line) - var(--size-icon)) / 2);
}

.row-result__text {
  min-width: 0;
  overflow-wrap: anywhere;
}


.row-result--failed {
  color: var(--color-warning);
}

.model-marker {
  margin-left: var(--space-2);
  color: var(--color-text-tertiary);
}

/* A form dialog taller than the viewport scrolls its fields; title,
   sentence and buttons stay. */
.dialog--form[open] {
  display: flex;
  flex-direction: column;
}

.dialog__form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dialog__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  overflow: hidden auto;
  scrollbar-gutter: stable;
  /* Room for a field's focus band, which the scrolling box clips. */
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
}

/* A create dialog's form and its reveal share one grid cell, so "Done"
   takes the action's place; each shown takes its own height, the reveal
   a new view the user asked for; the fields still scroll in a dialog
   taller than the viewport. */
.dialog__states {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  flex: 0 1 auto;
  min-height: 0;
}

.dialog__state {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.dialog__state--hidden {
  display: none;
}

/* The secret wraps whole into the dialog's width, so a phone shows it
   all without scrolling. */
.dialog__reveal .code-block__body {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.dialog__reveal-sentence {
  margin: var(--space-3) 0 0;
}

/* The reveal's code block ends where the fields would: the same gutter,
   padded by --space-1 for the focus band. */
.dialog--form .dialog__reveal {
  overflow: hidden;
  scrollbar-gutter: stable;
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
}

.input--cell {
  min-height: var(--size-control-small);
  font-size: var(--text-sm);
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  color: var(--color-text-primary);
}

.checkbox-field__text {
  flex: 1;
  min-width: 0;
}

.checkbox-field__details {
  display: block;
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-tertiary);
}

/* A field group's second control, --space-2 below the first: the
   field's gap and this. */
.defaults__models {
  margin-top: var(--space-1);
}

.defaults__save {
  min-width: min(var(--size-button-model-defaults), 100%);
  justify-content: center;
}

.file-versions {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
}

.file-version {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-top: var(--border);
}

.file-version__number {
  color: var(--color-text-primary);
}

.file-version__facts {
  color: var(--color-text-secondary);
}

.file-version__actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

.folder-tree {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
}

/* An entry of a folder's tree, indented by its depth in the tree. */
.folder-tree__entry {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0 var(--space-1) calc(var(--tree-depth, 0) * var(--space-3));
}

/* A header with a breadcrumb and a note (an identifier) keeps both
   rows at every width. */
/* --breakpoint-session-panes */
@container main (width < 48rem) {
  .page-header--note {
    grid-template-areas:
      "title actions"
      "facts facts"
      "note note";
  }

  .page-header--note.page-header--breadcrumb {
    grid-template-areas:
      "crumb actions"
      "title actions"
      "facts facts"
      "note note";
  }

  .page-header--note.page-header--breadcrumb.page-header--title-box {
    grid-template-areas:
      "crumb crumb"
      "title actions"
      "facts facts"
      "note note";
  }
}

/* --breakpoint-md */
@media (width < 48em) {
  .page-header--note {
    grid-template-areas:
      "title actions"
      "facts facts"
      "note note";
  }

  .page-header--note.page-header--breadcrumb,
  .page-header--note.page-header--breadcrumb.page-header--title-box {
    grid-template-areas:
      "crumb crumb"
      "title actions"
      "facts facts"
      "note note";
  }
}

.file-version__preview {
  flex-basis: 100%;
  min-width: 0;
}

/* The documents tab. */

/* The draft's status line, as wide as its widest text ("Unsaved
   changes"). */
.draft__status {
  min-width: min(var(--size-draft-status), 100%);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-text-tertiary);
}

.draft__text {
  min-height: calc(12 * var(--text-md-line));
  margin: var(--space-2) 0;
}

/* A block of the head revision: its first line's number, the marker
   counting the comments on its lines (its place always held) and the
   comment button in a gutter, the comments its marker opened under it.
   Comments others add only change the marker's count. */
.document-block {
  display: grid;
  grid-template-columns: min(var(--size-document-gutter), 100%) minmax(0, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.document-block__marker {
  min-width: calc(var(--size-control-small) + var(--size-count));
  justify-content: center;
}

.document-block__count {
  font-variant-numeric: tabular-nums;
}

.document-block__marker--new {
  color: var(--color-accent);
}

.document-block__gutter {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-1);
  min-width: 0;
}

.document-block__line {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--size-control-small);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-disabled);
  user-select: none;
}

.document-block__body {
  min-width: 0;
}

.document-comments {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--measure);
}

.document-comment {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-left: var(--border-width-strong) solid var(--color-accent);
  background: var(--color-bg-raised);
}

.document-comment--resolved {
  border-left-color: var(--color-line);
}

.document-comment__quote {
  margin: var(--space-1) 0 var(--space-2);
  padding-left: var(--space-3);
  border-left: var(--border-width-strong) solid var(--color-line-strong);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  overflow-wrap: break-word;
}

/* A proposal's change per paragraph. */
.proposed-file {
  margin-bottom: var(--space-5);
}

.proposed-file__path {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.paragraph-change {
  max-width: var(--measure);
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-left: var(--border-width-strong) solid var(--color-line);
}

.paragraph-change--added {
  border-left-color: var(--color-success);
  background: var(--color-success-dim);
}

.paragraph-change--removed {
  border-left-color: var(--color-danger);
  background: var(--color-danger-dim);
}

.paragraph-change__label {
  text-transform: uppercase;
}

.paragraph-change__label,
.paragraph-change__skip {
  margin: 0 0 var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
}

.paragraph-change__skip {
  margin: var(--space-2) 0;
}

.paragraph-change__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* The compact session header (design/pages/session.md "Compact
   header"): one row of the title, cut, the status marker and More;
   the breadcrumb and the facts are in More's head. After the narrow
   header rules, so it wins at every width. */
.page-header.page-header--compact {
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
  grid-template-areas: "title facts actions";
  align-items: center;
  column-gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
}

.page-header--compact > .page-header__breadcrumb {
  display: none;
}

.page-header--compact .page-header__actions {
  align-self: center;
}

.page-header--compact .page-header__more {
  display: block;
}

.page-header--compact .title-box--text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A status badge in its compact form: its marker alone, its place held
   while there is none. */
.badge-marker {
  display: inline-flex;
  align-items: center;
  min-width: var(--size-marker);
}

/* More's head: the header in full, wrapping, over the actions. */
.page-header__menu {
  width: min(var(--size-column), 100vw - 2 * var(--space-4));
  max-height: calc(var(--viewport-height, 100dvh) - var(--size-topbar) - 2 * var(--size-target-touch));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-header__menu-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
}

.page-header__menu-title {
  margin: 0;
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  overflow-wrap: anywhere;
}

.page-header__menu-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

/* DESIGN.md "Keyboard state": while the chat input or a VM's screen
   takes text from an on-screen keyboard, the header and the view tab
   row fold away and the stream or the screen keeps the room above the
   keyboard. */
.shell--keyboard .session:has(.chat .composer__text:focus, .live-area--screen .live-area__host :focus) > :is(.page-header, .session-views, .session-tabs) {
  display: none;
}

/* A touch screen, at every width: a control smaller than --size-target
   either way gets a hit area of --size-target, centred on it, from an
   ::after over it; its visible box keeps its size. */
@media (pointer: coarse) {
  :is(
      .switch__option,
      .checkbox-input,
      .radio,
      .audit-detail,
      .wordmark,
      .crumb,
      .table__sort,
      .principal__link,
      .table__inner-link,
      .jump-bar__link,
      .pane-header__tab,
      .link,
      a.mono,
      .artifact-name--toggle,
      td a:not(.row-link, .button)
    ) {
    position: relative;
  }

  :is(
      .switch__option,
      .checkbox-input,
      .radio,
      .audit-detail,
      .wordmark,
      .crumb,
      .table__sort,
      .principal__link,
      .table__inner-link,
      .jump-bar__link,
      .pane-header__tab,
      .link,
      a.mono,
      .artifact-name--toggle,
      td a:not(.row-link, .button)
    )::after {
    content: "";
    position: absolute;
    inset: min(0px, (100% - var(--size-target)) / 2) min(0px, (100% - var(--size-target)) / 2);
  }

  /* A grants block's row link covers its name cell, grown the same way:
     above the link's line, which tops the cell, and below a cell lower
     than --size-target. */
  .grants__block-name .row-link::after {
    inset: min(0px, (var(--size-line) - var(--size-target)) / 2) 0
      min(0px, (100% - var(--size-target)) / 2);
  }

  /* The most used controls are touch targets: nav items, menu items and
     tabs by their height, the header's More by its hit area. */
  .sidebar {
    --nav-item-height: var(--size-target-touch);
    --nav-session-height: var(--size-target-touch);
  }

  .menu__item {
    min-height: var(--size-target-touch);
  }

  .tabs :is(.tab, .tabs__more-trigger) {
    min-height: var(--size-target-touch);
  }

  /* The chat input's buttons (design/pages/composer.md "Touch"):
     --size-control high, at least --size-target-touch wide, their hit
     area --size-target-touch high; centred on the text's last line. */
  .composer :is(.composer__attach, .composer__action) .button {
    min-height: var(--size-control);
    min-width: var(--size-target-touch);
  }

  .composer :is(.composer__attach, .composer__action) .button::after {
    content: "";
    position: absolute;
    inset: min(0px, (100% - var(--size-target-touch)) / 2) 0;
  }

  .composer__attach,
  .composer__action {
    margin-bottom: calc((var(--composer-line) - var(--size-control)) / 2);
  }

  .page-header__more .button {
    position: relative;
  }

  .page-header__more .button::after {
    content: "";
    position: absolute;
    inset: min(0px, (100% - var(--size-target-touch)) / 2);
  }
}

/* DESIGN.md "Fields on a touch screen": no field's text under 16px,
   so a phone never zooms the page on focus. A title input keeps the
   title's size, which is larger, so its text stays on the static
   title's pixels. */
@media (pointer: coarse) {
  :is(
      input:not(
          [type="checkbox"],
          [type="radio"],
          [type="range"],
          [type="color"],
          [type="file"],
          [type="hidden"],
          [type="button"],
          [type="submit"],
          [type="reset"],
          [type="image"],
          .title-input__input
        ),
      textarea:not(.title-input__input),
      select
    ) {
    font-size: var(--text-field-touch);
    line-height: var(--text-lg-line);
  }

  .title-box {
    font-size: max(var(--text-xl), var(--text-field-touch));
  }

  .textarea {
    padding-block: calc((var(--size-control) - var(--text-lg-line)) / 2 - var(--border-width));
  }

  .textarea--grows {
    min-height: calc(4 * var(--text-lg-line) + var(--size-control) - var(--text-lg-line));
  }

  .composer {
    --composer-line: calc(var(--text-lg-line) + 2 * var(--space-1));
  }

  .composer__text {
    max-height: calc(8 * var(--text-lg-line) + 2 * var(--space-1));
  }
}

/* Forced colours: no supported mode, only what keeps state visible
   (DESIGN.md "Forced colours"). */
@media (forced-colors: active) {
  .checkbox-input:checked::before,
  .menu__item:not(.menu__item--checkbox)[aria-checked="true"] .menu__check,
  .menu__item--checkbox[aria-checked="true"] .menu__check::before {
    forced-color-adjust: none;
    background: Highlight;
  }

  /* Only the dot: the frame keeps the content box apart. */
  .radio:checked::before {
    forced-color-adjust: none;
    border-color: Highlight;
    background-color: Highlight;
  }

  .title-box--text {
    border-color: Canvas;
  }

  .read-only-square--checked::before {
    forced-color-adjust: none;
    background: CanvasText;
  }

  .nav-item,
  .tab,
  .tabs__more-trigger {
    border-color: Canvas;
  }

  /* A chosen level chip, whose fill forced colours drop. */
  .model-menu__level[aria-checked="true"] {
    border-color: Highlight;
    color: Highlight;
  }

  .nav-item[aria-current="page"],
  .nav-label--link[aria-current="page"],
  .tab[aria-selected="true"],
  .tab[aria-pressed="true"],
  .tab[aria-current="page"],
  .tabs__more--current .tabs__more-trigger,
  .tabs__item[aria-current] {
    border-color: Highlight;
  }

  /* As specific as each rule that colours a disabled control, which
     it follows, so it wins over them. */
  :disabled,
  [aria-disabled="true"],
  .button:disabled,
  .button[aria-disabled="true"],
  .button--ghost:disabled,
  .input:disabled,
  .textarea:disabled,
  .switch[aria-disabled="true"],
  .switch[aria-disabled="true"] .switch__option,
  .switch[aria-disabled="true"] .switch__option[aria-checked="true"],
  .checkbox-toggle--disabled,
  .checkbox-toggle--disabled:hover,
  .picker__option[aria-disabled="true"],
  .agent-jobs__toggle:disabled,
  .agent-timers__toggle:disabled {
    color: GrayText;
    border-color: GrayText;
  }
}

/* The session page: the new-session state of the session view, the
   agent tree, the model control, the SETTINGS tab and the workspace
   switcher. */

/* The title input: in the page's flow, a hidden copy of its text laid
   out as a shown title (at most two lines, and the rename button's slot
   where it takes a title's place); over it, the field, as wide, whose
   own hidden copy of the whole text gives it its height, so past two
   lines it grows down over the page. Its message overlays what is under
   the field. Neither the header nor the page moves. */
.title-input {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.title-box.title-input__holder {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  visibility: hidden;
}

.title-input__field {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--layer-overlay);
}

.title-input__fit {
  white-space: pre-wrap;
  visibility: hidden;
}

.title-input__message {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: var(--layer-overlay);
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-raised);
  border: var(--border);
}

/* DESIGN.md "Tooltips", tap reason: a disabled control's reason under
   it after a tap on a touch screen, in the top layer, placed from the
   control's rect; it moves nothing. */
.tap-reason {
  position: fixed;
  inset: auto;
  margin: 0;
  max-width: min(var(--size-column), calc(100vw - 2 * var(--space-4)));
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-raised);
  border: var(--border);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  overflow-wrap: break-word;
  z-index: var(--layer-overlay);
}

/* The title box: a title typed or shown, its text on the same pixels
   and lines in both, as the static one's transparent border takes the
   input's room; one line is --size-control high. A word wider than the
   box breaks anywhere. */
.title-box {
  display: block;
  min-width: 0;
  min-height: var(--size-control);
  margin: 0;
  padding: calc((var(--size-control) - var(--text-xl-line)) / 2 - var(--border-width)) var(--space-3);
  border: var(--border-width) solid transparent;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  line-height: var(--text-xl-line);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  overflow-wrap: anywhere;
}

/* A title box with a rename button, and the field in its place, keep
   the button's room at the end of every line, so both break alike. */
.title-box.title-box--pen {
  padding-inline-end: calc(var(--space-3) + var(--space-1) + var(--size-control-small));
}

/* As wide as its text up to the column, wrapping in the room its column
   leaves. A percentage maximum would not cap the grid column's size. */
.title-box--text {
  width: fit-content;
  max-width: var(--size-column);
}

.title-input__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  background: var(--color-bg-void);
  border: var(--border-control);
}

.title-input__input::placeholder {
  color: var(--color-text-tertiary);
}

.title-input__input:hover {
  border-color: var(--color-text-secondary);
}

.title-input__input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

/* Before the first message: the empty chat holds the choices that are
   fixed once the session runs, centred. */
.chat--new {
  min-height: 0;
}

.start-choices {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  overflow-y: auto;
}

.start-choices__section {
  width: min(var(--size-input-long), 100%);
}

.chat-input__start-message {
  margin-top: var(--space-2);
}

/* Menu parts: a mono label over a group, radio items with a check. */
.menu__label {
  padding: var(--space-1) var(--space-3);
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.menu__item--radio {
  gap: var(--space-2);
}

/* A one-of choice's mark: a diamond (DESIGN.md "Icons"). */
.menu__check {
  flex: none;
  width: var(--size-marker);
  height: var(--size-marker);
  rotate: 45deg;
}

/* A several-of choice's mark: the form checkbox's frame, empty while
   unticked, the accent square in it while ticked. */
.menu__item--checkbox .menu__check {
  display: grid;
  place-content: center;
  box-sizing: border-box;
  width: var(--size-icon);
  height: var(--size-icon);
  rotate: none;
  border: var(--border-control);
}

.menu__item--checkbox .menu__check::before {
  content: "";
  width: var(--size-marker);
  height: var(--size-marker);
}

.menu__item[aria-checked="true"] {
  background: var(--color-bg-selected);
  color: var(--color-text-primary);
}

.menu__item[aria-checked="true"] .menu__check {
  background: var(--color-accent);
}

.menu__item--checkbox[aria-checked="true"] .menu__check {
  background: none;
  border-color: var(--color-accent);
}

.menu__item--checkbox[aria-checked="true"] .menu__check::before {
  background: var(--color-accent);
}

.menu__item[aria-disabled="true"],
.menu__item[aria-disabled="true"]:hover {
  background: transparent;
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

/* The model control under the message box. */
.model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  margin-top: var(--space-2);
}

.model-button {
  gap: var(--space-2);
  text-transform: none;
  letter-spacing: normal;
  font-weight: var(--weight-regular);
}

.model-button__key {
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.model-button__name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.model-button__effort {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.model-row__failure {
  flex-basis: 100%;
  margin: 0;
}

/* The selected agent's context use over its meter, as wide as the text,
   together within the row's height. */
.model-row__context {
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-left: auto;
}

.model-row__context-use {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.model-menu {
  min-width: min(var(--size-column), 100%);
}

.model-menu__levels {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3) var(--space-2);
}

.model-menu__level {
  display: inline-block;
  align-content: center;
  min-height: var(--size-control-small);
  padding: 0 var(--space-3);
  border: var(--border-control);
  background: transparent;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  cursor: pointer;
}

.model-menu__level:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
}

.model-menu__level[aria-checked="true"] {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.model-menu__level[aria-disabled="true"] {
  border-color: var(--color-line);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.model-menu__level[aria-disabled="true"][aria-checked="true"] {
  background: transparent;
  color: var(--color-text-secondary);
}

.model-menu__none {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

.model-menu__details {
  flex-direction: column;
  align-items: flex-start;
  padding-block: var(--space-1);
}

/* A model the agent cannot switch to for a reason of its own: its
   diamond beside the name's line, the name over the reason. */
.model-menu__item--reason {
  align-items: flex-start;
  padding-block: var(--space-2);
}

.model-menu__item--reason .menu__check {
  margin-top: calc((var(--text-md-line) - var(--size-marker)) / 2);
}

.model-menu__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: start;
}

.model-menu__reason {
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  white-space: normal;
}

/* A model details field: its short input, then the slot of its reset,
   kept when empty so inputs never move. */
.model-detail {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.model-detail > .input {
  width: min(var(--size-input-short), 100%);
  min-width: 0;
}

.model-detail__reset {
  display: flex;
  flex: none;
  width: var(--size-control-small);
  min-height: var(--size-control-small);
}

.model-menu__hint {
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

/* The agent tree: each item indented by its depth, a toggle slot before
   it, a context bar under its name. */
.agent-item {
  padding-left: min(calc(var(--tree-depth, 0) * var(--space-4)), var(--size-tree-indent-max));
}

.agent-item__head {
  display: flex;
  align-items: flex-start;
}

.agent-item__toggle {
  flex: none;
  width: var(--size-control-small);
  min-height: var(--size-control-small);
  margin-top: var(--space-1);
}

.agent-item__head > .agent-item__link {
  flex: 1;
  min-width: 0;
  grid-template-columns: var(--size-marker) minmax(0, 1fr) auto;
  row-gap: var(--space-1);
  padding-left: var(--space-1);
}

.agent-item__end {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.agent-item__count {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-regular);
  color: var(--color-text-tertiary);
}

.agent-item__attention {
  display: inline-flex;
}

/* Context levels (design/pages/agents.md): an agent item's cost and
   attention mark, a meter's fill and the model row's context use. */
.context--warning :is(.agent-item__cost, .agent-item__attention),
.model-row__context-use.context--warning {
  color: var(--color-warning);
}

.context--danger :is(.agent-item__cost, .agent-item__attention),
.model-row__context-use.context--danger {
  color: var(--color-danger);
}

.agent-item__bar {
  grid-column: 2 / -1;
}

.context-meter__fill.context--warning {
  background: var(--color-warning);
}

.context-meter__fill.context--danger {
  background: var(--color-danger);
}

.agent-item > .agent-jobs,
.agent-item > .agent-timers {
  padding-left: var(--size-control-small);
}

/* A pane tab of a session not started yet. */
.tab--disabled,
.tab--disabled:hover {
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

/* The SETTINGS tab: a jump bar over its sections. */
.pane-settings {
  display: flex;
  flex-direction: column;
}

.jump-bar {
  position: sticky;
  top: 0;
  z-index: var(--layer-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-4);
  min-height: var(--size-control);
  padding: 0 var(--space-5);
  background: var(--color-bg-raised);
  border-bottom: var(--border);
}

.jump-bar__link {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.jump-bar__link:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.pane-settings__sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-5);
}

/* The running session's capabilities and caps: its sections, then its
   buttons, as one form. */
.pane-settings__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.pane-settings__sections .section-heading {
  scroll-margin-top: calc(var(--size-control) + var(--space-3));
}

/* The sidebar's one workspace: a switcher as its header. */
.workspace-switcher {
  margin-bottom: var(--space-3);
}

.workspace-switcher .menu-button {
  display: block;
}

.workspace-switcher__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  background: var(--color-bg-raised);
  border: var(--border-control);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}

.workspace-switcher__trigger:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
}

.workspace-menu {
  min-width: min(var(--size-sidebar) - 2 * var(--space-3), 100%);
  max-width: min(var(--size-column), 100vw - 2 * var(--space-4));
}

.nav-label--link {
  display: block;
  text-decoration: none;
}

.nav-label--link:hover {
  color: var(--color-accent);
}

/* The PROJECTS label on its tab: the active item (DESIGN.md "Navigation
   items"), its text where it stands; the band runs from the sidebar's
   edge, its line in the sidebar's padding, to the label's add button,
   as high as the label's row. */
.nav-label--link[aria-current="page"] {
  display: flex;
  flex: 1;
  align-items: center;
  align-self: stretch;
  margin-inline-start: calc(-1 * var(--space-3));
  padding-inline-start: calc(var(--space-3) - var(--border-width-strong));
  border-left: var(--border-width-strong) solid var(--color-accent);
  background: var(--color-bg-selected);
  color: var(--color-text-primary);
}

.nav-workspace__projects .nav-project {
  margin-left: 0;
}

.nav-workspace__projects .nav-item--session {
  margin-left: var(--size-control-small);
}

.nav-project__add {
  flex: none;
}

/* The selected agent's context use in its model details dialog. */
.dialog .agent-context {
  padding: 0;
}

.side-pane__tabs .tab,
.side-pane__tabs .tabs__more-trigger {
  padding: 0 var(--space-2);
}

/* An agent that never started a job shows no jobs row, so the tree
   stays one line per agent; its first job adds the row, and the main
   agent's first timer adds it with the timers row. */
.agent-item .agent-jobs:has(> .agent-jobs__toggle:disabled):not(:has(+ .agent-timers)) {
  display: none;
}


/* Capability rows: groups of one-line rows, each its box, its name and
   a phrase or its own control; the detail wraps whole under the name
   when there is no room beside it. */
.capability-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.capability-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.capability-group__label {
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.capability-group__note {
  display: block;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.capability-group__rows {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-top: var(--border-subtle);
}

.capability-row {
  display: grid;
  grid-template-columns: var(--size-icon) minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: start;
  min-height: var(--size-row);
  border-bottom: var(--border-subtle);
}

/* The box and the name each fill a row's height, so the box stays
   beside the name when the detail wraps under it. */
.capability-row__box {
  display: flex;
  align-items: center;
  min-height: var(--size-row);
}

/* The name keeps to the top, beside the box, however tall the detail;
   the detail centres on the name's line. */
.capability-row__main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: var(--space-3);
  min-width: 0;
}

.capability-row__name {
  flex: 0 0 min(var(--size-capability-name), 100%);
  min-width: 0;
  min-height: var(--size-row);
  padding-block: calc((var(--size-row) - var(--text-md-line)) / 2);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  color: var(--color-text-secondary);
}

.capability-row--held > .capability-row__main > .capability-row__name {
  color: var(--color-text-primary);
}

.capability-row--refused > .capability-row__main > .capability-row__name {
  color: var(--color-text-disabled);
}

label.capability-row__name,
.capability-row__name label {
  cursor: pointer;
}

/* A part of the row above, one box column in. */
.capability-row--sub > .capability-row__main {
  padding-inline-start: calc(var(--size-icon) + var(--space-3));
}

.capability-row--sub > .capability-row__main > .capability-row__name {
  flex-basis: min(var(--size-capability-name) - var(--size-icon) - var(--space-3), 100%);
  padding-block: calc((var(--size-row) - var(--text-sm-line)) / 2);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
}

/* A sub-row's own box sits in the name column of the row above. */
.capability-row--sub > .capability-row__main > .capability-row__name--boxed {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-basis: min(var(--size-capability-name), 100%);
  margin-inline-start: calc(-1 * (var(--size-icon) + var(--space-3)));
}

/* A repository sub-row: its name, then its marks, wrapping. */
.capability-row--repository > .capability-row__main > .capability-row__name--repository {
  overflow-wrap: anywhere;
}

.capability-row--repository > .capability-row__main > .capability-row__name--gone {
  color: var(--color-text-tertiary);
}

.capability-row__marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  min-width: 0;
}

.capability-row__name--wide {
  flex-basis: 100%;
}

.capability-row__detail {
  display: flex;
  align-self: center;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 var(--size-capability-detail);
  min-width: auto;
  padding-block: var(--space-1);
}

/* Controls never shrink: when they do not fit beside the name, the
   detail wraps under it. */
.capability-row__detail--controls {
  flex-wrap: wrap;
}

.capability-row__detail > .select {
  flex: none;
}

/* As wide as its widest option, which a percentage width would hide
   from the wrapping. */
.capability-row__detail .select select {
  width: auto;
}

.capability-row__phrase {
  display: block;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
  overflow-wrap: break-word;
}

/* Every state of a detail in one cell, the inactive ones hidden, so
   the row keeps the height of its tallest. */
.capability-row__states {
  display: grid;
  min-width: 0;
}

.capability-row__states > * {
  grid-area: 1 / 1;
}

.capability-row__state--off {
  visibility: hidden;
}

/* A row's phrase or reason over its warning. */
.capability-row__stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

/* A row's warning (DESIGN.md "Capability rows"): its applying and
   standing forms in one cell, with the longest applying wording the
   bounds allow, hidden, so the row never resizes. */
.capability-row__warning {
  display: grid;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

.capability-row__warning > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.capability-row__warning-state--applying {
  color: var(--color-warning);
}

/* An MCP server's name in its sub-row. */
.capability-row__server {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  overflow-wrap: anywhere;
}

.capability-row__server--gone {
  font-family: var(--font-sans);
  color: var(--color-text-tertiary);
}

.capability-row__phrase.mono {
  font-family: var(--font-mono);
}

.capability-row__tag {
  flex: none;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* A repository row's sub-rows, shown while it is held. */
.capability-subrows {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.capability-subrows[hidden] {
  display: none;
}

/* A row's message or help line, aligned with the sub-rows' names. */
.capability-row__note {
  padding: var(--space-1) 0 var(--space-1)
    calc(var(--size-icon) + var(--space-3) + var(--size-icon) + var(--space-3));
  border-bottom: var(--border-subtle);
}

.capability-row__note > .field__note {
  min-height: var(--text-xs-line);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
}

/* A ceiling's sentence of counts: its inputs in the line of text. */
.capability-ceiling__sentence .input {
  margin-block: var(--space-1);
  vertical-align: middle;
}

/* A detail's phrase or control, over the second set's line of what goes
   beyond the session. */
.capability-row__detail-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.capability-row__warning[hidden] {
  display: none;
}

/* The marker ending a second-set sub-row's name that holds more than
   the session (DESIGN.md "Capability rows", beyond this session). */
.capability-row__beyond {
  margin-inline-start: var(--space-2);
  color: var(--color-warning);
  white-space: normal;
}

/* "Sessions it starts may use": the second set after the session's
   last group, its heading and note, then its groups. */
.capability-starts {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  margin-top: calc(var(--space-6) - var(--space-4));
}

.capability-starts__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.capability-starts__intro > .group-heading,
.capability-starts__intro > .section-note {
  margin: 0;
}

/* The change dialog's changes of the second set follow under their
   label. */
.capability-rows--change {
  gap: var(--space-3);
}

/* The spending caps side by side, wrapping when the pane is narrow. */
.cap-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
}

.cap-fields > .field {
  flex: 1 1 var(--size-capability-detail);
  max-width: var(--size-input-short);
}

/* Questions (design/pages/questions.md: "Question tray", "Question card",
   "Question dialog"). */

/* The waiting mark: a question icon and its count in the accent. */
.waiting-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  font-variant-ligatures: none;
  white-space: nowrap;
}

.table .waiting-mark {
  margin-left: var(--space-2);
}

.nav-item--session .waiting-mark {
  margin-left: auto;
}

/* The dock between the stream and the chat input: empty, it takes no
   space; it holds the questions' status region from the first
   render. */
.question-dock {
  flex: none;
  min-width: 0;
}

.question-tray {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--chat-inset);
  background: var(--color-bg-raised);
  border-top: var(--border);
}


.question-tray__bar,
.question__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-height: var(--size-control-small);
}

.question-tray__lead {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-ligatures: none;
}

.question__id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  white-space: nowrap;
  font-variant-ligatures: none;
}

.question__agent {
  min-width: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  text-decoration: none;
  text-underline-offset: var(--underline-offset);
}

.question__agent:hover {
  text-decoration: underline;
}

.question__time,
.question__revision {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
  font-variant-ligatures: none;
  white-space: nowrap;
}

/* The pager and Minimise wrap whole, end-aligned. */
.question-tray__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.question__meta > .question__minimise {
  margin-left: auto;
}

.question-tray__position {
  min-width: var(--size-question-position);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  font-variant-ligatures: none;
  white-space: nowrap;
}

.question-tray__title,
.question__title {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  overflow-wrap: break-word;
}

.question-tray__title {
  font-size: var(--text-md);
  line-height: var(--text-md-line);
}

.question__title {
  font-size: var(--text-lg);
  line-height: var(--text-lg-line);
}

/* Focus targets of "Open in Questions" and of a closed question's
   successor, as the page title: no outline. */
.question-tray__title:focus,
.question__title:focus {
  outline: none;
}

/* The tray's content scrolls; its padding keeps the focus bands of
   its options and reply inside the clipping box. */
.question-tray__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: var(--size-question-tray-max);
  overflow-y: auto;
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
}

.question-tray__content > * {
  flex-shrink: 0;
}

.question-tray__preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  max-width: var(--measure);
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
  overflow-wrap: break-word;
}

.question-tray__facts {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.question__body {
  max-width: var(--measure);
}

/* The tray's options fieldset carries no field frame. */
.question__options {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question__recommended {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-accent);
  font-variant-ligatures: none;
}

.question__reply {
  min-width: 0;
  resize: none;
  overflow-y: auto;
  field-sizing: content;
}

/* 1 to 4 lines in the tray, 3 to 12 in the card. */
.question-tray .question__reply {
  max-height: calc(4 * var(--text-md-line) + var(--size-control) - var(--text-md-line));
}

.question .question__reply {
  min-height: calc(3 * var(--text-md-line) + var(--size-control) - var(--text-md-line));
  max-height: calc(12 * var(--text-md-line) + var(--size-control) - var(--text-md-line));
}

.question__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-2);
}

.question__form > .question__buttons {
  margin-top: var(--space-2);
}

/* Banners (error, CHANGED, CLOSED) go under the buttons, which so
   never move: --space-3 in the tray (its gap and this), the form's gap
   in a card. */
.question-tray > .banner {
  margin-top: var(--space-1);
}

/* The QUESTIONS tab: cards in a column. */
.question-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
}

.question {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  background: var(--color-bg-base);
  border: var(--border);
}

/* --size-pane */
@container side-pane (width < 30rem) {
  .question {
    padding: var(--space-3);
  }
}

.question__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.question__images {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.question__image {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  align-items: flex-start;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.question__image img {
  display: block;
  max-width: 100%;
  max-height: var(--size-image-max);
  object-fit: contain;
  background: var(--color-bg-void);
  border: var(--border);
}

.question__image-failed {
  display: grid;
  place-items: center;
  width: var(--size-thumb);
  height: var(--size-thumb);
  background: var(--color-bg-void);
  border: var(--border);
  color: var(--color-text-tertiary);
}

.question__image-name {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  font-variant-ligatures: none;
}

/* Read-only choices: a reader's options, an answer's picks. */
.question__choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.question__choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  color: var(--color-text-primary);
}

.question__choice > .checkbox-field__text {
  flex: 1;
  min-width: 0;
}

/* A choice mark: the frame of a radio (diamond) or checkbox (square)
   in the read-only line colour; held, the marker of its shape. */
.choice-mark {
  display: inline-grid;
  place-content: center;
  flex: none;
  width: var(--size-icon);
  height: var(--size-icon);
  margin-top: calc((var(--size-line) - var(--size-icon)) / 2);
  border: var(--border);
}

.choice-mark--one {
  border: 0;
}

.choice-mark--one::before {
  content: "";
  box-sizing: border-box;
  width: var(--size-radio);
  height: var(--size-radio);
  padding: calc((var(--size-radio) - 2 * var(--border-width) - var(--size-marker)) / 2);
  border: var(--border);
  background-clip: content-box;
  rotate: 45deg;
}

.choice-mark--held:not(.choice-mark--one)::before {
  content: "";
  width: var(--size-marker);
  height: var(--size-marker);
  background: var(--color-text-secondary);
}

.choice-mark--one.choice-mark--held::before {
  background-color: var(--color-text-secondary);
}

/* A question entry in the stream: its label, then the question link. */
.question-entry__line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
}

.question-entry__label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-text-tertiary);
  font-variant-ligatures: none;
}

.entry--question > .question__choices,
.entry--question > .entry__body {
  margin-top: var(--space-2);
}

/* A question link: a button in the Markdown viewer's link style. */
.question-link {
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: start;
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
  overflow-wrap: break-word;
  cursor: pointer;
}

.question-link__id {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.question-entry__line .question-link {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--text-md-line);
}

.question-dialog[open] {
  display: flex;
  flex-direction: column;
}

.question-dialog__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
  overflow: hidden auto;
  scrollbar-gutter: stable;
  /* Room for focus bands, which the scrolling box clips. */
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
}

.question-dialog__body > * {
  flex-shrink: 0;
}

@media (forced-colors: active) {
  .choice-mark--held:not(.choice-mark--one)::before,
  .choice-mark--one.choice-mark--held::before {
    forced-color-adjust: none;
    background-color: CanvasText;
  }
}

/* A removed account's name: sans, never mono; last, so it wins over
   the mono of the element it names. */
.removed-account {
  font-family: var(--font-sans);
  color: var(--color-text-tertiary);
}
