/* 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
  )
  > :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;
}

.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,
.advanced__count,
.vm-bar__text,
.vm-marker,
.live-bar__hint,
.agent-select-bar__label,
.agent-context__label,
.job-bar__label,
.audit-session__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 */

.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-flex;
  align-items: center;
  gap: var(--space-2);
  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;
}

.badge .marker {
  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--connection {
  min-width: var(--size-badge-connection);
}

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

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

.badge--placeholder {
  visibility: hidden;
}

/* A badge whose icon stands in for its marker. */
.badge--icon {
  gap: var(--space-1);
}

.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;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  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);
  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;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) linear,
    border-color var(--duration-fast) linear;
}

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

.chip[aria-pressed="true"] {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* The pressed chip's marker; laid out in every chip, so no chip's
   width changes with the choice. */
.chip .marker {
  visibility: hidden;
}

.chip[aria-pressed="true"] .marker {
  visibility: visible;
}

/* 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 {
  display: inline-flex;
  align-items: 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 */

.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: 100dvh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  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;
}

/* --breakpoint-md */
@media (width >= 48em) {
  .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;
  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;
}

.page-header__title {
  grid-area: title;
  outline: none;
  min-width: 0;
  font-size: var(--text-xl);
  line-height: var(--text-xl-line);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
}

.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);
}

.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;
}

/* A session's name and its rename button, centred on the name's first
   line. */
.session-title {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  min-width: 0;
}

.session-title__rename {
  flex: none;
  margin-block: calc((var(--size-control) - var(--size-control-small)) / 2);
}

/* 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);
}

.nav-item {
  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;
  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 slot is centred on the item's first line, which the item's
   --size-control of height centres. */
.nav-project__toggle,
.nav-project__spacer {
  margin-top: calc((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(--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: var(--size-sidebar);
  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,
.nav-item:focus-visible,
.nav-project__toggle:focus-visible,
.nav-project__add:focus-visible,
.side-pane__collapse:focus-visible,
.send-group .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 */

.tabs {
  display: flex;
  align-items: center;
  min-width: 0;
  border-bottom: var(--border);
}

.tab {
  flex: none;
  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 {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

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

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

.tabs__spacer {
  flex: 1;
}

/* Data tables */

.table-scroll {
  overflow-x: auto;
}

/* The outline inside the clipping area, as a tab stop while its table
   overflows. */
.table-scroll:focus-visible {
  outline-offset: var(--focus-offset-inset);
}

.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 {
  position: relative;
  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;
}

.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);
}

.table__action .button,
.table__detail button,
.table__inner-link,
.table--audit 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 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);
}

.audit-column--fifth {
  width: min(var(--size-sidebar), calc((100% - var(--size-column-datetime)) / 5));
}

/* 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));
}

/* 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 {
  font-family: var(--font-sans);
}

/* The global log's expanded row starts with the entry's session. */
.audit-session {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  margin-bottom: var(--space-3);
}

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

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

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

.actor--human {
  color: var(--color-human) !important;
}
.actor--agent {
  color: var(--color-accent) !important;
}
.actor--system {
  color: var(--color-text-secondary) !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 row stay above the label's row-wide ::after. The
   selects of a column share one width: their cell's, which the
   widest option sizes, at most a long control's. */
.choice .select {
  position: relative;
  z-index: var(--layer-row);
  display: flex;
  max-width: var(--size-input-long);
}

/* A select under a choice row's details, as its HANDS ON select. */
.choice__details ~ .select {
  margin-top: var(--space-2);
}

/* 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__paused {
  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);
}

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

.filter-bar__search {
  flex: 1;
  min-width: var(--size-sidebar);
  max-width: var(--measure);
  margin-left: auto;
}

/* 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;
}

/* 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: var(--size-input-short);
  max-width: 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;
}

.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);
}

.input:disabled,
.textarea:disabled {
  border-color: var(--color-line);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.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);
}

.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: var(--border-control);
  background: var(--color-bg-void);
  cursor: pointer;
}

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

.radio: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. */
.radio::before {
  content: "";
  width: var(--size-marker);
  height: var(--size-marker);
}

.radio:checked::before {
  background: var(--color-text-on-fill);
}

.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,
.chat > .banner,
.main > .page-body > .banner {
  margin: var(--space-3) var(--space-5) 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;
}

/* 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);
}

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

.dialog__title {
  font-size: var(--text-md);
  line-height: var(--text-md-line);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}

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

.dialog__name {
  font-family: var(--font-sans);
  color: var(--color-text-primary);
}

.dialog__name--mono {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.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);
}

/* 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;
}

.agent-select-bar__model {
  flex: 0 1 auto;
  min-width: 0;
  max-width: var(--size-sidebar);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

.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(var(--size-column), 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;
}

/* Agent list, chat and side pane; the pane's track takes its width up
   to --pane-width, 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 left border. */
.session__body {
  flex: 1;
  min-height: 0;
  display: grid;
  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-pane)) + var(--border-width))
      );
}

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

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

.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-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);
}

/* The agent select bar's context group, never breaking inside. */
.bar-context {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  white-space: nowrap;
}

.bar-context .context-meter {
  width: var(--size-meter);
}

/* 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 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(--space-5);
  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(--space-5);
  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;
}

/* --breakpoint-md: "Kill job" is icon-only. */
@media (width < 48em) {
  .job-output {
    padding: var(--space-3) var(--space-4);
  }

  .job-bar {
    padding: var(--space-3) var(--space-4);
  }

  .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;
}

/* 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;
}

/* 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;
  padding-right: var(--space-1);
}

.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 left border: a hit area of --space-2 either side of it. */
.side-pane__separator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * var(--space-2) - var(--border-width));
  width: calc(2 * var(--space-2) + var(--border-width));
  z-index: var(--layer-sticky);
  cursor: col-resize;
  touch-action: none;
}

.side-pane__separator::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--space-2) - var(--border-width) / 2);
  width: var(--border-width-strong);
  background: transparent;
}

.side-pane__separator:hover::before,
.side-pane__separator--dragging::before,
.side-pane__separator:focus-visible::before {
  background: var(--color-accent);
}

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

.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);
  font-size: var(--text-xs);
}

/* 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;
}

.popout .vm-pane {
  flex: 1;
}

/* 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;
}

.stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}

/* The lost connection's banner overlays the stream's top edge. */
.stream__banner {
  position: absolute;
  top: var(--space-3);
  right: var(--space-5);
  left: var(--space-5);
  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(--space-5));
  z-index: var(--layer-behind);
  pointer-events: none;
  background: transparent;
  transition: background-color var(--duration-fast) linear;
}

.entry--user::before {
  left: calc(-1 * var(--space-5) - 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--human {
  font-family: var(--font-mono);
  color: var(--color-human);
}

.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(--color-human);
  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 {
  color: var(--color-human);
}

.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);
  /* Columns: attach, text, abort, send group; the row is their
     subgrid, so the flag can take the text's column. */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  column-gap: var(--space-2);
  /* Its inline padding, which the activity scanner crosses. */
  --chat-input-inline: var(--space-5);
  padding: var(--space-3) var(--chat-input-inline);
  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(--space-5);
  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);
}

.chat-input > .attachment-tray {
  grid-column: 1 / -1;
}

/* The composer flag: over the stream, its bottom edge on the input's
   top edge, its sides the textarea's; it moves nothing. */
.chat-input__flag {
  position: absolute;
  grid-column: 2 / 3;
  bottom: calc(100% + var(--border-width));
  left: 0;
  right: 0;
  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-input-inline) - var(--space-8)));
  }
}

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

/* Agent select bar: the agent list below --breakpoint-lg. */
.agent-select-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-5);
  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%;
}

.agent-select-bar__facts {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  margin-left: auto;
}

.agent-select-bar__details {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.details-band {
  display: none;
  padding: var(--space-3) var(--space-5);
  background: var(--color-bg-raised);
  border-bottom: var(--border);
}

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

.chat-input__row {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: end;
}

.chat-input__attach {
  grid-column: 1;
}

.chat-input__text {
  grid-column: 2;
}

.chat-input__row > .button--abort {
  grid-column: 3;
}

.send-group {
  grid-column: 4;
  display: flex;
}

/* The delivery button joins Send, a base-coloured line between. */
.send-group .menu-button {
  display: flex;
}

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

.send-menu__item {
  flex-direction: column;
  align-items: flex-start;
  height: auto;
  min-height: var(--size-control);
  padding: var(--space-2) var(--space-3);
}

.send-menu__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);
  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: Send is icon-only and the input's padding small, so
   the text field keeps room and the row stays one line. */
/* --size-pane */
@container chat (width < 30rem) {
  .chat-input {
    --chat-input-inline: var(--space-3);
  }

  .read-only-note {
    padding-inline: var(--space-3);
  }

  .send-group__send {
    width: var(--size-control);
    padding: 0;
    justify-content: center;
  }

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

.chat-input__reference {
  font-family: var(--font-mono);
}

/* Reference completion: above the row, its left edge at the
   textarea's (after the attach button). */
.completion {
  position: absolute;
  bottom: calc(100% + var(--space-1));
  left: calc(var(--size-control) + var(--space-2));
  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__mono {
  font-family: var(--font-mono);
}

.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;
}

.chat-input__text {
  min-width: 0;
  resize: none;
  max-height: calc(8 * var(--text-md-line) + var(--size-control) - var(--text-md-line));
  overflow-y: auto;
}

/* 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);
}

.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;
}

.chat-input__attach {
  display: inline-flex;
}

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

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

.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(--color-human);
}

.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);
}

/* 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;
  }

  .session__body {
    grid-template-columns:
      minmax(min(var(--size-chat-min), 100% - var(--size-column)), 1fr)
      minmax(
        var(--size-column),
        calc(var(--pane-width, var(--size-pane)) + var(--border-width))
      );
  }

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

  .agent-list {
    display: none;
  }

  .agent-select-bar {
    display: flex;
  }

  .details-band:not([hidden]) {
    display: block;
  }
}

/* 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";
  }
}

/* --breakpoint-md */
@media (width < 48em) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 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;
  }

  .topbar__toggle {
    display: none;
  }

  .topbar__menu {
    display: inline-flex;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: var(--size-topbar);
    bottom: 0;
    left: 0;
    width: var(--size-sidebar);
    z-index: var(--layer-overlay);
  }

  .sidebar--open {
    display: flex;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: var(--size-topbar) 0 0 0;
    z-index: var(--layer-overlay);
    background: var(--color-scrim);
  }

  /* Lists keep their name, a time and the row action; the state and
     the other values stack in the name's cell. */
  .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__day--narrow {
    display: table-row;
  }

  .table--audit .audit-column--target {
    width: auto;
  }

  .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;
  }
}

/* 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;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .session-tabs .tab {
    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 {
    border-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-human);
}

.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;
}

.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);
}

/* 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 bar's session actions, after what the bar says, `--space-2` apart. */
.vm-bar__actions {
  display: flex;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

/* What a session holds on disk, below its VMs. */
.disk-parts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: var(--border);
}

/* The lists of the release dialog, each item on its own line. */
.release-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.release-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
}

.release-item__details {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.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, OS and "Pop out"
   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);
}

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

/* 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),
.shell-table td > :has(+ .vm-marker) {
  margin-right: var(--space-2);
}

.vm-table td > .vm-marker,
.shell-table td > .vm-marker {
  margin-left: 0;
}

/* A name breaks at its separators; a part wider than its column breaks
   inside, rather than run into the next column. */
.vm-table .breakable,
.shell-table .breakable {
  overflow-wrap: anywhere;
}

.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 */

.vm-pane {
  display: flex;
  flex-direction: column;
}

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

.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 or the focus hint, 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;
}

.live-bar__end {
  display: flex;
  align-items: center;
  gap: 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;
  }
}

.live-bar__hint {
  color: var(--color-accent);
}

.live-bar__hint:empty {
  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 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 area a VM's screen or a shell's terminal draws in, on the void,
   its host outlined, in the accent while it holds the keyboard; in a
   pop-out window edge to edge, outlined only then. */
.live-area {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: var(--space-4);
  background: var(--color-bg-void);
  --live-area-outline: var(--border);
}

.live-area--window {
  padding: 0;
  --live-area-outline: none;
}

.live-area--focused {
  --live-area-outline: var(--focus-band);
}

/* A terminal's area takes the focus back from it. */
.live-area:focus {
  outline: none;
}

.live-area:focus-visible {
  outline: var(--focus-band);
  outline-offset: var(--focus-offset-inset);
}

.live-area__host {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* The screen client outlines its picture. */
.live-area--screen .live-area__host {
  --vivarist-screen-background: var(--color-bg-void);
  --vivarist-screen-outline: var(--live-area-outline);
}

/* The canvas fills its box in one direction, which clips an outline
   outside it: draw the outline inside its edge. */
.live-area--screen .vivarist-screen-canvas {
  outline-offset: calc(-1 * var(--border-width));
}

.live-area--screen.live-area--focused .vivarist-screen-canvas {
  outline-offset: var(--focus-offset-inset);
}

/* A terminal is outlined around its box, inside the edge of a window;
   a terminal larger than a viewer's area scrolls. */
.live-area--terminal .live-area__host {
  overflow: auto;
  outline: var(--live-area-outline);
}

.live-area--terminal.live-area--window .live-area__host {
  outline-offset: var(--focus-offset-inset);
}

.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 the VM event log. */

/* 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,
.vm-pane > .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);
}

/* VM event log */

.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-vm th:nth-child(2) {
  width: var(--size-column-event-wide);
}

.table--events-vm 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);
}

/* Shells */

/* The list fits the pane's width: the time and state columns as wide
   as their widest values, the shell, VM and user sharing the rest,
   each breaking at its separators. Widths are set in the cells' fonts,
   on the table's columns. */
.shell-table {
  table-layout: fixed;
}

/* "59 min ago" and YYYY-MM-DD. */
.shell-table__time-column {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  width: var(--size-column-relative-time);
}

.shell-table__state-column {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  width: calc(var(--size-badge-shell) + 2 * var(--space-3));
}

.shell-table__time {
  white-space: nowrap;
}

.shell-table__user,
.shell-user,
.started-by {
  color: var(--color-human);
}

.pane-header__parent {
  min-width: 0;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.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.
   In the live area's top padding, never in flow. */
.terminal-closed__label {
  text-transform: uppercase;
}

.terminal-closed {
  position: absolute;
  top: 0;
  right: var(--space-4);
  left: var(--space-4);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--space-4);
  color: var(--color-text-tertiary);
  font-variant-ligatures: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 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;
}

.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);
}

.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);
}

.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);
}

.grants__own {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-secondary);
}

.grants__own .icon {
  color: var(--color-warning);
}

.grants__own:empty {
  display: none;
}

/* 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);
}

.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);
}

/* --breakpoint-md */
@media (width < 48em) {
  .grants__table {
    display: none;
  }

  .grants__blocks {
    display: block;
  }

  .add-bar__picker {
    flex-basis: 100%;
    max-width: none;
  }
}

/* The instance editor, by its own width: the full table from
   --breakpoint-lg; from --breakpoint-grants without SET BY and SET,
   whose values join the grantee's cell; narrower, blocks. Its
   permission headers wrap at spaces, so a column is as wide as its
   longest word. */
.grants--wide {
  container: grants / inline-size;
}

.grants--wide 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--wide .grants__preset .select select.input {
  width: auto;
  min-width: 0;
}

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

  .grants--wide .table__narrow-lg {
    display: block;
  }
}

/* --breakpoint-grants */
@container grants (width < 60rem) {
  .grants--wide .grants__table {
    display: none;
  }

  .grants--wide .grants__blocks {
    display: block;
  }
}

.through,
.through__item,
.access-value {
  white-space: nowrap;
}

/* One line: Chrome breaks at a <wbr> even under nowrap. */
.through wbr,
.access-value wbr {
  display: none;
}

.page-tabs {
  padding: 0 var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
}

.access-switch {
  padding: var(--space-3) var(--space-5);
  border-bottom: var(--border);
}

.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);
}

.permission-set {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

.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;
}

.inline-value {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  color: var(--color-text-primary);
}

.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);
}

.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;
}

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

.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);
}

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

.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;
}

.table__actions .button {
  position: relative;
  z-index: var(--layer-row);
}

.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) 0;
  font-size: var(--text-sm);
  line-height: var(--text-sm-line);
  color: var(--color-text-secondary);
}

.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);
}

/* Providers and models pages */

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

.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);
}

.model-marker {
  margin-left: var(--space-2);
}

/* The provider dialog's action keeps the width of "Save and clear
   key" in both its labels. */
.provider-dialog__action {
  min-width: var(--size-button-provider);
  justify-content: center;
}

/* 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-y: auto;
  /* 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 the
   dialog is as large as the larger from its first render and "Done"
   takes the action's place; 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 {
  visibility: hidden;
}

/* 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;
}

.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;
  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: var(--size-button-model-defaults);
  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));
}

/* --breakpoint-md */
@media (width < 48em) {
  .page-header--note {
    grid-template-areas:
      "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: var(--size-draft-status);
  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: var(--size-document-gutter) 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;
}

/* --breakpoint-md: 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 (width < 48em) {
  :is(
      .switch__option,
      .checkbox-input,
      .radio,
      .audit-detail,
      .wordmark,
      .crumb,
      .principal__link,
      .table__inner-link,
      td a:not(.row-link, .button)
    ) {
    position: relative;
  }

  :is(
      .switch__option,
      .checkbox-input,
      .radio,
      .audit-detail,
      .wordmark,
      .crumb,
      .principal__link,
      .table__inner-link,
      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);
  }
}

/* Forced colours: no supported mode, only what keeps state visible
   (DESIGN.md "Forced colours"). */
@media (forced-colors: active) {
  .checkbox-input:checked::before,
  .radio:checked::before,
  .chip[aria-pressed="true"] .marker {
    forced-color-adjust: none;
    background: Highlight;
  }

  .title-box--text {
    border-color: Canvas;
  }

  .read-only-square--checked::before {
    forced-color-adjust: none;
    background: CanvasText;
  }

  .nav-item,
  .tab {
    border-color: Canvas;
  }

  .nav-item[aria-current="page"],
  .tab[aria-selected="true"],
  .tab[aria-pressed="true"],
  .tab[aria-current="page"] {
    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 {
    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 new session's name in the title's place. */
/* The title input; its message overlays what is under it, so neither
   the header nor the page moves when it shows. */
.title-input {
  position: relative;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

/* A hidden copy of the input's text that gives the input its width. */
.title-input__fit {
  max-width: var(--size-column);
  overflow: hidden;
  white-space: pre;
  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);
}

/* The title box: a title typed or shown, its text on the same pixels in
   both, as the static one's transparent border takes the input's room. */
.title-box {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: var(--size-control);
  margin: 0;
  padding: 0 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);
}

.title-box__text {
  min-width: 0;
}

.title-box--text {
  max-width: var(--size-column);
}

.title-input__input {
  position: absolute;
  inset: 0;
  width: 100%;
  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__text--start {
  field-sizing: content;
}

.chat-input__start-message {
  grid-column: 1 / -1;
  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);
}

.menu__check {
  flex: none;
  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[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 {
  grid-column: 1 / -1;
  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;
}

.model-row__context {
  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: var(--size-column);
}

.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-flex;
  align-items: 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);
}

.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__warning {
  display: inline-flex;
  color: var(--color-warning);
}

.agent-item--attention .agent-item__cost {
  color: var(--color-warning);
}

.agent-item__bar {
  grid-column: 2 / -1;
}

.context-meter__fill--warning {
  background: var(--color-warning);
}

.agent-item > .agent-jobs {
  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);
}

/* A capability's HANDS ON select, under its details. */
.capability-table__hands-on {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.capability-table__hands-on-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.choice .capability-table__hands-on .select {
  width: var(--size-input-short);
}

/* 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));
}

.capability-list__value-column {
  width: calc(var(--size-capability-state) + 2 * var(--space-3));
}

.capability-list__name {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--color-text-primary);
}

.capability-list__value {
  vertical-align: top;
  padding-top: var(--space-2);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* 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: calc(var(--size-sidebar) - 2 * var(--space-3));
}

.nav-label--link {
  display: block;
  text-decoration: none;
}

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

.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;
  margin-top: calc((var(--size-control) - var(--size-control-small)) / 2);
}

/* The selected agent's context use in its model details dialog. */
.dialog .agent-context {
  padding: 0;
}

/* A pane tab of a session not started yet is a span, laid out as the
   link tabs. */
span.tab {
  display: inline-flex;
  align-items: center;
}

/* Five tabs fit the pane at its default width. */
/* Five tabs and the collapse button fit the pane's default width; a
   narrower pane or larger text scrolls the row sideways. */
.side-pane__tabs {
  overflow-x: auto;
  scrollbar-width: thin;
}

.side-pane__tabs .tab {
  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. */
.agent-item .agent-jobs:has(> .agent-jobs__toggle:disabled) {
  display: none;
}

/* A capability's state on its name's line. */
.capability-list td.capability-list__value {
  vertical-align: top;
  padding-top: var(--space-2);
  line-height: var(--text-md-line);
}
