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

:focus-visible {
  outline: var(--border-width-strong) solid var(--color-accent);
  outline-offset: var(--focus-offset);
}

[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(
    .compat-flag,
    .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,
.field__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-3);
}

/* 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 slot is always laid out; idle, its marker 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);
  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;
}

.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 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  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: a hidden busy marker
     has no text baseline. */
  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 {
  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%;
}

.button--icon {
  width: var(--size-control);
  padding: 0;
}

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

.button--primary {
  background: var(--color-accent);
  color: var(--color-text-on-fill);
}
.button--primary:hover,
.button--primary:active {
  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);
  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"],
.chip[aria-checked="true"] {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

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

.switch--small {
  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 outline goes round the whole frame. */
.switch__option:focus-visible {
  outline: none;
}

.switch:has(:focus-visible) {
  outline: var(--border-width-strong) solid var(--color-accent);
  outline-offset: var(--focus-offset);
}

.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;
  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(--border-width-strong) solid var(--color-accent);
  outline-offset: var(--focus-offset);
}

.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: var(--size-topbar) 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 (min-width: 768px) {
  .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);
}

.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;
  column-gap: 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: 0 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);
}

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

.menu__item:focus-visible {
  outline-offset: calc(-1 * var(--border-width-strong));
}

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

.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: 0 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(--border-width-strong) solid var(--color-accent);
  outline-offset: calc(-1 * var(--border-width-strong));
}

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

.table__name {
  padding-top: var(--space-1) !important;
  padding-bottom: var(--space-1) !important;
}

/* 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 (max-width: 1279.98px) {
  .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);
}

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

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

.table--audit td {
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  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);
}

.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 {
  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. */
.choice .select {
  position: relative;
  z-index: var(--layer-row);
}

.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: var(--space-2) 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);
}

.choice td {
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
}

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

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

.field__label {
  color: var(--color-text-secondary);
  padding: 0;
}

/* A short field: label above its control, as any field, until the
   field is wide enough to put the label beside it. */
.field--short {
  container-type: inline-size;
}

.field__layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

/* --breakpoint-field-short */
@container (min-width: 400px) {
  .field__layout {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--space-3);
    align-items: center;
  }

  .field__layout > .field__label {
    width: var(--size-field-label);
  }

  .field__layout > .input,
  .field__layout > .select select {
    width: var(--size-input-short);
  }

  .field__layout > .select {
    justify-self: start;
  }

  .field__layout > .field__note {
    grid-column: 2;
  }
}

.field__note {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  /* Its line is reserved, so a message never moves what follows. */
  min-height: var(--text-xs-line);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  color: var(--color-text-tertiary);
}

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

/* A field's help and its message in one grid cell (see "Stable
   layout"): the line is as tall as the taller, the one not shown hidden. */
.field__note--stacked {
  display: grid;
}

.field__note-state {
  display: flex;
  grid-area: 1 / 1;
  align-items: center;
  gap: var(--space-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);
}

.input:focus,
.textarea:focus {
  border-color: var(--color-accent);
}

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

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

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

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

.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 (max-width: 767.98px) {
  .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);
}

.auth-panel .button--ghost {
  margin-top: var(--space-2);
}

/* --breakpoint-md: dialogs and the auth panel --space-4 below the
   viewport's top. */
@media (max-width: 767.98px) {
  .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);
  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);
  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--subagent .agent-item__link {
  padding-left: calc(var(--space-3) + var(--space-4));
}

.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__line {
  grid-column: 2;
  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-2xs);
  line-height: var(--text-2xs-line);
  font-variant-ligatures: none;
}

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

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

.agent-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-2);
  padding: 0 var(--space-3) var(--space-2) calc(var(--space-3) + var(--size-marker));
}

.agent-item--subagent .agent-details,
.agent-item--subagent > .details-group {
  padding-left: calc(var(--space-3) + var(--space-4) + var(--size-marker));
}

.agent-item > .details-group {
  margin-top: 0;
  padding: 0 var(--space-3) var(--space-3) calc(var(--space-3) + var(--size-marker) + var(--space-2));
}

/* The selected agent's context use: three lines of fixed height 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-item--subagent .agent-context {
  padding-left: calc(var(--space-3) + var(--space-4) + 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;
}

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

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

/* "Change" after the reasoning effort, wrapping whole. */
.setting-change {
  margin-left: var(--space-2);
  vertical-align: middle;
}

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

.agent-item--subagent .agent-jobs__toggle {
  margin-left: calc(var(--space-3) + var(--space-4) + var(--size-marker));
}

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

.agent-item--subagent .job-row {
  padding-left: calc(
    var(--space-3) + var(--space-4) + var(--size-marker) + var(--space-2) -
      var(--border-width-strong)
  );
}

.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;
  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 (max-width: 767.98px) {
  .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;
  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 (max-width: 479.98px) {
  .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 {
  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;
  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);
}

.entry {
  position: relative;
  max-width: var(--measure);
}

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

.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;
  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 {
  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 {
  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 {
  height: var(--size-row-dense);
}

.reasoning__text {
  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%;
  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);
  padding: var(--space-3) var(--space-5);
  background: var(--color-bg-base);
  border-top: var(--border);
}

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

/* --breakpoint-md: Send is icon-only, so the row stays one line. */
@media (max-width: 767.98px) {
  .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);
  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);
  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 (max-width: 767.98px) {
  .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 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 (max-width: 767.98px) {
  .attachment,
  .attachment-chip {
    max-width: 100%;
  }

  .session-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .session-tabs .tab {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

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

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

.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 (max-width: 1279.98px) {
  /* 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;
  }
}

/* --breakpoint-md */
@media (max-width: 767.98px) {
  .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;
  }

  .session-tabs {
    display: flex;
    overflow-x: auto;
  }

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

  .user-menu__name {
    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: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.advanced__fields[hidden] {
  display: none;
}

.advanced__label {
  grid-column: 1 / -1;
  margin: 0;
}

.advanced__wide {
  grid-column: 1 / -1;
  min-width: 0;
}

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

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

/* --breakpoint-md */
@media (max-width: 767.98px) {
  .advanced__fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 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);
  height: var(--size-control);
  min-height: 0;
  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 (max-width: 767.98px) {
  /* 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(--border-width-strong) solid var(--color-accent);
}

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

.live-area:focus-visible {
  outline: var(--border-width-strong) solid var(--color-accent);
  outline-offset: calc(-1 * var(--border-width-strong));
}

.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: calc(-1 * var(--border-width-strong));
}

/* 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: calc(-1 * var(--border-width-strong));
}

.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-workspace__projects .nav-project {
  margin-left: var(--space-4);
}

.nav-workspace__projects .nav-item--session {
  margin-left: calc(2 * var(--space-4));
}

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

.grants__add > .picker {
  flex: 1 1 var(--size-column);
}

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

.grants__add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.grants__add-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

.grants__failure {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  flex-basis: 100%;
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--text-xs-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 {
  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 (max-width: 767.98px) {
  .grants__table {
    display: none;
  }

  .grants__blocks {
    display: block;
  }

  .grants__add .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 (max-width: 1279.98px) {
  .grants--wide .table__wide-lg {
    display: none;
  }

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

/* --breakpoint-grants */
@container grants (max-width: 959.98px) {
  .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);
}

.danger-section {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: var(--border);
  max-width: var(--size-form);
}

.settings-section {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: var(--border);
  max-width: var(--size-form);
}

.settings-section--first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.settings-section .sentence {
  margin-bottom: var(--space-3);
}

.danger-section .sentence {
  margin-bottom: var(--space-3);
}

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

.field--grants {
  max-width: none;
}

/* 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 {
  height: var(--size-control-small);
}

.grants__block .select--small select.input {
  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;
}

.dialog__section {
  margin: 0;
}

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

.advanced__fields--single {
  grid-template-columns: minmax(0, 1fr);
}

.input--cell {
  min-height: var(--size-control-small);
  height: var(--size-control-small);
  font-size: var(--text-sm);
}

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

.compat-flag {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

/* The text beside the box: it takes the width the box leaves and wraps
   there, never under the box. */
.compat-flag__text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: var(--space-1) var(--space-2);
}

.compat-flag__name {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: var(--text-2xs-line);
  color: var(--color-text-tertiary);
  overflow-wrap: anywhere;
}

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

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

.defaults__save {
  min-width: var(--size-button-model-defaults);
  justify-content: center;
}

.files-artifacts .files-upload {
  margin-bottom: var(--space-5);
}

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

.folder-tree__entry {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}

/* --breakpoint-md */
@media (max-width: 767.98px) {
  .page-header--note {
    grid-template-areas:
      "title actions"
      "facts facts"
      "note note";
  }
}

/* A budget tab: its month, then, after a border, its form. */
.budget-tab {
  max-width: calc(var(--size-form) + 2 * var(--space-5));
}

.budget-tab__form {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: var(--border);
}

.file-version__preview {
  flex-basis: 100%;
  min-width: 0;
}

/* The documents tab. */

/* A section label with a status text after it, as wide as the widest
   ("Unsaved changes"), so nothing moves as it changes. */
.draft__header,
.document-comments__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.draft__status {
  display: inline-block;
  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);
}

/* The line that shows comments others added to the list below; its
   place is held while there are none. */
.document-comments__new {
  min-height: var(--size-control-small);
  margin-bottom: var(--space-2);
}

.document-block__gutter {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-1);
  min-width: 0;
}

.document-block__line {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--size-control-small);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-disabled);
  user-select: none;
}

.document-block__body {
  min-width: 0;
}

.document-comments {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--measure);
}

.document-comment {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-left: var(--border-width-strong) solid var(--color-accent);
  background: var(--color-bg-raised);
}

.document-comment--resolved {
  border-left-color: var(--color-line);
}

.document-comment__quote {
  margin: var(--space-1) 0 var(--space-2);
  padding-left: var(--space-3);
  border-left: var(--border-width-strong) solid var(--color-line-strong);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  overflow-wrap: break-word;
}

/* A proposal's change per paragraph. */
.proposed-file {
  margin-bottom: var(--space-5);
}

.proposed-file__path {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.paragraph-change {
  max-width: var(--measure);
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-left: var(--border-width-strong) solid var(--color-line);
}

.paragraph-change--added {
  border-left-color: var(--color-success);
  background: var(--color-success-dim);
}

.paragraph-change--removed {
  border-left-color: var(--color-danger);
  background: var(--color-danger-dim);
}

.paragraph-change__label {
  text-transform: uppercase;
}

.paragraph-change__label,
.paragraph-change__skip {
  margin: 0 0 var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs-line);
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
}

.paragraph-change__skip {
  margin: var(--space-2) 0;
}

.paragraph-change__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* The new repository dialog's fields of each kind share one grid cell,
   so choosing the other kind moves nothing below. */
.dialog__kinds {
  display: grid;
}

.dialog__kind {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* --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 (max-width: 767.98px) {
  :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);
  }
}
