/* GENERATED by scripts/sync-composer-css.mjs from openclaw c074824a27 ui/src/styles/chat/{composer-surface.css,composer.css,composer-status.css,question-card.css,composer-queue.css}. Do not edit. */
/* ── components.css (shared controls, scoped to the question dock and the disabled banner) ── */
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn {
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  /* Labels never break mid-text; tight clusters wrap whole buttons instead
     (see .settings-row--actions). */
  white-space: nowrap;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn:hover:where(:not(:disabled, [aria-disabled="true"])) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn:active:where(:not(:disabled, [aria-disabled="true"])) {
  background: var(--secondary);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn.primary {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 3px var(--accent-subtle);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn.primary:hover:where(:not(:disabled, [aria-disabled="true"])) {
  background: var(--primary-hover);
  box-shadow: 0 2px 12px var(--accent-glow);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn.danger {
  border-color: transparent;
  background: var(--danger-subtle);
  color: var(--danger);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn.danger:hover:where(:not(:disabled, [aria-disabled="true"])) {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--sm {
  padding: 6px 10px;
  font-size: 12px;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--xs {
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--icon {
  padding: 8px;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--icon:hover:where(:not(:disabled, [aria-disabled="true"])) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--icon svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn--ghost:hover:where(:not(:disabled, [aria-disabled="true"])) {
  background: var(--bg-hover);
  color: var(--text);
  border-color: transparent;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .btn:is(:disabled, [aria-disabled="true"]) {
  opacity: 0.5;
  cursor: not-allowed;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) /* ===========================================
   Form Fields
   =========================================== */

.field {
  display: grid;
  gap: 6px;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field.full {
  grid-column: 1 / -1;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field input,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field textarea,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field select,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .input {
  border: 1px solid var(--input);
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 var(--card-highlight);
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field input:not([type="checkbox"]):not([type="radio"]),
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field select,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) input.input:not([type="checkbox"]):not([type="radio"]),
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) select.input {
  height: 38px;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field input:focus-visible,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field textarea:focus-visible,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field select:focus-visible,
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .input:focus-visible {
  border-color: var(--ring);
  box-shadow: var(--focus-ring);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field select {
  appearance: none;
  padding-right: 36px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position:
    right 18px center,
    right 14px center;
  background-size: 5px 5px;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field textarea {
  font-family: var(--mono);
  min-height: 160px;
  resize: vertical;
  white-space: pre;
  line-height: 1.5;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field input[aria-invalid="true"],
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field textarea[aria-invalid="true"],
:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field select[aria-invalid="true"] {
  border-color: var(--danger);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) /* ===========================================
   Utilities
   =========================================== */

.muted {
  color: var(--muted);
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .input-dialog__field {
  margin-top: 14px;
}

:where(.agent-chat__question-dock, .agent-chat__disabled-banner) .field textarea.agent-file-textarea {
  min-height: clamp(320px, 56vh, 720px);
}
/* ── composer-surface.css ── */
/* Keep size containment outside the flex surface: retained mobile panes can be
   measured at zero width, and containment there collapses the editor subtree. */
.agent-chat__composer-shell,
.chat-session-rail__composer {
  container-name: chat-composer;
  container-type: inline-size;
}

.agent-chat__composer-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 6px;
  /* The new-session page reuses this shell outside .chat, where the tokens are
     not defined; the fallbacks keep its geometry identical there. */
  width: calc(100% - var(--chat-composer-side-inset, 36px));
  max-width: var(--chat-thread-max-width, 48rem);
  margin: var(--chat-composer-top-margin, 8px) auto var(--chat-composer-bottom-gap, 14px);
}
.agent-chat__composer-notices {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
}
.agent-chat__composer-notices:not(:has(> *)) {
  display: none;
}

.chat-footer .agent-chat__composer-shell {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  max-height: calc(
    var(--chat-footer-max-height) - var(--chat-composer-top-margin) -
      var(--chat-composer-bottom-gap)
  );
}

/* Persistent context scrolls as one stack; the writing surface and menus stay outside. */
.chat-footer__context {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.chat-footer__context:not(
  :has(
    > :not(.agent-chat__composer-notices, openclaw-plugin-contributions),
    > .agent-chat__composer-notices > *,
    > openclaw-plugin-contributions > *
  )
) {
  display: none;
}

.chat-footer__context > * {
  flex-shrink: 0;
}

.chat-footer
  .chat-footer__context
  :is(
    .session-progress-card__body,
    .chat-queue__scroll,
    .agent-chat__goal-detail-objective,
    .chat-swarm__tasks,
    .chat-error__diagnostic
  ) {
  overscroll-behavior: auto;
}

:root[data-theme="light"] .session-progress-card--composer {
  border-color: var(--chat-composer-light-outline);
}

:root[data-theme="light"] :is(.chat-queue, .agent-chat__goal--active) {
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--chat-composer-light-outline);
}

.chat-footer > openclaw-plugin-view > .chat-footer__context {
  width: calc(100% - var(--chat-composer-side-inset));
  max-width: var(--chat-thread-max-width);
  margin: var(--chat-composer-top-margin) auto 0;
}

.chat-footer .agent-chat__composer-shell > :not(.chat-footer__context) {
  flex-shrink: 0;
}

/* One surface, no internal rules. Separation inside the composer is carried by
   luminance alone — a slightly lifted control/dropdown ground against the page
   canvas — so the frame never stacks a strong border, an inner divider and a
   heavy shadow on top of each other. Every foreground step below is a mix
   toward that same surface, which keeps the ramp correct in light themes too,
   where --text-strong is dark rather than near-white. */
.chat-footer,
.agent-chat__composer-shell,
.agent-chat__input {
  --chat-composer-radius: calc(20px * var(--openclaw-corner-radius-scale));
  --chat-composer-surface: var(--popover);
  --chat-composer-light-outline: rgb(0 0 0 / 6%);
  --composer-attached-surface: color-mix(
    in srgb,
    var(--chat-composer-surface) 60%,
    var(--background, var(--bg))
  );
  --chat-composer-hairline: color-mix(in srgb, var(--text-strong) 16%, transparent);
}

.agent-chat__input,
.agent-chat__disabled-banner.callout,
.agent-chat__composer-notices
  > :is(
    .chat-composer-neighbor-card,
    .agent-chat__composer-errors--standalone,
    .agent-chat__talk-status.callout
  ) {
  border-radius: var(--chat-composer-radius);
  corner-shape: var(--chat-composer-corner-shape);
}

.agent-chat__input {
  --chat-box-inset: 8px;
  /* Height of every control on the composer's input row. The row bottom-aligns
     so it can follow a growing textarea, which only reads as one axis while all
     its children share this box. */
  --chat-composer-control-height: 36px;
  --chat-composer-surface: var(--popover);
  --chat-composer-secondary: color-mix(
    in srgb,
    var(--text-strong) 65%,
    var(--chat-composer-surface)
  );
  --chat-composer-tertiary: color-mix(
    in srgb,
    var(--text-strong) 48%,
    var(--chat-composer-surface)
  );
  --chat-composer-hover: color-mix(in srgb, var(--text-strong) 8%, transparent);
  --chat-composer-group-hover: color-mix(in srgb, var(--text-strong) 6%, transparent);
  --chat-composer-popover-background: color-mix(in srgb, var(--bg-elevated) 96%, var(--card));
  --chat-composer-popover-border: var(--overlay-border);
  --chat-composer-popover-radius: calc(14px * var(--openclaw-corner-radius-scale));
  /* Footer control box. Smaller than the editor's own line box on purpose: the
     controls read as chrome beside the text, not as peers of it. */
  --chat-composer-control-size: 28px;
  --chat-composer-send-size: 32px;
  /* The labelled chips in the action row — model, reasoning, session mode — are
     one control family, so their box, type and rhythm live here instead of each
     chip restating its own. They are peers describing the next turn, and a
     reader should not be able to tell which feature shipped which one. Consumers
     outside the composer keep the same values as fallbacks; the mobile block
     raises the whole family to touch size by rewriting these four. */
  --chat-composer-chip-height: 30px;
  --chat-composer-chip-gap: 6px;
  --chat-composer-chip-padding-inline: 8px;
  --chat-composer-chip-text: var(--control-ui-text-md);
  --chat-composer-chip-icon: 16px;
  /* Menu-row family: every option row inside a composer popover (model, effort,
     permission, plus menu, attach, microphone) shares one box, icon size, and
     selected wash so the pickers read as one system rather than per-feature
     designs. Selected rows also carry a trailing accent check where the row is
     a single-select choice; binary rows carry a switch instead. */
  --chat-composer-menu-row-height: 40px;
  --chat-composer-menu-row-padding: 6px 9px;
  --chat-composer-menu-row-gap: 8px;
  --chat-composer-menu-row-radius: calc(10px * var(--openclaw-corner-radius-scale));
  --chat-composer-menu-icon: 16px;
  --chat-composer-menu-selected: var(--menu-selected);
  /* Breathing room between the draft and the surface it sits in. Small on
     purpose — it exists so the text never touches the frame, not to pad the
     composer out — and owned here so the editor's inset is one decision for
     every composer that uses this surface. The resting stature is unaffected:
     the surface's own floor is taller than the editor plus these insets. */
  --chat-composer-editor-inset-inline: 14px;
  --chat-composer-editor-inset-block: 6px;
  --chat-attachment-hit-slop: calc(var(--chat-composer-editor-inset-block) * 2);
  /* The editor is a reading and writing surface, not a compact form field, so it
     owns a 16px base instead of the shared control token, whose 14px base only
     reaches 16px through an iOS zoom floor — text that size by accident does not
     follow the operator's text scale until the scale passes 1.15, and it drops
     the moment that floor moves. The max() keeps 16px as a hard floor. */
  --chat-composer-editor-size: max(16px, calc(16px * var(--control-ui-text-scale)));
  /* One editor line. The single-line box centres a line of exactly this height,
     and the multiline editor never gets shorter than one of them. Derived, so a
     scaled-up editor keeps its leading instead of crowding its own descenders. */
  --chat-composer-editor-line: calc(var(--chat-composer-editor-size) * 1.5);

  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* The resting shape is two regions, not one line that may grow into two: the
     editor sits at the top and the action row is docked at the bottom from the
     first frame. This floor is what keeps that reading — an empty draft plus a
     row of 28px controls would otherwise settle into a bar too shallow to look
     like a writing surface, and the composer would appear to change kind the
     moment the first line wrapped. A surface may lower the floor without leaving
     the two-region shape — the session companion does, because it is a narrow
     side panel rather than the page's main writing area. */
  min-height: var(--chat-composer-min-height, 112px);
  margin: 0;
  padding: 0;
  /* The app owns the artwork; keep one translucent writing surface, not a
     second texture. Foreground/menu tokens retain their opaque surface color. */
  background: color-mix(in srgb, var(--chat-composer-surface) 78%, transparent);
  border: 1px solid var(--chat-composer-hairline);
  /* Deliberately lighter than --shadow-sm: with the border and the luminance
     step already doing the separating, a heavier drop reads as a second frame. */
  box-shadow: 0 4px 16px rgb(0 0 0 / 5%);
  flex-shrink: 0;
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

:root[data-theme="dark"] :is(.chat-footer, .agent-chat__composer-shell, .agent-chat__input) {
  --chat-composer-hairline: color-mix(in srgb, var(--text-strong) 9%, transparent);
}

/* Light surfaces get depth from translucent layers instead of a painted edge. */
:root[data-theme="light"] .agent-chat__input {
  border-color: transparent;
  box-shadow:
    0 0 0 1px var(--chat-composer-light-outline),
    0 1px 2px -1px var(--chat-composer-light-outline),
    0 2px 4px rgb(0 0 0 / 4%);
}

/* Focus is a neutral state, not an accent/status signal. Keep it within one
   subtle luminance step of the resting hairline; a second ring or outer spread
   would make the composer look thicker as soon as the operator starts typing. */
.agent-chat__input:has(.agent-chat__composer-combobox > :is(textarea, input):focus) {
  border-color: color-mix(in srgb, var(--chat-composer-hairline) 94%, var(--text-strong));
  box-shadow: 0 4px 16px rgb(0 0 0 / 5%);
}

:root[data-theme="light"]
  .agent-chat__input:has(.agent-chat__composer-combobox > :is(textarea, input):focus) {
  border-color: transparent;
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 8%),
    0 1px 2px -1px rgb(0 0 0 / 8%),
    0 2px 4px rgb(0 0 0 / 6%);
}

:root[data-theme="light"] .agent-chat__input--dictating,
:root[data-theme="light"] .agent-chat__input--dictating:focus-within {
  border-color: transparent;
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 6%),
    0 4px 18px rgb(0 0 0 / 6%);
}

.agent-chat__input--prefill-attention {
  animation: chat-composer-prefill-attention 600ms ease-out;
}

@keyframes chat-composer-prefill-attention {
  0%,
  20% {
    background: color-mix(in srgb, var(--accent) 14%, var(--card));
    border-color: color-mix(in srgb, var(--accent) 88%, var(--border));
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--accent) 32%, transparent),
      0 0 28px color-mix(in srgb, var(--accent) 42%, transparent);
  }
  100% {
    background: var(--card);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    box-shadow: 0 0 0 3px var(--accent-subtle);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat__input--prefill-attention {
    animation: none;
    background: color-mix(in srgb, var(--accent) 14%, var(--card));
    border-color: color-mix(in srgb, var(--accent) 88%, var(--border));
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--accent) 32%, transparent),
      0 0 28px color-mix(in srgb, var(--accent) 42%, transparent);
  }
}

.agent-chat__input--offline,
.agent-chat__input--offline:focus-within {
  z-index: 1;
}

@media (forced-colors: active), (prefers-contrast: more), (prefers-reduced-transparency: reduce) {
  .agent-chat__input {
    background: var(--chat-composer-surface);
  }
}

/* Everything docked above the editor. It must stay a flow box with nothing in it
   when there is nothing to show — no minimum height, no padding of its own — so
   an absent attachment or reply preview costs the surface no height at all. */
.agent-chat__composer-lede {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.agent-chat__composer-combobox {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.agent-chat__composer-combobox > :is(textarea, input) {
  --control-ui-touch-input-size: var(--chat-composer-editor-size);

  width: 100%;
  min-height: calc(var(--chat-composer-editor-line) + 8px);
  /* The editor grows upward against the viewport, not against a line count:
     past this the surface stops moving and the draft scrolls inside it. */
  max-height: min(
    25dvh,
    calc(var(--chat-composer-editor-line) * 6 + var(--chat-composer-editor-inset-block) * 2)
  );
  resize: none;
  padding-block: var(--chat-composer-editor-inset-block);
  /* The horizontal inset belongs to the row, so the text keeps one origin while
     the surface changes shape; the control adds none of its own. */
  padding-inline: 0;
  border: none;
  background: transparent;
  color: var(--text-strong);
  font-size: var(--chat-composer-editor-size);
  line-height: var(--chat-composer-editor-line);
  outline: none;
}

.agent-chat__composer-combobox > textarea {
  field-sizing: content;
}

.agent-chat__composer-combobox > textarea:is([data-scroll-fade-top], [data-scroll-fade-bottom]) {
  --chat-composer-scroll-mask-top: currentColor;
  --chat-composer-scroll-mask-bottom: currentColor;

  mask-image: linear-gradient(
    to bottom,
    var(--chat-composer-scroll-mask-top) 0,
    currentColor 16px,
    currentColor calc(100% - 16px),
    var(--chat-composer-scroll-mask-bottom) 100%
  );
}

.agent-chat__composer-combobox > textarea[data-scroll-fade-top] {
  --chat-composer-scroll-mask-top: transparent;
}

.agent-chat__composer-combobox > textarea[data-scroll-fade-bottom] {
  --chat-composer-scroll-mask-bottom: transparent;
}

.agent-chat__composer-combobox > :is(textarea, input):focus-visible {
  box-shadow: none;
}

/* Chromium forces native placeholders to clip while focused. Every composer
   renders a noneditable sibling that keeps the ellipsis while the native
   placeholder supplies semantics. A :has() probe for that sibling made each
   transcript insertion restyle the whole document. */
.agent-chat__composer-combobox > :is(textarea, input)::placeholder {
  color: transparent;
}

.agent-chat__composer-placeholder {
  display: none;
  position: absolute;
  inset: 0 0 auto;
  padding-block: var(--chat-composer-editor-inset-block);
  color: var(--muted);
  font-size: var(--chat-composer-editor-size);
  line-height: var(--chat-composer-editor-line);
  font-variant-ligatures: no-contextual;
  letter-spacing: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.agent-chat__composer-combobox > :placeholder-shown ~ .agent-chat__composer-placeholder {
  display: block;
}

/* Keep an empty editor one line tall; typed drafts retain normal wrapping. */
.agent-chat__composer-combobox > :is(textarea, input):placeholder-shown {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-chat__composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
  padding: var(--chat-composer-editor-inset-block) var(--chat-composer-editor-inset-inline) 0;
}

/* Two fixed sides keep turn access beside the add button while model, effort,
   context and action controls read together from the trailing edge. The slack
   belongs to that trailing track so its crowded descriptor group can shrink
   without pushing mic and send past the right edge. No top border — the surface
   separates by luminance, not by a rule across its own middle. `margin-top: auto`
   is what docks the row: the editor
   keeps the top of the surface and this row keeps the bottom, however tall the
   surface gets. */
.agent-chat__composer-footer {
  display: grid;
  /* Every track may shrink below its content: a crowded trailing group has to
     give way rather than push mic and send past the right edge. */
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  flex-shrink: 0;
  column-gap: 5px;
  min-height: var(--chat-composer-control-size);
  margin-top: auto;
  margin-bottom: 4px;
  padding-block: var(--chat-composer-editor-inset-block);
  padding-inline: 8px;
}

.agent-chat__composer-lead {
  display: flex;
  align-items: center;
  gap: 4px;
  grid-column: 1;
  min-width: 0;
}

.agent-chat__composer-footer svg {
  display: block;
}

.agent-chat__composer-trail {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  grid-column: 2;
  min-width: 0;
}

.agent-chat__composer-meta,
.agent-chat__composer-context {
  display: flex;
  align-items: center;
  gap: 4px;
  /* These icon groups must not shrink below their controls; model labels can. */
  flex: 0 0 auto;
  min-width: 0;
}

/* Keep settings, split view, and run status together in the footer's middle
   track. The track is sized to content, so this group shrinks before it ever
   pushes mic and send off the right edge. */
.agent-chat__composer-controls {
  display: flex;
  position: relative;
  align-items: center;
  gap: var(--chat-composer-chip-gap);
  min-width: 0;
}

.agent-chat__composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.agent-chat__input-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  flex-shrink: 0;
  padding: 0 10px;
  transition:
    color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}

/* Inside the composer the icon buttons are chrome on a shared surface: square
   28px boxes, no fill at rest, and a wash that is a step of the surface rather
   than a separate hover token. */
.agent-chat__input .agent-chat__input-btn {
  min-width: var(--chat-composer-control-size);
  width: var(--chat-composer-control-size);
  height: var(--chat-composer-control-size);
  padding: 0;
  border-radius: var(--radius-full);
  color: var(--chat-composer-secondary);
}

@media (hover: hover) and (pointer: fine) {
  .agent-chat__input .agent-chat__input-btn:hover:not(:disabled) {
    color: var(--text-strong);
    background: var(--chat-composer-hover);
  }
}

.agent-chat__input-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Icons draw at 16 regardless of the 20-unit viewBox some of them carry. */
.agent-chat__input :is(.agent-chat__input-btn, .chat-send-btn) svg {
  width: 16px;
  height: 16px;
}

.agent-chat__input .chat-send-btn--send > svg {
  width: 21px;
  height: 21px;
}

/* The plus turns into a close mark while its menu is open, instead of a second
   glyph swapping in: one shape rotating is what tells the operator the button
   they pressed is the same button that dismisses. `[open]` is reflected by the
   dropdown host, so every route out of the menu — reselect, outside click,
   Escape, item choice — unwinds it without any of them knowing about the icon.
   Both composers render this trigger through the same host, so one rule covers
   the transcript and the new-session page.
   Counter-clockwise: the menu opens upward off this button, so the glyph turns
   back against that travel and unwinds forward into it on close. */
.agent-chat__attach-menu .agent-chat__input-btn--attach svg {
  width: 22px;
  height: 22px;
  transform-origin: center;
  transition: transform 165ms ease;
}

.agent-chat__input-btn--attach {
  position: relative;
}

.agent-chat__input-btn--has-overrides::after {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border: 1px solid var(--chat-composer-surface);
  border-radius: var(--radius-full);
  background: var(--danger);
  content: "";
  pointer-events: none;
}

.agent-chat__attach-menu[open] .agent-chat__input-btn--attach svg {
  transform: rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat__attach-menu .agent-chat__input-btn--attach svg {
    transition: none;
  }
}

.agent-chat__control-label {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .agent-chat__input-btn:hover:not(:disabled) {
    color: var(--text);
    background: var(--bg-hover);
  }
}

.agent-chat__input-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.agent-chat__attach-menu {
  display: flex;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

.agent-chat__attach-menu > button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.agent-chat__attach-menu[open] > button {
  color: var(--text);
  background: var(--bg-hover);
}

/* Send is the primary action of the whole surface, so it gets the same solid
   accent treatment as .btn.primary; variants (--stop, --voice*) override the
   fill instead of reintroducing borders. */
.chat-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 3px var(--accent-subtle);
  flex-shrink: 0;
  transition:
    background var(--duration-fast) ease,
    color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    opacity var(--duration-fast) ease;
  padding: 0;
}

@media (max-width: 900px) {
  .agent-chat__input-btn {
    width: 36px;
    min-width: 36px;
    padding: 0;
  }

  .agent-chat__control-label {
    display: none;
  }
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Capture variants below own their hover fill independently of the primary action. */
.chat-send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* Outline (not box-shadow) so the hover rules' higher-specificity box-shadow
   overrides can never swallow the keyboard focus indicator. */
.chat-send-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Muted fill (not a ghost outline) while there is nothing to send, so the
   accent fill itself signals "ready". */
.chat-send-btn:disabled {
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  color: var(--muted);
  box-shadow: none;
  opacity: 0.8;
  cursor: not-allowed;
}

/* Send is the one committed action on the surface, so it carries the brand fill.
   Everything else on the composer is a step of the surface itself, which makes
   colour — not just contrast — the thing that marks the button that actually
   sends. Losing availability drops it back to a step of the surface: an
   unavailable send must not keep shouting in brand red. */
.agent-chat__input .chat-send-btn {
  width: var(--chat-composer-send-size);
  min-width: var(--chat-composer-send-size);
  height: var(--chat-composer-send-size);
  padding: 5px;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: none;
}

/* Hover steps the fill toward the surface's own far end rather than reaching for
   --primary-hover, which several themes leave at the base value and would render
   as no feedback at all. */
.agent-chat__input .chat-send-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 86%, var(--text-strong));
  box-shadow: none;
}

.agent-chat__input .chat-send-btn:disabled {
  background: var(--chat-composer-hover);
  color: var(--chat-composer-tertiary);
  opacity: 1;
}

/* Running returns the primary slot to the established soft-danger Stop state:
   a quiet red ground and red square distinguish interruption from Send without
   turning the control into a high-contrast white disc. */
.agent-chat__input .chat-send-btn--stop {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.agent-chat__input .chat-send-btn--stop:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
}

/* Voice keeps the quiet chrome treatment: it is a mode toggle beside send, not
   a second primary action. */
.agent-chat__input .chat-send-btn--voice {
  background: transparent;
  color: var(--text);
}

.agent-chat__input .chat-send-btn--voice:disabled {
  background: transparent;
}

.agent-chat__input .chat-send-btn--voice:hover:not(:disabled) {
  background: var(--chat-composer-hover);
  color: var(--text-strong);
}

/* Idle voice fill stays muted so the idle -> hover -> recording progression
   escalates without turning the microphone into a second primary action. */
.chat-send-btn--voice {
  background: var(--chat-voice-background, color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--chat-voice-color, var(--accent));
  box-shadow: none;
}

.chat-talk-control:not(.chat-talk-control--active) .chat-send-btn--voice:disabled {
  opacity: 0.4;
}

.chat-send-btn--voice:hover:not(:disabled) {
  background: var(
    --chat-voice-hover-background,
    color-mix(in srgb, var(--accent) 18%, transparent)
  );
  color: var(--chat-voice-hover-color, var(--accent));
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .agent-chat__input .chat-talk-control:hover:not(:has(.chat-send-btn:disabled)) {
    background: var(--chat-composer-group-hover);
  }
}

.agent-chat__input .chat-talk-control .chat-send-btn--voice:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text-strong) 7%, transparent);
}

.chat-mobile-dictation-action,
.chat-mobile-talk-action,
.chat-mobile-primary-action {
  display: none;
}

.chat-desktop-primary-action {
  display: contents;
}

/* Soft danger fill so Stop generating reads as the one destructive control
   next to the accent-filled send button. */
.chat-send-btn--stop {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  box-shadow: none;
}

.chat-send-btn--stop svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}

.chat-send-btn--stop:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: color-mix(in srgb, var(--danger) 82%, var(--text-strong));
  box-shadow: none;
}

/* Keep capture variants after the shared button rules across lazy entry points. */
/* Capture button while dictating. Same element as the idle mic — swapping it
   would release pointer capture mid-hold — so the mode only restyles it. Once
   latched, this square is the explicit discard half of the action pair. */
.chat-send-btn.chat-send-btn--dictating {
  width: var(--chat-composer-send-size);
  min-width: var(--chat-composer-send-size);
  height: var(--chat-composer-send-size);
  padding: 5px;
  border-radius: var(--radius-full);
  color: var(--text-strong);
  background: color-mix(in srgb, var(--text) 10%, transparent);
  box-shadow: none;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.agent-chat__input .chat-send-btn.chat-send-btn--dictating:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 16%, transparent);
  color: var(--text-strong);
}

.chat-send-btn--dictating > svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}

/* Live voice input: the level meter itself is the control. It stays unframed
   inside the composer; the waveform is enough state, and hover reveals stop. */
.chat-send-btn.chat-send-btn--voice-live {
  position: relative;
  width: auto;
  min-width: 64px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.chat-send-btn.chat-send-btn--voice-live:hover:not(:disabled) {
  background: var(--chat-composer-hover);
  box-shadow: none;
}

.chat-send-btn--voice-live .agent-chat__voice-activity {
  transition: opacity var(--duration-fast) ease;
}

.chat-send-btn--voice-live:hover:not(:disabled) .agent-chat__voice-activity,
.chat-send-btn--voice-live:focus-visible .agent-chat__voice-activity {
  opacity: 0.25;
}

.chat-send-btn__voice-stop-glyph {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.chat-send-btn--voice-live .chat-send-btn__voice-stop-glyph svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: none;
}

.chat-send-btn--voice-live:hover:not(:disabled) .chat-send-btn__voice-stop-glyph,
.chat-send-btn--voice-live:focus-visible .chat-send-btn__voice-stop-glyph {
  opacity: 1;
}

/* Errored Talk session: the meter is gone, so the stop glyph stays visible;
   the alert row above owns the error message. */
.chat-send-btn.chat-send-btn--voice-error .chat-send-btn__voice-stop-glyph {
  opacity: 1;
}

@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .agent-chat__input {
    --chat-box-inset: 4px;
    --chat-composer-control-height: 44px;
    /* Touch targets, not chrome: the composer's own control rules all read this
       token, so raising it here resizes every button on the surface at once. */
    --chat-composer-control-size: 44px;
    --chat-composer-send-size: 32px;
    /* The labelled chips follow, as one family: raising the family tokens keeps
       the session-mode chip the same size as the pickers it sits beside instead
       of leaving a 24px chip stranded against 44px neighbours. */
    --chat-composer-chip-height: 44px;
    --chat-composer-chip-gap: 4px;
    --chat-composer-chip-padding-inline: 4px;
    /* Narrow viewports spend their width on the draft, so the editor keeps the
       tighter side inset here; the block inset stays, because that is the one
       that keeps text off the frame rather than off the screen edge. */
    --chat-composer-editor-inset-inline: 12px;
  }

  .agent-chat__composer-input-row {
    gap: 0;
  }

  .agent-chat__composer-combobox {
    align-self: stretch;
  }

  .agent-chat__composer-combobox > :is(textarea, input, .agent-chat__composer-placeholder) {
    flex: 1 1 auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  /* Touch controls already carry their own 44px of height, so the footer keeps
     only an optical inset around them instead of the desktop breathing room. */
  .agent-chat__composer-footer {
    margin-bottom: calc(var(--chat-box-inset) / 2);
    padding-block: calc(var(--chat-box-inset) / 2) 0;
    padding-inline: var(--chat-box-inset);
  }

  .agent-chat__composer-meta,
  .agent-chat__composer-context {
    margin-left: 0;
  }

  /* `interactive-widget=resizes-content` already keeps the composer above the
     virtual keyboard. Focus alone also covers hardware keyboards and tests, so
     it must not collapse the normal bottom breathing room. */
  .agent-chat__composer-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

@media (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .agent-chat__input {
    max-height: min(36vh, 164px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .agent-chat__input:has(.chat-attachments-preview) {
    /* The rail's top overhang must also clear this outer scrollport. */
    padding-block-start: var(--chat-attachment-hit-slop);
  }

  .agent-chat__input:has(.agent-chat__attach-menu[open]) {
    overflow: visible;
  }

  .agent-chat__composer-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: var(--chat-composer-surface);
  }

  .agent-chat__composer-combobox > :is(textarea, input) {
    min-height: 48px;
    max-height: 56px;
    overflow-y: auto;
  }
}

.agent-chat__input [data-chat-pointer-restored-focus]:focus-visible {
  outline: none;
  box-shadow: none;
}

.agent-chat__input
  wa-dropdown[data-chat-pointer-opened-picker]
  wa-dropdown-item:is(:focus, :focus-visible) {
  outline: none;
}

.chat-thread-inner {
  /* Shared gutter plus the responsive side inset that used to be
     .chat-thread's horizontal padding (moved off the scroll container so
     overlay scrollbars sit flush at the pane edge). */
  width: calc(100% - 2 * var(--chat-thread-gutter) - 2 * var(--chat-thread-side-inset));
  max-width: var(--chat-thread-max-width);
  margin-inline: auto;
  /* Commit width with the virtual rows, even under the global reduced-motion
     duration; gutter and row measurements must not sample a transition. */
  transition-property: none;
}

@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .agent-chat__input-btn,
  .chat-send-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  /* Keep the live voice pill wide enough for its 7-bar meter; the generic
     44px square above would crush it at phone widths. */
  .chat-send-btn.chat-send-btn--voice-live {
    width: auto;
    min-width: 64px;
  }

  /* New Session can load composer styles before the chat layout defaults. */
  .chat-thread-inner,
  .agent-chat__composer-shell,
  .chat-footer > openclaw-plugin-view > .chat-footer__context {
    /* Physical insets belong to the app; every route centers inside that
       usable canvas, including when its reading-width cap takes effect. */
    position: relative;
    width: calc(100% - 2 * var(--chat-mobile-edge-inset));
    margin-inline: auto;
  }

  .agent-chat__composer-shell {
    --chat-composer-bottom-gap: 6px;

    margin-block: var(--chat-composer-top-margin, 0px) var(--chat-composer-bottom-gap);
    gap: 6px;
  }

  .agent-chat__composer-footer {
    column-gap: 3px;
    min-height: 44px;
  }
}

/* The minimum footer is reserved for genuinely phone-narrow owners. Wider
   embedded composers keep the regular grouping instead of shedding labels and
   stretching the model control long before the row is under pressure. */
@container chat-composer (max-width: 480px) {
  .agent-chat__input--mobile-toolbar .agent-chat__composer-controls {
    flex: 1 1 0;
    min-width: 0;
    order: 3;
  }
  .agent-chat__composer-footer {
    --chat-composer-chip-icon: 16px;
    margin-bottom: 0;
    padding-block: 4px;
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-footer {
    display: flex;
    gap: 2px;
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-lead {
    flex: 0 0 auto;
    gap: 2px;
    order: 1;
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-trail {
    display: contents;
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-meta {
    flex: 0 0 auto;
    order: 2;
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-actions {
    flex: 0 0 auto;
    gap: 8px;
    order: 4;
  }
}

/* ClawChats: a phone-width composer has no room for the model's name ("✳ C."): the provider icon alone, the
   name in the trigger's aria-label and hint. A model without an icon (not in the catalog) keeps its name.
   A viewport query: ClawChats' composer has no .agent-chat__composer-shell, so chat-composer container
   queries don't apply here. */
@media (max-width: 420px) {
  .chat-controls__model-trigger:has(.chat-controls__trigger-provider-slot:not(:empty)) .chat-controls__inline-select-label {
    display: none;
  }
}

/* Density follows the composer, including narrow split panes in wider windows.
   Plus and Send retain their targets while model and effort remain separate. */
@container chat-composer (max-width: 560px) {
  .agent-chat__input--mobile-toolbar .agent-chat__composer-controls {
    flex: 1 1 0;
    min-width: 0;
    margin-inline-start: auto;
    overflow: visible;
  }
  .agent-chat__input--mobile-toolbar {
    --chat-composer-min-height: 105px;
    --chat-mobile-row-target-size: 32px;
    --chat-mobile-row-icon-size: 20px;
    --chat-mobile-row-icon-stroke: 2;
    --chat-mobile-row-icon-padding: 0px;
    --chat-mobile-row-muted-icon-size: 18px;
    --chat-mobile-row-context-icon-size: 16px;
    --chat-mobile-row-muted-opacity: 0.55;
    --chat-mobile-row-permission-stroke: 2.25;
    --chat-mobile-row-plus-target-size: 36px;
    --chat-mobile-row-plus-icon-size: 24px;
    --chat-mobile-row-chevron-size: 14px;
    --chat-mobile-row-chip-gap: 2px;
    --chat-mobile-row-chip-padding-inline: 6px;
    --chat-mobile-row-action-padding: var(--chat-mobile-row-icon-padding);
    --chat-mobile-row-action-gap: 4px;
    --chat-mobile-row-stop-icon-size: 18px;
    --chat-mobile-row-mic-opacity: 0.72;
    --chat-mobile-row-mic-stroke: 2;
    --chat-composer-control-size: var(--chat-mobile-row-target-size);
    --chat-composer-chip-height: var(--chat-mobile-row-target-size);
    --chat-composer-chip-gap: var(--chat-mobile-row-chip-gap);
    --chat-composer-chip-padding-inline: var(--chat-mobile-row-chip-padding-inline);
    --chat-composer-footer-icon-size: var(--chat-mobile-row-icon-size);
    --chat-composer-menu-icon: var(--chat-mobile-row-icon-size);
    --chat-composer-send-size: var(--chat-mobile-row-plus-target-size);
  }

  .agent-chat__input--mobile-toolbar svg {
    width: var(--chat-mobile-row-icon-size);
    height: var(--chat-mobile-row-icon-size);
    stroke-width: var(--chat-mobile-row-icon-stroke);
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-footer {
    justify-content: space-between;
    gap: 0;
    min-height: var(--chat-mobile-row-target-size);
    margin-bottom: 0;
  }

  .agent-chat__input--mobile-toolbar
    :is(.agent-chat__composer-lead, .agent-chat__composer-actions) {
    gap: 0;
  }

  .agent-chat__input--mobile-toolbar .agent-chat__input-btn--attach {
    width: var(--chat-mobile-row-plus-target-size);
    min-width: var(--chat-mobile-row-plus-target-size);
    height: var(--chat-mobile-row-plus-target-size);
    padding: var(--chat-mobile-row-icon-padding);
  }

  .agent-chat__input--mobile-toolbar
    .agent-chat__attach-menu[open]
    .agent-chat__input-btn--attach
    svg {
    transform: rotate(-45deg);
  }

  .agent-chat__input--mobile-toolbar .context-ring,
  .agent-chat__input--mobile-toolbar .chat-controls__permission-trigger,
  .agent-chat__input--mobile-toolbar .chat-send-btn--voice {
    width: var(--chat-composer-control-size);
    min-width: var(--chat-composer-control-size);
    height: var(--chat-mobile-row-target-size);
    border-radius: var(--radius-full);
  }

  /* Mobile icon controls own a real 32px target; Plus uses its explicit 36px
     role token. Adjacent controls never compete for one tap. */
  .agent-chat__input--mobile-toolbar
    :is(
      .agent-chat__input-btn--attach,
      .chat-controls__permission-trigger,
      .context-ring,
      .chat-controls__model-trigger,
      .chat-controls__effort-trigger,
      .chat-send-btn--voice,
      .chat-send-btn--stop,
      .chat-send-btn--send,
      .chat-send-btn--talk-mode
    ) {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Row icons share one optical tier; role tokens below express the deliberate
     exceptions for Plus, quiet state indicators, and Mic. */
  .agent-chat__input--mobile-toolbar .agent-chat__composer-footer svg {
    width: var(--chat-mobile-row-icon-size);
    height: var(--chat-mobile-row-icon-size);
  }

  /* Keep the muted default below action-specific foregrounds regardless of
     lazy stylesheet order. */
  .agent-chat__input--mobile-toolbar :where(.agent-chat__composer-footer) svg {
    color: var(--muted);
  }

  .agent-chat__input--mobile-toolbar
    .agent-chat__composer-footer
    .agent-chat__input-btn--attach
    > svg {
    width: var(--chat-mobile-row-plus-icon-size);
    height: var(--chat-mobile-row-plus-icon-size);
  }

  .agent-chat__input--mobile-toolbar .agent-chat__composer-actions {
    position: relative;
    z-index: 0;
    gap: var(--chat-mobile-row-action-gap);
  }

  .agent-chat__input--mobile-toolbar .chat-send-btn--voice {
    padding: var(--chat-mobile-row-icon-padding);
  }

  .agent-chat__input--mobile-toolbar .chat-send-btn--voice > svg {
    width: var(--chat-mobile-row-icon-size);
    height: var(--chat-mobile-row-icon-size);
    color: var(--muted);
    opacity: var(--chat-mobile-row-mic-opacity);
    stroke-width: var(--chat-mobile-row-mic-stroke);
  }
}

/* Short split panes need the natural editor height before reserving transcript space. */
@container chat-conversation (max-height: 320px) {
  .chat-footer {
    --chat-footer-max-height: calc(100cqh - clamp(24px, 12cqh, 48px));
  }

  .chat-footer::before {
    display: none;
  }

  .chat-thread-viewport,
  .chat-thread {
    --chat-thread-padding-top: 0px;
    --chat-thread-padding-bottom: 0px;
  }

  .agent-chat__input {
    --chat-composer-min-height: 0px;
  }

  .agent-chat__composer-shell {
    --chat-composer-top-margin: 4px;
    --chat-composer-bottom-gap: 4px;

    gap: 4px;
  }

  .agent-chat__composer-combobox > :is(textarea, input) {
    max-height: calc(var(--chat-composer-editor-line) + 8px);
  }
}

/* ── composer.css ── */
.context-usage__popover,
.chat-controls__inline-select-menu,
.agent-chat__attach-menu > .cc-dd__menu,
.agent-chat__capability-menu > .cc-dd__menu,
.chat-controls__permission-picker > .cc-dd__menu,
.chat-talk-input-picker > .cc-dd__menu {
  border: 1px solid var(--chat-composer-popover-border, var(--overlay-border));
  border-radius: var(--chat-composer-popover-radius, var(--radius-lg));
  background: var(--chat-composer-popover-background, var(--bg-elevated));
  box-shadow: var(--overlay-shadow);
  corner-shape: superellipse(1.5);
}

.chat-controls__inline-select[open] > .cc-dd__menu {
  animation: chat-composer-picker-in var(--wa-transition-fast) ease;
}

.chat-controls__inline-select[open] > .cc-dd__menu[data-current-placement^="top"] {
  transform-origin: bottom;
}

.chat-controls__inline-select[open] > .cc-dd__menu[data-current-placement^="bottom"] {
  transform-origin: top;
}

@keyframes chat-composer-picker-in {
  from {
    opacity: 0;
    scale: 0.9;
  }
}

/* Composer popovers share one information architecture: a quiet title, a
   consistent icon/copy/state rail, and a neutral selected surface. Their
   widths still follow the amount of content each owner needs. */
.chat-controls__popover-title,
.chat-talk-input-picker__heading {
  padding: 7px 10px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.chat-assistant-attachment-card--checking,
.chat-controls__model-trigger-skeleton {
  --skeleton-base: color-mix(in srgb, var(--muted) 15%, transparent);
  --skeleton-highlight: color-mix(in srgb, var(--text) 30%, transparent);
}

@property --chat-dictation-edge-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Dictation remains the same writing surface. A masked gradient paints inside
   its actual radius and corner-shape, so capture never introduces a competing
   rounded-rectangle geometry. */
.agent-chat__input--dictating,
.agent-chat__input--dictating:focus-within {
  isolation: isolate;
}

.agent-chat__input--dictating::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  corner-shape: superellipse(1.5);
  /* Comet, not a ring: a long fading tail behind a bright head, dark again
     right in front of it, so the light reads as travelling, not as a ring. */
  background: conic-gradient(
    from var(--chat-dictation-edge-angle),
    transparent 0deg 200deg,
    color-mix(in srgb, var(--accent) 10%, transparent) 252deg,
    color-mix(in srgb, var(--accent) 45%, transparent) 286deg,
    color-mix(in srgb, var(--accent) 92%, white) 294deg,
    transparent 301deg 360deg
  );
  -webkit-mask:
    linear-gradient(white 0 0) content-box,
    linear-gradient(white 0 0);
  mask-composite: exclude;
  animation: chat-dictation-edge-orbit 6.6s linear infinite;
  pointer-events: none;
}

@keyframes chat-dictation-edge-orbit {
  to {
    --chat-dictation-edge-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat__input--dictating::after {
    --chat-dictation-edge-angle: 238deg;
    animation: none;
  }
}

.agent-chat__composer-status {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--border) 16%, transparent);
  border-radius: calc(16px * var(--openclaw-corner-radius-scale));
  corner-shape: superellipse(1.5);
  overflow: hidden;
  background: var(--composer-attached-surface, var(--chat-composer-surface));
}

/* This is one status lane; event details remain with their transcript, queue,
   or toast owner instead of growing extra composer rows. */
.agent-chat__composer-status[data-tone="info"] {
  border-color: color-mix(in srgb, var(--info) 12%, transparent);
  background: color-mix(in srgb, var(--info) 7%, var(--composer-attached-surface));
  color: color-mix(in srgb, var(--info) 72%, var(--text));
}

.agent-chat__composer-status[data-tone="warn"] {
  border-color: color-mix(in srgb, var(--warn) 12%, transparent);
  background: color-mix(in srgb, var(--warn) 7%, var(--composer-attached-surface));
  color: color-mix(in srgb, var(--warn) 72%, var(--text));
}

.agent-chat__composer-status[data-tone="danger"] {
  border-color: color-mix(in srgb, var(--danger) 12%, transparent);
  background: color-mix(in srgb, var(--danger) 7%, var(--composer-attached-surface));
  color: color-mix(in srgb, var(--danger) 78%, var(--text));
}

.agent-chat__composer-status-band {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  font-size: var(--control-ui-text-sm);
  line-height: 1.35;
  white-space: nowrap;
}

.agent-chat__composer-status-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  color: inherit;
}

.agent-chat__composer-status-icon svg {
  width: var(--chat-composer-footer-icon-size, 16px);
  height: var(--chat-composer-footer-icon-size, 16px);
}

.agent-chat__composer-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-chat__composer-status-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 0;
}

.agent-chat__composer-status-stack:not(
  :has(.compaction-indicator, .agent-chat__goal, .agent-chat__dictation-status)
) {
  display: none;
}

.agent-chat__composer-status-stack .compaction-indicator,
.agent-chat__composer-status-stack .agent-chat__goal {
  margin: 0;
}

.agent-chat__input--dictating .agent-chat__composer-status-stack {
  padding: 12px 14px 0;
}

/* Capture mode pares the footer back to the two decisions that matter: stop
   recording or accept the transcript. Draft content and attachments remain in
   place so entering the mode never discards operator context. */
.agent-chat__input--dictating .agent-chat__composer-lead,
.agent-chat__input--dictating .agent-chat__composer-meta,
.agent-chat__input--dictating .agent-chat__composer-controls,
.agent-chat__input--dictating .chat-talk-input-picker {
  display: none;
}

.agent-chat__input--dictating .agent-chat__composer-footer {
  grid-template-columns: minmax(0, 1fr);
}

.agent-chat__input--dictating .agent-chat__composer-trail {
  grid-column: 1;
}

.agent-chat__composer-controls .chat-controls__model-settings {
  /* Keep the desktop seam, but honor the compact row's 2px chip rhythm so
     independent 44px model/effort targets still fit the narrowest composer. */
  gap: min(4px, var(--chat-composer-chip-gap));
}

.agent-chat__composer-run-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  pointer-events: none;
}

.agent-chat__composer-controls .chat-composer-model-control {
  order: 3;
}

.agent-chat__composer-run-status .agent-chat__run-status {
  width: max-content;
  max-width: 100%;
  overflow: visible;
}

.agent-chat__composer-run-status .agent-chat__run-status-label {
  overflow: visible;
  text-overflow: clip;
}

.chat-composer-model-control {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  order: 3;
}

.chat-composer-model-control .chat-controls__model {
  width: 100%;
}

.agent-chat__attach-menu-option {
  display: flex;
  align-items: center;
  gap: var(--chat-composer-menu-row-gap);
  width: 100%;
  min-height: var(--chat-composer-menu-row-height);
  padding: var(--chat-composer-menu-row-padding);
  border-radius: var(--chat-composer-menu-row-radius);
  color: var(--text);
  font-size: 12px;
}

.agent-chat__attach-menu-option [slot="icon"] {
  color: var(--muted);
}

.agent-chat__attach-menu-option svg {
  width: var(--chat-composer-menu-icon);
  height: var(--chat-composer-menu-icon);
  flex: 0 0 var(--chat-composer-menu-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.agent-chat__capability-menu > .cc-dd__menu {
  /* Web Awesome owns this menu's important max-height rule. Keep capability
     views compact while respecting the composer's live viewport budget. */
  --auto-size-available-height: min(
    420px,
    50dvh,
    var(--chat-composer-popover-max-height, calc(100dvh - 116px))
  );
  width: 272px;
  min-width: 272px;
  max-width: min(272px, calc(100vw - 24px));
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.agent-chat__capability-menu[data-view="root"] > .cc-dd__menu {
  /* Wide enough that "Web search" plus its trailing switch stays one line. */
  width: 208px;
  min-width: 208px;
  max-width: min(208px, calc(100vw - 24px));
  overflow-y: visible;
  scrollbar-gutter: auto;
}

.agent-chat__capability-menu-item[value="back"] {
  position: sticky;
  top: calc(-1 * var(--menu-padding));
  z-index: 1;
  background: var(--bg-elevated);
}

.agent-chat__capability-menu-item {
  --wa-color-text-normal: var(--text);

  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--chat-composer-menu-row-gap);
  width: 100%;
  min-height: var(--chat-composer-menu-row-height);
  padding: var(--chat-composer-menu-row-padding);
  border-radius: var(--chat-composer-menu-row-radius);
}

.agent-chat__capability-menu-item,
.agent-chat__capability-menu-state {
  color: var(--text);
  font-size: 12px;
}

.agent-chat__capability-menu-item svg,
.agent-chat__capability-menu-state svg {
  width: var(--chat-composer-menu-icon);
  height: var(--chat-composer-menu-icon);
  flex: 0 0 var(--chat-composer-menu-icon);
}

.agent-chat__capability-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: color-mix(in srgb, var(--border) 72%, transparent);
}

.agent-chat__capability-menu-details {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.agent-chat__capability-menu-badge,
.agent-chat__capability-menu-session-tag {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.agent-chat__capability-menu-badge {
  min-height: 18px;
  padding: 0 6px;
}

.agent-chat__capability-menu-session-tag {
  margin-left: 5px;
  padding: 3px 5px;
}

.agent-chat__capability-menu-chevron {
  display: inline-flex;
  color: var(--muted);
}

/* Row voice shared with the permission picker: 13/600 strong titles, muted 11px
   notes, and a 16px icon part so the icon→label distance is the row gap alone
   (wa-dropdown-item's default icon part is 24px wide, which read as a wider,
   misaligned gap next to the custom-markup pickers). */
.agent-chat__attach-menu-option > [slot="icon"],
.agent-chat__capability-menu-item > [slot="icon"] {
  width: var(--chat-composer-menu-icon);
}

.agent-chat__attach-menu-option > .cc-item__label,
.agent-chat__capability-menu-item > .cc-item__label {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
}

.agent-chat__capability-menu-label {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.agent-chat__capability-menu-note,
.agent-chat__capability-menu-state {
  color: var(--muted);
}

.agent-chat__capability-menu-note {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.25;
}

.agent-chat__capability-menu-item[value^="library-"] .agent-chat__capability-menu-label > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-chat__capability-menu-state {
  padding: 10px 12px;
  line-height: 1.4;
}

.agent-chat__capability-menu-switch {
  pointer-events: none;
}

.agent-chat__capability-menu-toggle[type="checkbox"] > .cc-item__check {
  display: none;
}

.agent-chat__capability-menu-subrow {
  padding-inline-start: 28px;
}

.agent-chat__capability-menu-link {
  display: block;
  width: 100%;
  color: inherit;
}

.mcp-server-dialog {
  width: min(520px, calc(100vw - 48px));
  gap: var(--space-4);
}

.mcp-server-dialog__scope {
  display: grid;
  gap: var(--space-2);
}

.mcp-server-dialog .mcp-server-form {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  padding: 0;
  border-bottom: 0;
}

.mcp-server-dialog .mcp-server-message {
  margin: 0;
}

/* Selected/open states stay a quiet neutral wash; only live recording gets a
   (soft) danger tint so "active" chrome never competes with the send button. */
.agent-chat__talk-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.agent-chat__composer-errors {
  width: 100%;
  background: color-mix(in srgb, var(--danger) 8%, var(--chat-composer-surface));
  color: color-mix(in srgb, var(--danger) 78%, var(--text));
}

.agent-chat__composer-errors--standalone {
  overflow: hidden;
}

:root[data-theme="light"] .agent-chat__composer-errors {
  background: color-mix(in srgb, var(--danger) 14%, var(--chat-composer-surface));
}

.agent-chat__composer-error {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  font-size: var(--control-ui-text-sm);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.agent-chat__composer-error + .agent-chat__composer-error {
  border-top: 1px solid color-mix(in srgb, var(--danger) 16%, transparent);
}

.agent-chat__composer-error-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--danger);
}

.agent-chat__composer-error-icon svg {
  width: 100%;
  height: 100%;
}

.agent-chat__composer-error .callout__dismiss {
  margin: -4px -4px -4px 0;
  border-radius: var(--radius-full);
  opacity: 0.72;
}

.agent-chat__composer-error .callout__dismiss:hover {
  background: transparent;
  opacity: 1;
}

.agent-chat__talk-status-text {
  min-width: 0;
  flex: 1;
}

/* Bars-only meter; the stop-voice pill button supplies the chrome around it. */
.agent-chat__voice-activity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 20px;
}

.agent-chat__voice-activity-bar {
  position: relative;
  width: 3px;
  height: 18px;
  flex: 0 0 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
  box-shadow: 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent);
  opacity: 0.9;
  transform: scaleY(var(--talk-bar-scale, 0.18));
  transform-origin: center;
  transition:
    transform 90ms linear,
    opacity var(--duration-fast) ease;
}

.agent-chat__dictation-status {
  display: flex;
  align-items: center;
  width: 100%;
  color: var(--accent);
  font-size: 12px;
}

.agent-chat__dictation-phase {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .agent-chat__dictation-phase--listening {
    background-image: repeating-linear-gradient(
      90deg,
      var(--muted) 0%,
      var(--muted) 38%,
      color-mix(in srgb, var(--muted) 45%, var(--text-strong) 55%) 50%,
      var(--muted) 62%,
      var(--muted) 100%
    );
    background-size: 200% 100%;
    background-repeat: repeat-x;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation-name: text-shimmer;
    animation-duration: 2s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: normal;
  }
}

.agent-chat__dictation-status--finalizing .agent-chat__voice-activity-bar {
  background: var(--muted);
  box-shadow: none;
}

.agent-chat__voice-activity[data-status="connecting"] .agent-chat__voice-activity-bar {
  animation: agent-chat-voice-connecting 1.05s ease-in-out infinite;
  animation-delay: var(--talk-bar-delay);
}

.agent-chat__voice-activity[data-status="thinking"] .agent-chat__voice-activity-bar {
  animation: agent-chat-voice-thinking 0.9s ease-in-out infinite;
  animation-delay: var(--talk-bar-delay);
}

@keyframes agent-chat-voice-connecting {
  0%,
  100% {
    opacity: 0.42;
    transform: scaleY(0.2);
  }
  50% {
    opacity: 0.9;
    transform: scaleY(0.58);
  }
}

@keyframes agent-chat-voice-thinking {
  0%,
  100% {
    opacity: 0.4;
    transform: scaleY(0.24);
  }
  45% {
    opacity: 1;
    transform: scaleY(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat__voice-activity-bar {
    animation: none !important;
    opacity: 0.78;
    transform: scaleY(0.38);
    transition: none !important;
  }

  .agent-chat__voice-activity[data-status="connecting"] .agent-chat__voice-activity-bar {
    opacity: 0.48;
    transform: scaleY(0.18);
  }

  .agent-chat__voice-activity[data-status="connecting"]
    .agent-chat__voice-activity-bar:nth-child(4) {
    opacity: 0.9;
    transform: scaleY(0.56);
  }

  .agent-chat__voice-activity[data-status="thinking"] .agent-chat__voice-activity-bar:nth-child(3),
  .agent-chat__voice-activity[data-status="thinking"] .agent-chat__voice-activity-bar:nth-child(4),
  .agent-chat__voice-activity[data-status="thinking"] .agent-chat__voice-activity-bar:nth-child(5) {
    transform: scaleY(0.72);
  }

  .chat-send-btn--voice-live .agent-chat__voice-activity,
  .chat-send-btn__voice-stop-glyph,
  .chat-talk-input-picker {
    transition: none !important;
  }
}

.agent-chat__capability-menu-clear-overrides {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
}

.agent-chat__capability-menu-clear-overrides svg {
  width: 13px;
  height: 13px;
}

.agent-chat__input .chat-send-btn--sending .btn__spinner {
  width: 16px;
  height: 16px;
}

/* The microphone and its device picker are related but distinct actions. Keep
   separate hit areas so hover and focus always identify which action will fire. */
.chat-talk-control {
  --chat-voice-background: transparent;
  --chat-voice-color: var(--muted);
  --chat-voice-hover-background: var(--bg-hover);
  --chat-voice-hover-color: var(--text);
  --chat-microphone-picker-width: 28px;
  display: inline-flex;
  /* The action row is right-anchored. Keeping the mic on this trailing edge lets
     the picker grow toward the transcript without replacing the hovered target. */
  flex-direction: row-reverse;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  background: transparent;
  transition: background var(--duration-fast) ease;
}

.agent-chat__input .chat-talk-control:has(:focus-visible) {
  background: var(--chat-composer-group-hover);
}

.chat-talk-control > openclaw-tooltip {
  display: inline-flex;
}

/* The chevron owns the leading slot of the microphone control while remaining
   out of the resting composer until approach. The host and trigger both
   collapse to zero: hiding only the trigger leaves an invisible gap beside the
   mic. Width is animated instead of clipping the dropdown host, so its projected
   menu remains available while open.
   Stretch instead of a fixed height so it always matches the voice button,
   including the 44px mobile bump. */
.chat-talk-input-picker {
  display: inline-flex;
  align-self: center;
  width: 0;
  opacity: 0;
  transition:
    width 190ms cubic-bezier(0.2, 0, 0, 1),
    opacity 120ms ease-out;
}

/* Focus, open, and captured-hold states reveal immediately so hover dwell never
   delays keyboard access or lets the mic and chevron reflow mid-gesture. */
.chat-talk-control--holding .chat-talk-input-picker,
.chat-talk-control:has(:focus-visible) .chat-talk-input-picker,
.chat-talk-input-picker[open] {
  width: var(--chat-microphone-picker-width);
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .chat-talk-control:hover:not(.chat-talk-control--holding):not(:has(:focus-visible))
    .chat-talk-input-picker:not([open]) {
    width: var(--chat-microphone-picker-width);
    opacity: 1;
    transition-delay: 750ms;
  }
}

/* Quiet chrome, deliberately not a second filled half. The chevron carries no
   ground and no divider of its own — a tinted segment beside the microphone
   reads as a separate button with its own meaning, which this is not: it only
   opens the input-device list. Foreground follows the composer's own secondary
   step, with a plain muted fallback for the composer-replacement banner, which
   renders these controls outside the composer surface. */
.chat-talk-input-picker__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0;
  min-width: 0;
  height: var(--chat-composer-control-size);
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--chat-composer-secondary, var(--muted));
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  /* Collapsed, the glyph is parked under the microphone and slides into its
     leading slot; without that it appeared in place while the box widened, which
     read as a stutter rather than a reveal. */
  transform: translateX(6px);
  /* Width carries the layout, so it takes the longer, decelerating curve and the
     paint follows it: opacity waits out the first half of the movement so the
     chevron fades in as it settles instead of flashing at full strength while
     the box is still a sliver. Collapsing runs the reverse without that wait, so
     the row never holds a half-drawn control. */
  transition:
    width 190ms cubic-bezier(0.2, 0, 0, 1),
    transform 190ms cubic-bezier(0.2, 0, 0, 1),
    opacity 120ms ease-out,
    background var(--duration-fast) ease,
    color var(--duration-fast) ease;
}

/* Hover reveals it for pointers, keyboard focus for everyone else, and [open]
   holds it while its own menu is up — losing the trigger mid-interaction would
   leave the menu anchored to nothing. Collapsed it keeps zero width instead of
   `display: none`, so it stays in the tab order's natural place; `pointer-events`
   is what stops the zero-width strip from swallowing clicks meant for the mic.
   Keyed to :focus-visible rather than :focus-within on purpose. Closing the menu
   returns focus to this trigger, so a plain :focus-within reveal outlived the
   interaction that opened it: after picking a device with the mouse the control
   stayed expanded with the pointer nowhere near it. :focus-visible ignores that
   restored pointer focus while still holding the reveal for a keyboard user. */
.chat-talk-control--holding .chat-talk-input-picker__trigger,
.chat-talk-control:has(:focus-visible) .chat-talk-input-picker__trigger,
.chat-talk-input-picker[open] .chat-talk-input-picker__trigger {
  /* Wide enough to seat its glyph the way the microphone seats its own: at 16 the
     chevron ended up a couple of pixels off the pill's leading edge while the mic
     kept six on the other side, so the expanded control looked pushed against its
     own frame.
     Width alone, deliberately: a min-width here would be the used width from the
     first frame and the box would snap to full size while the transition was
     still running, which is the jump this reveal is meant not to have. */
  width: var(--chat-microphone-picker-width);
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0ms, 0ms, 70ms, 0ms, 0ms;
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  .chat-talk-control:hover:not(.chat-talk-control--holding):not(:has(:focus-visible))
    .chat-talk-input-picker:not([open])
    .chat-talk-input-picker__trigger {
    width: var(--chat-microphone-picker-width);
    opacity: 1;
    transform: translateX(0);
    transition-delay: 750ms, 750ms, 820ms, 0ms, 0ms;
    pointer-events: auto;
  }
}

@media (hover: none) {
  .chat-talk-input-picker {
    width: var(--chat-microphone-picker-width);
    opacity: 1;
  }

  .chat-talk-input-picker__trigger {
    width: var(--chat-microphone-picker-width);
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0ms, 0ms, 70ms, 0ms, 0ms;
    pointer-events: auto;
  }
}

.chat-talk-input-picker[open] .chat-talk-input-picker__trigger {
  color: var(--text-strong);
}

@media (hover: hover) and (pointer: fine) {
  .chat-talk-input-picker__trigger:hover {
    background: color-mix(in srgb, var(--text-strong) 7%, transparent);
    color: var(--text-strong);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-talk-control,
  .chat-talk-input-picker,
  .chat-talk-input-picker__trigger {
    transition: none;
  }
}

/* The chevron follows the microphone into the disabled state; without this it
   stays legible beside a greyed-out button and invites a click that the popover
   cannot usefully answer. */
.chat-talk-control:has(.chat-send-btn:disabled) .chat-talk-input-picker__trigger {
  color: var(--chat-composer-tertiary, var(--muted));
}

.chat-talk-input-picker__trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.chat-talk-input-picker__trigger svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
}

.chat-talk-input-picker[open] .chat-talk-input-picker__trigger svg {
  transform: rotate(180deg);
}

.chat-talk-input-picker > .cc-dd__menu {
  width: min(300px, calc(100vw - 24px));
  padding: 8px;
}

.chat-talk-input-picker__item {
  min-height: var(--chat-composer-menu-row-height);
  padding: var(--chat-composer-menu-row-padding);
  border-radius: var(--chat-composer-menu-row-radius);
  color: var(--text);
  font-size: 13px;
}

.chat-talk-input-picker__item[aria-checked="true"] {
  background: var(--chat-composer-menu-selected);
}

.chat-talk-input-picker__option-icon {
  display: inline-flex;
  width: var(--chat-composer-menu-icon);
  height: var(--chat-composer-menu-icon);
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.chat-talk-input-picker__option-icon svg {
  width: var(--chat-composer-menu-icon);
  height: var(--chat-composer-menu-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7px;
}

.chat-talk-input-picker__label {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-talk-input-picker__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--chat-composer-menu-icon);
  height: var(--chat-composer-menu-icon);
  color: var(--accent);
}

.chat-talk-input-picker__check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
}

.chat-talk-input-picker__note,
.chat-talk-input-picker__warning,
.chat-talk-input-picker__hint {
  padding: 5px 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.chat-talk-input-picker__warning {
  color: var(--warn);
}

/* Sole content of the popover when no input can be selected, so it carries the
   row's own weight instead of reading as a footnote under the heading. */
.chat-talk-input-picker__notice {
  padding: 0;
  opacity: 1;
  color: inherit;
  line-height: inherit;
  cursor: default;
}

.chat-talk-input-picker__empty {
  padding: 4px 8px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-wrap: pretty;
}

.chat-talk-input-picker__empty--fault {
  color: var(--warn);
}

.chat-talk-input-picker__hint {
  margin-top: 3px;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  padding-top: 8px;
}

.chat-talk-input-picker__capability {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 5px;
  padding: 8px 9px 3px;
  border-top: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.chat-talk-input-picker__capability + .chat-talk-input-picker__capability {
  margin-top: 0;
  border-top: 0;
  padding-top: 3px;
}

.chat-talk-input-picker__capability[disabled] {
  opacity: 1;
  cursor: default;
}

.chat-talk-input-picker__capability-copy {
  display: grid;
  min-width: 0;
}

.chat-talk-input-picker__capability-copy strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.chat-talk-input-picker__capability-alert {
  display: inline-flex;
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--warn) 82%, var(--text));
}

.chat-talk-input-picker__capability-alert svg {
  width: 12px;
  height: 12px;
}

.chat-talk-input-picker__settings {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: var(--cursor-action);
}

.chat-talk-input-picker__settings:hover {
  color: var(--text-strong);
}

.chat-talk-input-picker__settings svg {
  width: 13px;
  height: 13px;
}

.chat-talk-input-picker__preference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 5px;
  padding: 11px 9px 5px;
  border-top: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.chat-talk-input-picker__preference > .cc-item__check {
  display: none;
}

.chat-send-btn--hold-enabled {
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

@property --chat-dictation-hold-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* The hold threshold is functional feedback, not decoration: the ring fills
   linearly until dictation latches, then the ordinary Stop state takes over. */
.chat-send-btn--dictation-arming {
  position: relative;
}

.chat-send-btn--dictation-arming::after {
  content: "";
  position: absolute;
  inset: -3px;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(
    from -90deg,
    var(--accent) 0deg var(--chat-dictation-hold-angle),
    transparent var(--chat-dictation-hold-angle) 360deg
  );
  -webkit-mask:
    linear-gradient(white 0 0) content-box,
    linear-gradient(white 0 0);
  mask-composite: exclude;
  /* Keep the visible fill aligned with HOLD_PROGRESS_MS in composer-dictation.ts. */
  animation: chat-dictation-hold-progress 350ms linear forwards;
  pointer-events: none;
}

@keyframes chat-dictation-hold-progress {
  to {
    --chat-dictation-hold-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-send-btn--dictation-arming::after {
    --chat-dictation-hold-angle: 360deg;
    background: color-mix(in srgb, var(--accent) 52%, transparent);
    animation: none;
  }
}

.agent-chat__video-preview {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 24;
  width: min(240px, 45vw);
  margin: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: var(--radius-lg);
  background: var(--media-bg);
  box-shadow: var(--overlay-shadow);
  transform: translateX(-50%);
}

.agent-chat__video-preview video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.agent-chat__video-preview video.agent-chat__video-preview-mirrored {
  transform: scaleX(-1);
}

.agent-chat__video-preview-switch-tooltip {
  position: absolute;
  top: 8px;
  right: 8px;
}

.agent-chat__video-preview-switch {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, white 28%, transparent);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--media-bg) 68%, transparent);
  color: white;
  cursor: var(--cursor-action);
  place-items: center;
  backdrop-filter: blur(8px);
}

.agent-chat__video-preview-switch:hover:not(:disabled) {
  background: color-mix(in srgb, var(--media-bg) 82%, transparent);
}

.agent-chat__video-preview-switch:disabled {
  cursor: wait;
  opacity: 0.6;
}

.agent-chat__video-preview-switch svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .agent-chat__composer-error .callout__dismiss {
    width: 44px;
    height: 44px;
    margin-block: -8px;
  }

  .agent-chat__composer-actions:has(> .chat-talk-control:not(.chat-talk-control--active)) {
    flex-direction: row;
  }

  .agent-chat__composer-controls {
    display: flex;
    justify-content: flex-end;
    width: auto;
    margin-left: 0;
    gap: 0;
  }

  .agent-chat__input .agent-chat__composer-run-status {
    flex: 1 1 auto;
    min-width: 23px;
    overflow: hidden;
  }

  .agent-chat__input .agent-chat__composer-run-status .agent-chat__run-status {
    min-width: 0;
    flex-shrink: 1;
  }

  /* The borderless trigger is 30px on desktop; keep a >=44px touch target
     inside the mobile composer row. */
  /* Box, gap and inset now come from the family tokens above; this keeps only
     what is specific to a trigger on a narrow row. */
  .agent-chat__input .agent-chat__composer-controls .chat-controls__inline-select-trigger {
    width: fit-content;
    max-width: 100%;
    min-width: 44px;
  }

  .agent-chat__input .chat-controls__model-menu,
  .agent-chat__input .chat-controls__effort-menu {
    width: calc(
      100vw - var(--safe-area-left) - var(--safe-area-right) - 2 * var(--shell-popup-inline-gutter)
    );
    max-height: min(440px, var(--auto-size-available-height, calc(100dvh - 116px)));
  }
}

@media (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .agent-chat__input > .slash-menu {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    bottom: auto;
    max-height: min(28vh, 88px);
    margin-bottom: 6px;
  }

  .agent-chat__input > :is(.mention-menu, .skill-menu) {
    --slash-menu-max-height: min(28vh, 88px);
  }
}

@media (max-width: 640px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  /* Backdrop filtering contains fixed descendants, so lift it while the
     viewport-anchored panels are open. */
  .agent-chat__input:has(.chat-controls__inline-select[open]),
  .agent-chat__input:has(.context-usage details[open]) {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.slash-menu {
  --slash-menu-max-height: min(42vh, 336px);

  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  right: 0;
  max-height: var(--slash-menu-max-height);
  overflow: hidden;
  background: var(--chat-composer-surface);
  border: 1px solid var(--chat-composer-hairline);
  border-radius: var(--menu-radius);
  z-index: 30;
}

.agent-chat__input:has(> .slash-menu) {
  /* Lift the menu's stacking context above floating notices so options remain clickable. */
  z-index: 25;
}

/* Standalone command menus stay compact in base.css. Inside the composer the
   command and skill sheets use the writing surface's exact outer geometry. */
.agent-chat__input .slash-menu.slash-menu {
  border-radius: 20px;
}

@supports (corner-shape: superellipse(1.5)) {
  .agent-chat__input .slash-menu.slash-menu {
    border-radius: calc(20px * var(--openclaw-corner-radius-scale));
    corner-shape: superellipse(1.5);
  }
}

.slash-menu__scroll {
  max-height: calc(var(--slash-menu-max-height) - 12px);
  margin: 6px;
  overflow-y: auto;
  padding-right: 2px;
}

.slash-menu__scroll[data-scrollable="true"] {
  padding-right: 6px;
}

.slash-menu__scroll[data-scrollable="true"][data-at-start="true"][data-at-end="false"],
.session-progress-card--composer
  .session-progress-card__body[data-scrollable="true"][data-at-end="false"] {
  mask-image: linear-gradient(black calc(100% - 10px), transparent);
}

.slash-menu__scroll[data-scrollable="true"][data-at-start="false"][data-at-end="false"] {
  mask-image: linear-gradient(transparent, black 10px calc(100% - 10px), transparent);
}

.slash-menu__scroll[data-scrollable="true"][data-at-start="false"][data-at-end="true"] {
  mask-image: linear-gradient(transparent, black 10px);
}

.slash-menu-group + .slash-menu-group {
  margin-top: 2px;
  padding-top: 4px;
}

.slash-menu-group__label {
  padding: 4px 8px 3px;
  font-size: calc(10px * var(--control-ui-text-scale));
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.slash-menu-item {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: var(--menu-item-radius);
  transition: background var(--duration-fast) ease;
}

.slash-menu-item[role="option"] {
  cursor: pointer;
}

.slash-menu-item--active {
  background: var(--bg-hover);
}

.slash-menu-copy {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 10px;
  width: 100%;
}

.slash-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  color: var(--chat-composer-secondary);
}

.slash-menu-icon svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.slash-menu-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--control-ui-text-sm);
  font-weight: 550;
  color: var(--text-strong);
  white-space: nowrap;
}

.slash-menu-name mark {
  color: inherit;
  background: transparent;
}

.slash-menu-args,
.slash-menu-desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  white-space: nowrap;
}

.slash-menu-args {
  font-size: var(--control-ui-text-xs);
}

.slash-menu-desc {
  text-align: right;
  font-size: var(--control-ui-text-sm);
}

.mention-menu,
.skill-menu {
  overflow: visible;
}

.mention-menu .slash-menu-item {
  grid-template-columns: 22px minmax(0, 1fr);
}

.mention-menu .slash-menu-icon,
.mention-menu .chat-author-avatar {
  width: 22px;
  height: 22px;
}

.mention-menu .chat-author-avatar {
  flex-basis: 22px;
  border: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 68%, transparent);
}

@media (max-width: 640px) {
  .slash-menu-copy {
    gap: 8px;
  }
}

.chat-attachments-preview {
  /* Ease across most of a thumbnail and clear the frame before clipping, so a
     partially visible image does not read as a hard vertical border. */
  --chat-attachment-fade-in:
    transparent 4px, rgb(0 0 0 / 12%) 12px, rgb(0 0 0 / 50%) 24px, rgb(0 0 0 / 88%) 36px, black 48px;
  --chat-attachment-fade-out:
    black calc(100% - 48px), rgb(0 0 0 / 88%) calc(100% - 36px), rgb(0 0 0 / 50%) calc(100% - 24px),
    rgb(0 0 0 / 12%) calc(100% - 12px), transparent calc(100% - 4px);

  display: flex;
  gap: calc(var(--chat-composer-editor-inset-block) * 3);
  flex-wrap: nowrap;
  flex-shrink: 0;
  /* Keep horizontal clipping inside the composer. Reserve remove-target and
     focus-ring clearance in padding, not in a wider scrollport. */
  width: 100%;
  max-width: 100%;
  margin-block-start: calc(-1 * var(--chat-attachment-hit-slop));
  padding-block: calc(var(--chat-composer-editor-inset-block) * 2 + var(--chat-attachment-hit-slop))
    var(--chat-composer-editor-inset-block);
  padding-inline: var(--chat-composer-editor-inset-inline)
    calc(var(--chat-composer-editor-inset-inline) + var(--chat-attachment-hit-slop));
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

/* The attachment rail supplies the same gap before the editor as the footer
   supplies after it; the editor keeps its own symmetric block padding. */
.agent-chat__input:has(.chat-attachments-preview) .agent-chat__composer-input-row {
  padding-block-start: 0;
}

@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .chat-attachments-preview {
    padding-block-end: calc(var(--chat-box-inset) / 2);
  }
}

.chat-attachments-preview::-webkit-scrollbar {
  display: none;
}

.chat-attachments-preview[data-scrollable="true"][data-at-start="true"][data-at-end="false"] {
  mask-image: linear-gradient(to right, var(--chat-attachment-fade-out));
}

.chat-attachments-preview[data-scrollable="true"][data-at-start="false"][data-at-end="false"] {
  mask-image: linear-gradient(
    to right,
    var(--chat-attachment-fade-in),
    var(--chat-attachment-fade-out)
  );
}

.chat-attachments-preview[data-scrollable="true"][data-at-start="false"][data-at-end="true"] {
  mask-image: linear-gradient(to right, var(--chat-attachment-fade-in));
}

.chat-attachment-thumb {
  --chat-attachment-radius: calc(14px * var(--openclaw-corner-radius-scale));

  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: var(--chat-attachment-radius);
  corner-shape: superellipse(1.5);
  border: 1px solid var(--border);
  background: var(--chat-composer-surface, var(--popover));
  transition:
    border-color var(--duration-fast) ease,
    background var(--duration-fast) ease;
}

.chat-attachment-loading {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  corner-shape: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease-out;
}

.chat-attachment-loading[data-state="reading"] {
  opacity: 1;
  background: var(--chat-composer-surface, var(--popover));
}

.chat-attachment-loading > span {
  display: block;
  width: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--text) 14%, transparent);
  transform-origin: left;
  transition: transform 100ms linear;
}

/* Production CSS lowers :dir() to language selectors; direction is explicit here. */
html[dir="rtl"] .chat-attachment-loading > span {
  transform-origin: right;
}

.chat-attachment-loading[data-indeterminate="true"] > span {
  animation: chat-attachment-fill 1.5s ease-in-out infinite;
}

@keyframes chat-attachment-fill {
  0% {
    transform: scaleX(0);
    opacity: 0.4;
  }
  65% {
    transform: scaleX(1);
    opacity: 1;
  }
  100% {
    transform: scaleX(1);
    opacity: 0;
  }
}

.chat-attachment-error {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .chat-attachment-loading,
  .chat-attachment-loading > span {
    transition: none;
  }

  .chat-attachment-loading[data-indeterminate="true"] > span {
    animation: none;
    transform: scaleX(1);
    opacity: 0.5;
  }
}

.chat-attachment-thumb--file,
.chat-attachment-thumb--browser-annotation {
  border-color: color-mix(in srgb, var(--text) 24%, var(--border));
}

.chat-attachment-thumb--file {
  width: 162px;
  height: 56px;
}

.chat-attachment-thumb--browser-annotation {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 56px minmax(0, 1fr);
  width: fit-content;
  max-width: min(300px, calc(100vw - 64px));
  min-width: 0;
  height: 56px;
  background: var(--chat-composer-surface, var(--popover));
}

.chat-browser-annotation-card__preview {
  border-radius: calc(var(--chat-attachment-radius) - 1px) 0 0
    calc(var(--chat-attachment-radius) - 1px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  border-inline-end: 1px solid var(--border);
}

.chat-browser-annotation-card__body {
  justify-content: center;
  width: min(210px, calc(100vw - 132px));
  padding: 7px 30px 7px 10px;
  color: var(--text);
}

.chat-browser-annotation-card__identity {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.15;
}

.chat-browser-annotation-card__meta {
  display: flex;
  min-width: 0;
  gap: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.chat-browser-annotation-card__meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-browser-annotation-card__remove:not(:disabled) {
  cursor: var(--cursor-action);
}

.chat-browser-annotation-card__remove:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -3px;
}

.chat-attachment-thumb img {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--chat-attachment-radius) - 1px);
  corner-shape: superellipse(1.5);
  object-fit: cover;
}

.chat-attachment-image-button.chat-attachment-image-button {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--chat-attachment-radius) - 1px);
  corner-shape: superellipse(1.5);
}

.chat-attachment-image-button.chat-attachment-image-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--chat-attachment-radius) - 1px);
  corner-shape: superellipse(1.5);
  background: color-mix(in srgb, var(--text-strong) 8%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) ease;
}

.chat-attachment-thumb:is(:hover, :focus-within) .chat-attachment-image-button::after {
  opacity: 1;
}

.chat-attachment-remove {
  position: absolute;
  /* The rail reserves this overhang so the full target clears images and neighbors. */
  top: -18px;
  right: -18px;
  z-index: 1;
  width: 44px;
  height: 44px;
  padding: 12px;
  border-radius: 50%;
  corner-shape: round;
  border: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  background-clip: content-box;
  color: var(--text-strong);
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity var(--duration-fast) ease,
    transform var(--duration-fast) ease;
}

.chat-attachment-thumb--pasted-text .chat-attachment-remove {
  opacity: 1;
  transform: none;
}

.chat-attachment-thumb:is(:hover, :focus-within) .chat-attachment-remove {
  opacity: 1;
  transform: scale(1);
}

@media (hover: none) {
  .chat-attachment-remove {
    opacity: 1;
    transform: none;
  }
}

.chat-attachment-remove svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-attachment-file {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  height: 100%;
  padding: 8px 12px;
  overflow: hidden;
  font-size: 0.72rem;
  color: var(--text);
  border-radius: calc(var(--chat-attachment-radius) - 1px);
  background: transparent;
  corner-shape: superellipse(1.5);
  transition: background var(--duration-fast) ease;
}

.chat-attachment-thumb--file:is(:hover, :focus-within) .chat-attachment-file {
  background: color-mix(in srgb, var(--chat-composer-surface, var(--popover)) 86%, var(--text));
}

.chat-attachment-file--video {
  padding: 0 12px 0 0;
  gap: 8px;
}

.chat-attachment-file__preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  padding: 4px;
  color: var(--muted);
}

.chat-attachment-file__preview img {
  border-radius: max(0px, calc(var(--chat-attachment-radius) - 5px));
  outline: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  outline-offset: -1px;
}

.chat-attachment-file__preview > svg {
  width: 20px;
  height: 20px;
}

.chat-attachment-video__play {
  position: absolute;
  inset-inline-end: 7px;
  bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--popover);
  color: var(--text-strong);
}

.chat-attachment-video__play svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
  stroke: none;
}

.chat-attachment-file__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.chat-attachment-file__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-attachment-file__name {
  min-width: 0;
  overflow: hidden;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-file__body {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.chat-attachment-file__type {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-file__open {
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.15;
  text-align: start;
  cursor: var(--cursor-action);
}

.chat-attachment-text-action {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: none;
  color: var(--muted);
  background: transparent;
  cursor: var(--cursor-action);
  font: inherit;
  overflow: hidden;
  font-size: 0.64rem;
  line-height: 1.15;
  text-align: left;
  text-overflow: ellipsis;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.chat-attachment-text-action:hover {
  color: var(--text);
}

.agent-chat__file-input,
.agent-chat__photo-input,
.agent-chat__camera-input {
  display: none;
}

.chat-controls__session {
  min-width: 0;
  max-width: none;
}

.chat-controls__model {
  grid-area: model;
  min-width: 0;
  max-width: none;
}

.chat-controls__model-settings {
  display: flex;
  align-items: center;
  gap: 2px;
}

.chat-controls__inline-select {
  min-width: 0;
}

/* Model text can shrink, but its flex item must still reserve the hit target. */
.chat-controls__model-picker {
  flex: 0 1 auto;
  min-width: 44px;
}

.chat-controls__effort-picker {
  flex: 0 0 auto;
}

/* The model trigger fills its shrinkable wrapper; effort keeps its content width. */
.chat-controls__model-settings .chat-controls__effort-trigger {
  width: auto;
}

.chat-controls__effort-picker--reserved {
  visibility: hidden;
  pointer-events: none;
}

/* Collapse the empty effort slot while loading unless the open model menu
   needs its anchor. */
.chat-controls__model-settings:not(:has(.chat-controls__model-picker[open]))
  .chat-controls__effort-picker--reserved {
  display: none;
}

.chat-controls__inline-select summary {
  list-style: none;
}

.chat-controls__inline-select summary::-webkit-details-marker {
  display: none;
}

/* Composer controls are quiet text controls: no borders/fills at rest so the
   composer frame stays the only chrome; hover/open get a soft wash. */
.chat-controls__inline-select-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--chat-composer-chip-gap, 6px);
  width: 100%;
  height: var(--chat-composer-chip-height, 30px);
  min-height: var(--chat-composer-chip-height, 30px);
  /* Symmetric on purpose: this trigger carries a label and an optional leading
     icon, never a trailing one, so the old 6px trailing inset was unmatched
     asymmetry that made the chip look narrower on its right than its siblings. */
  padding-block: 0;
  padding-inline: var(--chat-composer-chip-padding-inline, 8px);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--chat-composer-chip-text, 13px);
  line-height: 1.35;
  overflow: hidden;
  user-select: none;
}

.agent-chat__input .chat-controls__inline-select-trigger {
  border-radius: var(--radius-full);
}

.chat-controls__inline-select-trigger:hover,
.chat-controls__inline-select[open] > .chat-controls__inline-select-trigger {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text-strong);
}

.chat-controls__inline-select-trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.chat-controls__inline-select-trigger--disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-controls__inline-select-label {
  min-width: 0;
  overflow: hidden;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-controls__inline-select-chevron {
  display: inline-flex;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transform: rotate(180deg);
  transition: transform var(--duration-fast) ease;
}

.chat-controls__inline-select-chevron svg {
  width: 12px;
  height: 12px;
}

/* Tighten only the label-to-chevron seam; leading icons keep the shared chip
   rhythm. Phone composers already switch the whole trigger to a 3px gap. */
.agent-chat__input .chat-controls__model-settings .chat-controls__inline-select-chevron {
  margin-inline-start: -2px;
}

.chat-controls__inline-select[open]
  > .chat-controls__inline-select-trigger
  .chat-controls__inline-select-chevron {
  transform: rotate(0deg);
}

.chat-controls__model-trigger-skeleton {
  --skeleton-duration: 1.45s;

  display: block;
  width: 100%;
  height: 0.78em;
  border-radius: var(--radius-full);
}

/* The loading label occupies the same explicit text metric as the skeleton.
   The trigger's symmetric outer padding and fixed label track keep the chevron
   from moving when the model name replaces it. */
.chat-controls__model-trigger--loading .chat-controls__inline-select-label {
  display: flex;
  width: 8.5em;
  height: 1.35em;
  flex: 0 0 8.5em;
  align-items: center;
}

.chat-controls__inline-select-check svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
}

.chat-controls__inline-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--chat-composer-menu-row-gap);
  width: 100%;
  min-height: var(--chat-composer-menu-row-height);
  padding: var(--chat-composer-menu-row-padding);
  border: 0;
  border-radius: var(--chat-composer-menu-row-radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
}

.chat-controls__inline-select-option:hover,
.chat-controls__inline-select-option:focus-visible {
  background: var(--bg-hover);
  outline: none;
}

.chat-controls__inline-select-option--selected {
  color: var(--text-strong);
  background: var(--chat-composer-menu-selected);
}

/* Model and effort are independent surfaces so either choice stays one focused
   interaction without hiding the other pill's effective state. */
.chat-controls__model-menu,
.chat-controls__effort-menu {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.chat-controls__model-menu {
  width: min(340px, calc(100vw - 24px));
  max-height: min(400px, var(--auto-size-available-height, calc(100vh - 96px)));
}

.chat-controls__effort-menu {
  width: min(330px, calc(100vw - 24px));
  max-height: min(280px, var(--auto-size-available-height, calc(100vh - 120px)));
}

.chat-controls__permission-picker > .cc-dd__menu {
  width: min(340px, calc(100vw - 24px));
  padding: 8px;
  overflow: hidden;
}

.chat-controls__permission-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 9px;
}

.chat-controls__permission-learn-more {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.chat-controls__permission-learn-more:hover {
  color: var(--text-strong);
}

.chat-controls__permission-option {
  display: flex;
  align-items: center;
  gap: var(--chat-composer-menu-row-gap);
  width: 100%;
  min-height: var(--chat-composer-menu-row-height);
  padding: var(--chat-composer-menu-row-padding);
  border-radius: var(--chat-composer-menu-row-radius);
  font-size: 12px;
}

.chat-controls__permission-icon,
.chat-controls__permission-lock {
  display: inline-flex;
  width: var(--chat-composer-chip-icon, 16px);
  height: var(--chat-composer-chip-icon, 16px);
  flex: 0 0 auto;
  color: var(--muted);
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.chat-controls__permission-trigger .chat-controls__permission-icon {
  color: currentColor;
}

.agent-chat__input .chat-controls__permission-trigger--default {
  color: var(--chat-composer-secondary);
}

.agent-chat__input .chat-controls__permission-trigger,
.agent-chat__input .chat-controls__model-settings .chat-controls__inline-select-trigger {
  color: var(--chat-composer-secondary);
}

.chat-controls__permission-option-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  align-self: center;
  width: 16px;
  justify-content: center;
}

.chat-controls__permission-label--full {
  color: var(--accent);
}

.chat-controls__permission-trigger--full .chat-controls__permission-icon {
  color: var(--accent);
}

.chat-controls__permission-option--selected {
  background: var(--chat-composer-menu-selected);
}

.chat-controls__permission-option-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.chat-controls__permission-option-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.chat-controls__permission-icon svg,
.chat-controls__permission-lock svg,
.chat-controls__permission-option-icon svg {
  width: 100%;
  height: 100%;
}

.chat-controls__permission-option:state(disabled) .chat-controls__permission-option-icon,
.chat-controls__permission-option[data-chat-permission-option="full"]
  .chat-controls__permission-option-icon {
  color: var(--accent);
}

.chat-controls__permission-option-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.chat-controls__permission-shortcut {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  line-height: 1;
}

.chat-controls__permission-option-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.chat-controls__permission-option--selected .chat-controls__permission-option-description {
  color: var(--text);
}

.chat-controls__model-search-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--card) 78%, transparent);
}

.chat-controls__model-search-wrap svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex: 0 0 auto;
}

.chat-controls__model-refresh {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.chat-controls__model-refresh-details {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
}

.chat-controls__model-search {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.chat-controls__model-search::placeholder {
  color: var(--muted);
}

.chat-controls__locked-model {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--card) 78%, transparent);
}

.chat-controls__locked-model-value {
  overflow: hidden;
  flex: 1 1 auto;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-controls__locked-model-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-controls__model-context-badge {
  border: 0;
  background: color-mix(in srgb, var(--text-strong) 13%, transparent);
}

/* Left padding is 10px, not the rows' 9px: option buttons add a 1px transparent
   border, so 10 + 16 + row gap puts this label on the same stem as the model
   names (9 + 1 + 16 + gap). */
.chat-controls__provider-heading {
  display: flex;
  align-items: center;
  gap: var(--chat-composer-menu-row-gap);
  padding: 8px 10px 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chat-controls__provider-heading[data-chat-model-provider] {
  padding-block: 0;
}

.chat-controls__provider-toggle {
  display: flex;
  align-items: center;
  gap: inherit;
  min-width: 0;
  min-height: 32px;
  /* Long account metadata shrinks before the provider toggle's contents. */
  flex: 1 0 auto;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: var(--cursor-action);
}

.chat-controls__provider-toggle:focus-visible {
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: var(--focus-ring);
}

.chat-controls__provider-toggle .chat-controls__inline-select-chevron {
  transform: rotate(0deg);
}

.chat-controls__provider-toggle[aria-expanded="true"] .chat-controls__inline-select-chevron {
  transform: rotate(180deg);
}

.chat-controls__auth-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.chat-controls__auth-meta-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-controls__model-menu .chat-controls__auth-meta [aria-hidden] svg {
  width: 13px;
  height: 13px;
  color: inherit;
}

.chat-controls__auth-meta[data-auth-kind="missing"] {
  color: var(--warn);
}

.chat-controls__model-option-copy > .chat-controls__auth-meta {
  margin-inline-start: 6px;
}

[data-chat-account-option] .chat-controls__model-option-copy {
  align-items: flex-start;
  flex-direction: column;
}

[data-chat-account-option] .chat-controls__auth-meta {
  max-width: 100%;
  margin-inline-start: 0;
}

.chat-controls__provider-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: var(--cursor-action);
}

.chat-controls__provider-settings:hover,
.chat-controls__provider-settings:focus-visible {
  background: var(--bg-hover);
  color: var(--text);
  outline: none;
}

.chat-controls__provider-settings:focus-visible {
  box-shadow: var(--focus-ring);
}

.chat-controls__provider-settings svg {
  width: 12px;
  height: 12px;
}

/* Mask/brand-color rules live on .provider-brand-icon (components.css). */
.chat-controls__provider-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.chat-controls__provider-icon.provider-brand-icon--fallback {
  font-size: 9px;
}

/* The trigger's own brand mark hangs 1px below the chip icon box so its filled
   glyph reads the same optical size as the context ring's stroked circle next
   to it; the calc keeps the mobile touch-size raise proportional. */
.chat-controls__trigger-provider-icon {
  width: calc(var(--chat-composer-chip-icon, 16px) - 1px);
  height: calc(var(--chat-composer-chip-icon, 16px) - 1px);
  flex: 0 0 calc(var(--chat-composer-chip-icon, 16px) - 1px);
}

/* Chat uses a neutral OpenAI mark in persistent chrome. New-session deliberately
   has no --chat surface marker, so its provider trigger retains brand color. */
.agent-chat__input .chat-controls__trigger-provider-icon {
  color: var(--chat-composer-secondary);
}

.chat-controls__target-icon svg {
  width: 100%;
  height: 100%;
}

.chat-controls__model-options {
  display: block;
  min-width: 0;
  padding: 0 7px 7px;
  overflow: hidden auto;
  overscroll-behavior: none;
}

.chat-controls__provider-model-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

.chat-controls__provider-model-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

/* Inline variant of the popover title: it sits inside the locked-model row,
   which owns the spacing, so the label carries type only. */
.chat-controls__inline-select-section-label {
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.chat-controls__model-menu[data-chat-model-filtering] .chat-controls__model-options {
  display: flex;
  flex-direction: column;
}

.chat-controls__model-menu[data-chat-model-filtering] .chat-controls__provider-model-group {
  display: contents;
}

.chat-controls__model-menu[data-chat-model-filtering] .chat-controls__provider-model-list {
  display: contents;
}

.chat-controls__model-menu[data-chat-model-filtering] .chat-controls__provider-heading {
  display: none;
}

.chat-controls__model-option {
  order: var(--chat-model-rank, 0);
  justify-content: flex-start;
  /* Grid-item min-width:auto would size the provider group's track to the
     row's full content width (long name + meta), overflowing the 340px menu. */
  min-width: 0;
}

/* display: flex above beats the UA [hidden] style; without this, filtered-out
   rows keep rendering even though search marked them hidden. */
.chat-controls__model-option[hidden] {
  display: none;
}

.chat-controls__model-option[data-chat-model-highlighted] {
  border-color: transparent;
  background: var(--bg-hover);
}

.chat-controls__model-option-provider {
  /* The invisible stem keeps grouped rows aligned with the provider heading label.
     Search results reveal the icon in the same reserved slot. */
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  visibility: hidden;
}

.chat-controls__model-menu[data-chat-model-filtering] .chat-controls__model-option-provider {
  visibility: visible;
}

.chat-controls__model-option-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  margin-left: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .chat-controls__model-option-action kbd {
    transition: opacity var(--duration-fast) var(--ease-out);
  }
}

.chat-controls__model-search-wrap:focus-within
  ~ .chat-controls__model-options
  .chat-controls__model-option-action
  kbd {
  opacity: 0;
}

.chat-controls__model-option-action kbd::before {
  content: attr(data-chat-model-shortcut-number);
}

.chat-controls__model-search-empty {
  min-height: 80px;
  padding: 24px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chat-controls__model-search-empty[hidden] {
  display: none;
}

.chat-controls__model-option-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-controls__model-option-title,
.chat-controls__model-option-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-controls__model-option-title {
  display: flex;
  align-items: center;
  gap: 0;
  /* Flex min-width:auto would let a long model name + badges push the row
     wider than the 340px menu and hand the popover a horizontal scrollbar. */
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.chat-controls__model-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-controls__model-state-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.chat-controls__model-state-label--default {
  margin-inline-start: 6px;
  color: var(--muted);
}

.chat-controls__model-option-meta {
  margin-inline-start: 6px;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 0 1 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
}

.chat-controls__model-option-auth-warning {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 0 1 auto;
  color: var(--warn);
  font-size: 10px;
  font-weight: 550;
}

.chat-controls__model-option-auth-warning::before {
  content: "\00b7";
  margin-inline: 6px 3px;
  color: var(--muted);
}

.chat-controls__model-option-auth-warning svg {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.chat-controls__model-option-auth-warning > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-controls__model-chat-only-info {
  display: inline-flex;
  width: 16px;
  height: 16px;
  margin-inline-start: 6px;
  color: color-mix(in srgb, var(--warn) 80%, var(--text));
}

.chat-controls__model-chat-only-info svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chat-controls__reasoning-panel {
  position: static;
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
  width: auto;
  max-height: none;
  padding: 12px 12px 11px;
  border: 0;
  background: color-mix(in srgb, var(--card) 78%, transparent);
  overflow: visible;
}

.chat-controls__reasoning-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-bottom: 10px;
}

.chat-controls__account-heading {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: start;
}

.chat-controls__account-selection {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--muted);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-controls__account-heading .chat-controls__inline-select-chevron {
  transform: none;
}

.chat-controls__account-error {
  padding: 4px 10px;
  color: var(--danger);
  font-size: 12px;
}

.chat-controls__model-catalog-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  color: var(--muted);
  font-size: 12px;
}

.chat-controls__model-catalog-state--empty {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 112px;
  padding: 20px 16px;
  border-bottom: 0;
  text-align: center;
}

.chat-controls__model-catalog-state-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-controls__model-catalog-state-label svg,
.chat-controls__model-catalog-action svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.chat-controls__model-catalog-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.chat-controls__model-catalog-action:hover,
.chat-controls__model-catalog-action:focus-visible {
  border-color: color-mix(in srgb, var(--text) 28%, var(--border));
  background: var(--bg-hover);
  outline: none;
}

.chat-controls__effort-heading {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.chat-controls__effort-value {
  min-width: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  text-align: end;
  white-space: nowrap;
}

.chat-controls__effort-scale {
  display: flex;
  justify-content: space-between;
  margin: 0 6px 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
}

/* Discrete effort slider: native range input for keyboard/a11y, decorative
   stop dots layered underneath. */
.chat-controls__reasoning-slider {
  position: relative;
  display: flex;
  align-items: center;
  height: 26px;
  margin: 0 6px;
}

.chat-controls__reasoning-dots {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
}

.chat-controls__reasoning-dot {
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 28%, transparent);
}

.chat-controls__reasoning-range {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 26px;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
}

.chat-controls__reasoning-slider:has([data-effort-boost="max"], [data-effort-boost="ultra"]) {
  --reasoning-track-background: transparent;
  --reasoning-boost-highlight: color-mix(in srgb, var(--accent) 60%, white);
  border-radius: var(--radius-full);
  background-image: linear-gradient(
    105deg,
    color-mix(in srgb, var(--accent) 70%, var(--card)) 0%,
    var(--accent) 25%,
    var(--reasoning-boost-highlight) 50%,
    var(--accent) 75%,
    color-mix(in srgb, var(--accent) 70%, var(--card)) 100%
  );
  background-position: 50% 50%;
  background-size: 220% 100%;
}

.chat-controls__reasoning-range[data-effort-boost="max"] {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 12px color-mix(in srgb, var(--accent) 24%, transparent);
}

.chat-controls__reasoning-slider:has([data-effort-boost="ultra"]) {
  --reasoning-boost-highlight: color-mix(in srgb, var(--accent-2) 70%, white);
}

.chat-controls__reasoning-range[data-effort-boost="ultra"] {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 75%, transparent),
    0 0 18px color-mix(in srgb, var(--accent) 48%, transparent),
    inset 0 0 12px color-mix(in srgb, var(--accent) 18%, transparent);
}

@keyframes chat-effort-flow {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .chat-controls__reasoning-slider:has(
    [data-effort-boost="max"]:not(:disabled),
    [data-effort-boost="ultra"]:not(:disabled)
  ) {
    animation: chat-effort-flow 6s ease-in-out infinite alternate;
  }

  .chat-controls__reasoning-slider:has([data-effort-boost="ultra"]:not(:disabled)) {
    animation-duration: 4s;
  }
}

.chat-controls__reasoning-range:disabled {
  cursor: not-allowed;
}

.chat-controls__reasoning-slider:has(.chat-controls__reasoning-range:disabled) {
  opacity: 0.5;
}

.chat-controls__reasoning-range:focus-visible {
  outline: none;
}

.chat-controls__reasoning-range::-webkit-slider-runnable-track {
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: var(--radius-full);
  background: var(
    --reasoning-track-background,
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--text) 18%, transparent) var(--reasoning-fill, 0%),
      color-mix(in srgb, var(--text) 7%, transparent) var(--reasoning-fill, 0%)
    )
  );
}

.chat-controls__reasoning-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 20px;
  margin-top: 3px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--text-strong);
  box-shadow: var(--shadow-sm);
}

.chat-controls__reasoning-range:focus-visible::-webkit-slider-thumb {
  box-shadow: var(--focus-ring);
}

.chat-controls__reasoning-range--inherit::-webkit-slider-thumb {
  background: var(--muted);
}

.chat-controls__reasoning-range--unanchored::-webkit-slider-thumb {
  opacity: 0.35;
}

.chat-controls__reasoning-range::-moz-range-track {
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: var(--radius-full);
  background: var(--reasoning-track-background, color-mix(in srgb, var(--text) 7%, transparent));
}

.chat-controls__reasoning-range::-moz-range-progress {
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--reasoning-track-background, color-mix(in srgb, var(--text) 18%, transparent));
}

.chat-controls__reasoning-range::-moz-range-thumb {
  width: 28px;
  height: 20px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--text-strong);
  box-shadow: var(--shadow-sm);
}

.chat-controls__reasoning-range--inherit::-moz-range-thumb {
  background: var(--muted);
}

.chat-controls__reasoning-range--unanchored::-moz-range-thumb {
  opacity: 0.35;
}

.chat-controls__fast-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 11px 12px;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.chat-controls__fast-mode-icon {
  display: inline-flex;
  width: var(--chat-composer-chip-icon, 14px);
  height: var(--chat-composer-chip-icon, 14px);
  color: var(--accent);
  flex: 0 0 var(--chat-composer-chip-icon, 14px);
}

/* The filled lightning carries more visual mass than the stroked microphone.
   A 14px box makes their visible ink match while the fast-mode row keeps the
   full chip icon token. */
.chat-controls__effort-zap {
  display: inline-flex;
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex: 0 0 14px;
}

/* Phone glyphs replace the text; desktop keeps its label and active-speed indicator. */
.chat-controls__effort-gauge,
.chat-controls__effort-speed {
  display: none;
}

.chat-controls__effort-gauge-needle {
  transform-box: view-box;
  transform-origin: 12px 12px;
  transition-property: none;
}

@media (prefers-reduced-motion: no-preference) {
  .chat-controls__effort-gauge-needle {
    transition: transform 180ms ease-out;
  }
}

.chat-controls__fast-mode-icon svg,
.chat-controls__effort-zap svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: currentColor;
}

.chat-controls__context-window-icon svg {
  fill: none;
}

.chat-controls__fast-mode-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-controls__fast-mode-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.chat-controls__fast-mode-description {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-controls__context-window-options {
  flex: 0 0 auto;
}

.chat-controls__speed-toggle {
  position: relative;
  display: block;
  /* Fixed-track switch: without the flex lock the fast-mode row's 1fr copy
     column squeezes the 36px track down to the thumb. */
  flex: 0 0 auto;
  width: 36px;
  height: 22px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border) 92%, var(--text));
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 12%, var(--card));
}

.chat-controls__speed-toggle:hover:not(:disabled),
.chat-controls__speed-toggle:focus-visible {
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
  background: color-mix(in srgb, var(--text) 6%, var(--card));
  color: var(--text);
  outline: none;
}

.chat-controls__speed-toggle--active {
  border-color: color-mix(in srgb, var(--accent) 76%, var(--border));
  background: color-mix(in srgb, var(--accent) 58%, var(--card));
}

.chat-controls__speed-toggle.chat-controls__speed-toggle--active:hover:not(:disabled),
.chat-controls__speed-toggle.chat-controls__speed-toggle--active:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 76%, var(--border));
  background: color-mix(in srgb, var(--accent) 58%, var(--card));
}

.chat-controls__speed-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-controls__speed-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--text-strong);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-out);
}

.chat-controls__speed-toggle--active .chat-controls__speed-toggle-thumb {
  transform: translateX(14px);
}

.chat-controls__effort-trigger--fast {
  background: transparent;
  color: var(--text);
}

.chat-controls__reasoning-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 32px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--border) 74%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--card) 74%, transparent);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  line-height: 1;
}

.chat-controls__reasoning-option:hover:not(:disabled),
.chat-controls__reasoning-option:focus-visible {
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
  background: color-mix(in srgb, var(--text) 6%, var(--card));
  color: var(--text);
  outline: none;
}

.chat-controls__reasoning-option--selected {
  border-color: color-mix(in srgb, var(--accent) 76%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  color: var(--text-strong);
}

.chat-controls__reasoning-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Selected-state check shares the mic picker's box: a 16px slot centering a
   14px accent glyph, so checks land on the same rail as 16px row icons. */
.chat-controls__inline-select-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--chat-composer-menu-icon);
  height: var(--chat-composer-menu-icon);
  color: var(--accent);
  flex: 0 0 auto;
}

.chat-controls__session select {
  height: 36px;
  min-height: 36px;
  padding: 0 34px 0 12px;
  width: 100%;
  max-width: none;
  border-color: color-mix(in srgb, var(--input) 88%, transparent);
  border-radius: var(--radius-lg);
  background-color: color-mix(in srgb, var(--card) 92%, var(--bg-elevated) 8%);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@container chat-composer (max-width: 480px) {
  .agent-chat__input .chat-controls__model-trigger {
    gap: 3px;
    justify-content: center;
    padding-inline: 0;
  }

  .agent-chat__input .chat-controls__model-settings .chat-controls__inline-select-chevron {
    margin-inline-start: 0;
  }

  .agent-chat__composer-lead .chat-controls__permission-trigger {
    width: var(--chat-composer-control-size);
    justify-content: center;
    padding-inline: 0;
  }

  .agent-chat__composer-lead
    .chat-controls__permission-trigger
    .chat-controls__inline-select-label {
    display: none;
  }

  .agent-chat__input--mobile-toolbar .chat-controls__trigger-provider-icon {
    display: none;
  }
}
@container chat-composer (max-width: 560px) {
  .agent-chat__input--mobile-toolbar .chat-controls__inline-select-chevron,
  .agent-chat__input--mobile-toolbar .chat-controls__inline-select-chevron svg {
    width: var(--chat-mobile-row-chevron-size);
    height: var(--chat-mobile-row-chevron-size);
    opacity: var(--chat-mobile-row-muted-opacity);
  }

  .agent-chat__input--mobile-toolbar .chat-controls__effort-trigger {
    --chat-effort-badge-backdrop: var(--chat-composer-surface);
  }

  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__model-trigger, .chat-controls__effort-trigger) {
    min-width: 44px;
    min-height: 44px;
    background: transparent;
  }

  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__model-trigger, .chat-controls__effort-trigger)::before {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    background: transparent;
    content: "";
  }

  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__model-picker, .chat-controls__effort-picker)[open]
    > :is(.chat-controls__model-trigger, .chat-controls__effort-trigger),
  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__model-trigger, .chat-controls__effort-trigger):hover {
    background: transparent;
  }

  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__model-picker, .chat-controls__effort-picker)[open]
    > :is(.chat-controls__model-trigger, .chat-controls__effort-trigger)::before,
  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__model-trigger, .chat-controls__effort-trigger):hover::before {
    background: color-mix(in srgb, var(--text) 7%, transparent);
  }

  .agent-chat__input--mobile-toolbar
    .chat-controls__effort-picker[open]
    > .chat-controls__effort-trigger,
  .agent-chat__input--mobile-toolbar .chat-controls__effort-trigger:hover {
    --chat-effort-badge-backdrop: color-mix(in srgb, var(--text) 7%, var(--chat-composer-surface));
  }

  .agent-chat__input--mobile-toolbar
    .chat-controls__effort-trigger
    > :is(.chat-controls__inline-select-label, .chat-controls__effort-zap) {
    display: none;
  }

  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__effort-gauge, .chat-controls__effort-speed) {
    position: relative;
    display: inline-flex;
    width: var(--chat-mobile-row-icon-size);
    height: var(--chat-mobile-row-icon-size);
    flex: 0 0 var(--chat-mobile-row-icon-size);
    pointer-events: none;
  }

  .agent-chat__input--mobile-toolbar .chat-controls__effort-gauge-dial {
    opacity: var(--chat-mobile-row-muted-opacity);
  }

  .agent-chat__input--mobile-toolbar .chat-controls__effort-gauge-needle {
    stroke: var(--text-strong);
  }

  .agent-chat__input--mobile-toolbar .chat-controls__effort-gauge--off {
    opacity: var(--chat-mobile-row-muted-opacity);
  }

  .agent-chat__input--mobile-toolbar .chat-controls__effort-fast-badge {
    position: absolute;
    right: -1px;
    bottom: 1px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
  }

  .agent-chat__input--mobile-toolbar .chat-controls__effort-fast-badge::before {
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: var(--radius-full);
    background: var(--chat-effort-badge-backdrop);
    content: "";
  }

  .agent-chat__input--mobile-toolbar
    .agent-chat__composer-footer
    .chat-controls__effort-fast-badge
    svg {
    width: 10px;
    height: 10px;
    color: var(--accent);
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.5;
  }

  .agent-chat__input--mobile-toolbar .chat-controls__permission-trigger {
    color: var(--muted);
    padding-inline: var(--chat-mobile-row-icon-padding);
  }

  .agent-chat__input--mobile-toolbar .context-ring {
    color: inherit;
  }

  .agent-chat__input--mobile-toolbar
    :is(.chat-controls__permission-icon, .chat-controls__permission-lock) {
    width: var(--chat-mobile-row-muted-icon-size);
    height: var(--chat-mobile-row-muted-icon-size);
    flex-basis: var(--chat-mobile-row-muted-icon-size);
    color: inherit;
    opacity: var(--chat-mobile-row-muted-opacity);
  }

  .agent-chat__input--mobile-toolbar .context-ring__dial {
    width: var(--chat-mobile-row-context-icon-size);
    height: var(--chat-mobile-row-context-icon-size);
    flex-basis: var(--chat-mobile-row-context-icon-size);
    color: inherit;
    opacity: var(--chat-mobile-row-muted-opacity);
  }

  .agent-chat__input--mobile-toolbar :is(.context-ring__track, .context-ring__fill) {
    stroke-width: var(--chat-mobile-row-icon-stroke);
  }

  /* Input selection remains a desktop affordance. Mobile gives the two voice
     jobs explicit controls instead: Mic dictates and the trailing action starts
     Talk, so a third disclosure target would only spend scarce row width. */
  .agent-chat__input--mobile-toolbar .chat-talk-input-picker {
    display: none;
  }

  .agent-chat__input--mobile-toolbar
    .agent-chat__composer-footer
    .chat-controls__provider-settings
    svg {
    width: 12px;
    height: 12px;
  }

  .agent-chat__input--mobile-toolbar
    .agent-chat__composer-footer
    :is(.chat-controls__permission-icon svg, .chat-controls__permission-lock svg) {
    width: var(--chat-mobile-row-muted-icon-size);
    height: var(--chat-mobile-row-muted-icon-size);
  }
}

@media (max-width: 640px) {
  .chat-controls__provider-toggle {
    min-height: 44px;
  }

  .agent-chat__composer-meta .chat-controls__permission-trigger {
    width: 44px;
    justify-content: center;
    padding-inline: 0;
  }

  .agent-chat__composer-meta
    .chat-controls__permission-trigger
    .chat-controls__inline-select-label {
    display: none;
  }

  .agent-chat__composer-controls {
    align-items: center;
    flex-direction: row;
  }
}

/* Welcome state (new session) */
.agent-chat__welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  width: min(100%, 640px);
  margin: auto;
  padding: clamp(20px, 4vh, 40px) 24px;
  flex: 1;
  min-height: 0;
}

.agent-chat__welcome h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.agent-chat__welcome-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.agent-chat__welcome-identity-copy {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.agent-chat__welcome-identity-copy > :is(h2, .agent-chat__hint) {
  margin: 0;
}

.agent-chat__welcome--setup .agent-chat__hint {
  max-width: 36ch;
  margin: 0 0 6px;
  line-height: 1.5;
}

.agent-chat__welcome-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

/* The 120x120 Clawd canvas stays centered in the existing hero slot. */
.agent-chat__welcome-clawd {
  width: 128px;
  height: 112px;
  margin-bottom: 2px;
  display: grid;
  place-items: center;
  overflow: visible;
}

/* Phones (and short landscape): scale the welcome hero down so the composer
   and recent chats fit the first screenful on the start screen and /new. */
@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .agent-chat__welcome {
    gap: 8px;
    padding: 16px 12px;
  }

  .agent-chat__welcome h2 {
    font-size: 20px;
  }

  .agent-chat__welcome-avatar {
    width: 64px;
    height: 64px;
  }

  .agent-chat__welcome-clawd {
    width: 88px;
    height: 77px;
  }

  .agent-chat__welcome-identity {
    gap: 12px;
  }

  .agent-chat__welcome-identity-copy {
    gap: 6px;
  }

  .agent-chat__welcome-clawd openclaw-mascot {
    width: 77px;
    height: 77px;
  }
}

/* Recent user chats replace the canned suggestions once any exist. */
.agent-chat__welcome-secondary {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
  transition:
    grid-template-rows 300ms var(--ease-out),
    opacity 240ms 40ms var(--ease-out),
    filter 240ms 40ms var(--ease-out),
    transform 240ms 40ms var(--ease-out);
}

.agent-chat__welcome-secondary-inner {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.agent-chat__welcome-secondary--hidden {
  grid-template-rows: minmax(0, 0fr);
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
  transform: translateY(4px);
  transition:
    grid-template-rows 360ms 160ms var(--ease-out),
    opacity 280ms var(--ease-out),
    filter 280ms var(--ease-out),
    transform 280ms var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat__welcome-secondary {
    transition: none;
  }
}

.agent-chat__recents {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: min(100%, 520px);
  margin-top: 12px;
  text-align: left;
}

.agent-chat__recents-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 2px 12px;
}

.agent-chat__recent {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  transition: background 0.15s;
}

.agent-chat__recent:hover {
  background: var(--bg-hover);
}

.agent-chat__recent-name {
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-chat__recent-sub {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-chat__recent-time {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.agent-chat__hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.agent-chat__hint kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 12px; /* was 11px */
  font-family: var(--mono);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.agent-chat__suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 480px);
  margin-top: 8px;
}

.agent-chat__suggestion {
  min-height: 40px;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  /* Localized labels wrap to multiple lines; balance keeps the split even and
     break-word stops long words from pushing past the chip border. */
  text-wrap: balance;
  overflow-wrap: break-word;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.agent-chat__suggestion:hover {
  background: var(--panel-strong);
  border-color: var(--accent);
}

/* Must stay after the base suggestion rules: equal specificity, so source
   order is what lets the phone layout win over the two-column default. */
@media (max-width: 768px) {
  .agent-chat__suggestions {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 360px);
  }

  .agent-chat__suggestion {
    min-height: 44px;
  }
}

/* ── composer-status.css ── */
/* Compaction indicator */
.compaction-indicator {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1.2;
  padding: 6px 14px;
  margin-bottom: 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  white-space: nowrap;
  user-select: none;
  animation: fade-in 0.2s var(--ease-out);
}

.compaction-indicator svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.chat-compaction {
  margin: var(--space-5) 8px;
}

.chat-compaction .chat-divider__label {
  gap: 10px;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.chat-compaction__glyph {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.chat-compaction__line {
  position: absolute;
  left: 1px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: var(--fold-opacity);
  transform: translate(3px, var(--fold-y)) scaleX(var(--fold-scale));
}

.chat-compaction__line:nth-child(1) {
  top: 3px;
  width: 26px;
  --fold-y: 6px;
  --fold-scale: 0.65;
  --fold-opacity: 0.85;
}

.chat-compaction__line:nth-child(2) {
  top: 8px;
  width: 20px;
  --fold-y: 1px;
  --fold-scale: 0.85;
  --fold-opacity: 0;
}

.chat-compaction__line:nth-child(3) {
  top: 13px;
  width: 24px;
  --fold-y: 0px;
  --fold-scale: 0.7;
  --fold-opacity: 1;
}

.chat-compaction__line:nth-child(4) {
  top: 18px;
  width: 16px;
  --fold-y: -1px;
  --fold-scale: 1.05;
  --fold-opacity: 0;
}

.chat-compaction__line:nth-child(5) {
  top: 23px;
  width: 22px;
  --fold-y: -6px;
  --fold-scale: 0.76;
  --fold-opacity: 0.85;
}

.chat-compaction__glyph svg {
  position: absolute;
  inset: 4px;
  width: 20px;
  height: 20px;
  color: var(--muted);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5px;
  opacity: 0;
  transform: scale(0.75);
}

.chat-compaction--complete .chat-compaction__line {
  visibility: hidden;
}

.chat-compaction--complete .chat-compaction__glyph svg {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .chat-compaction--active .chat-compaction__line {
    animation: compaction-fold 3.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  }

  .chat-compaction__glyph svg {
    transition:
      opacity 0.25s,
      transform 0.25s;
  }
}

@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  .chat-compaction--active .chat-divider__title {
    background: linear-gradient(105deg, var(--muted) 35%, var(--text) 48%, var(--muted) 61%);
    background-size: 260% 100%;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: compaction-shimmer 3.2s ease-in-out infinite;
  }
}

@keyframes compaction-fold {
  0%,
  12%,
  86%,
  100% {
    opacity: 0.38;
    transform: translate(0, 0) scaleX(1);
  }

  48%,
  70% {
    opacity: var(--fold-opacity);
    transform: translate(3px, var(--fold-y)) scaleX(var(--fold-scale));
  }
}

@keyframes compaction-shimmer {
  0%,
  12% {
    background-position: 100% 0;
  }

  78%,
  100% {
    background-position: 0 0;
  }
}

.compaction-indicator--fallback {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

.compaction-indicator--fallback-cleared {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
}

/* ── question-card.css ── */
.agent-chat__question-dock {
  position: relative;
  z-index: 1;
  min-width: 0;
}

openclaw-chat-question-panel {
  display: block;
}

.chat-question-panel {
  display: grid;
  gap: 12px;
  max-height: min(58vh, 36rem);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--chat-composer-hairline, var(--border));
  border-radius: calc(20px * var(--openclaw-corner-radius-scale));
  corner-shape: superellipse(1.5);
  background: var(--chat-composer-surface, var(--popover));
  box-shadow: none;
  color: var(--text);
  outline: none;
  animation: fade-in 0.16s var(--ease-out);
}

:root[data-theme="dark"] .chat-question-panel {
  border-color: color-mix(in srgb, var(--text-strong) 9%, transparent);
}

:root[data-theme="light"] .chat-question-panel {
  border-color: transparent;
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 6%),
    0 1px 2px -1px rgb(0 0 0 / 6%),
    0 2px 4px rgb(0 0 0 / 4%);
}

.chat-question-panel:focus-visible {
  border-color: var(--chat-composer-hairline, var(--border));
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

@supports (backdrop-filter: blur(1px)) {
  .chat-question-panel {
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
  }
}

.chat-question-panel--collapsed {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0;
  overflow: hidden;
}

.chat-question-panel__request-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--control-ui-text-sm);
  font-variant-numeric: tabular-nums;
}

.chat-question-panel__request-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: var(--cursor-action);
}

.chat-question-panel__request-nav button:hover,
.chat-question-panel__request-nav button:focus-visible {
  background: var(--panel-hover);
  color: var(--text);
  outline: none;
}

.chat-question-panel__request-nav svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.chat-question-panel__topline,
.chat-question-panel__footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-question-panel__title {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: var(--control-ui-text-sm);
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-question-panel__collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: var(--cursor-action);
}

.chat-question-panel__collapse:hover,
.chat-question-panel__collapse:focus-visible {
  background: var(--panel-hover);
  color: var(--text);
  outline: none;
}

.chat-question-panel__collapse svg,
.chat-question-panel__chevron svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.chat-question-panel__collapse svg {
  transform: rotate(180deg);
}

.chat-question-panel__heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.chat-question-panel__external {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--control-ui-text-sm);
}

.chat-question-panel__progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  margin-left: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--control-ui-text-sm);
  font-variant-numeric: tabular-nums;
}

.chat-question-panel__prompt {
  min-width: 0;
  color: var(--text-strong);
  font-size: var(--control-ui-text-md);
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.chat-question-panel__options {
  display: grid;
  gap: 7px;
}

.chat-question-panel__option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: calc(11px * var(--openclaw-corner-radius-scale));
  corner-shape: superellipse(1.5);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: var(--cursor-action);
}

.chat-question-panel__option:hover:not(:disabled) {
  border-color: var(--border);
  background: color-mix(in srgb, var(--text-strong) 7%, var(--panel));
  outline: none;
}

.chat-question-panel__option:focus-visible {
  border-color: var(--border);
  background: color-mix(in srgb, var(--text-strong) 7%, var(--panel));
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

.chat-question-panel__option:hover:not(:disabled) .chat-question-panel__option-copy strong {
  color: var(--text-strong);
}

.chat-question-panel__option:hover:not(:disabled) .chat-question-panel__option-marker {
  background: color-mix(in srgb, var(--text-strong) 5%, transparent);
  outline: none;
}

.chat-question-panel__option--selected {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: color-mix(in srgb, var(--accent-subtle) 55%, var(--panel));
}

.chat-question-panel__option:disabled {
  cursor: default;
  opacity: 0.7;
}

.chat-question-panel__option-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.chat-question-panel__option[role="radio"] .chat-question-panel__option-marker {
  border-radius: var(--radius-full);
}

.chat-question-panel__option--selected .chat-question-panel__option-marker {
  border-color: var(--accent);
}

.chat-question-panel__option-copy {
  display: block;
  min-width: 0;
}

.chat-question-panel__option-copy strong {
  display: block;
  font-size: var(--control-ui-text-sm);
  font-weight: 600;
  line-height: 1.35;
}

.chat-question-panel__option-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(var(--control-ui-text-sm) - 1px);
  line-height: 1.35;
}

.chat-question-panel__option kbd {
  min-width: 18px;
  color: var(--muted);
  font: 12px/1 var(--mono);
  text-align: center;
}

.chat-question-panel__store {
  display: grid;
  gap: 6px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  color: var(--muted);
  font-size: var(--control-ui-text-sm);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.chat-question-panel__store-entry {
  color: var(--text);
  font-weight: 600;
}

/* ClawChats: which use this masked prompt is for (web key vs local hand-off) */
.chat-question-panel__store-use {
  display: grid;
  gap: 2px;
  color: var(--text);
}

.chat-question-panel__store-use strong {
  font-weight: 600;
}

.chat-question-panel__store-hosts {
  display: grid;
  gap: 5px;
  margin-top: 2px;
}

.chat-question-panel__other {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.chat-question-panel textarea.chat-question-panel__textarea {
  /* Override the shared field textarea's tall, monospace editor defaults. */
  min-height: 24px;
  max-height: 160px;
  resize: none;
  font-family: inherit;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-question-panel__input-hint {
  margin-top: -6px;
  color: var(--muted);
  font-size: var(--control-ui-text-sm);
}

/*
 * The hosts field sits outside an option row, so it cannot borrow the row's
 * border/focus treatment; give it its own so the one field the operator is
 * meant to review does not read as static text.
 */
.chat-question-panel__hosts {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.chat-question-panel__hosts:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

.chat-question-panel__option--other:has(.chat-question-panel__other:focus-visible) {
  background: color-mix(in srgb, var(--text-strong) 7%, var(--panel));
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

.chat-question-panel__other::placeholder {
  color: var(--muted);
}

.chat-question-panel__footer {
  min-height: 30px;
  justify-content: flex-end;
}

.chat-question-panel__error {
  margin-right: auto;
  color: var(--danger);
  font-size: var(--control-ui-text-sm);
}

.chat-question-panel__error-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  vertical-align: middle;
  margin-left: 4px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: var(--cursor-action);
}

.chat-question-panel__error-dismiss svg {
  width: 14px;
  height: 14px;
}

.chat-question-panel__skip {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.chat-question-panel__back {
  margin-right: auto;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.chat-question-panel__back:hover:not(:disabled) {
  color: var(--text);
  background: var(--panel-hover);
}

.chat-question-panel__skip:hover:not(:disabled) {
  color: var(--text);
  background: var(--panel-hover);
}

.chat-question-panel__collapsed-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--control-ui-text-sm);
  font-weight: 600;
  text-align: left;
  cursor: var(--cursor-action);
}

.chat-question-panel__collapsed-button > :first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-question-panel__chevron {
  display: inline-flex;
  color: var(--muted);
}

.chat-question-summary {
  display: grid;
  gap: 3px;
  width: min(620px, 100%);
  margin: 4px 0;
  padding: 7px 10px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--panel) 62%, transparent);
  color: var(--muted);
  font-size: var(--control-ui-text-sm);
  line-height: 1.4;
}

.chat-question-summary__item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chat-question-summary__item + .chat-question-summary__item {
  margin-top: 8px;
}

.chat-question-summary__prompt {
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-question-summary__line {
  display: flex;
  gap: 5px;
  min-width: 0;
}

.chat-question-summary__line strong {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 600;
}

.chat-question-summary__line span {
  overflow-wrap: anywhere;
}

@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .chat-question-panel__collapsed-button {
    min-height: 48px;
  }
}

@media (max-width: 640px) {
  .chat-question-panel:not(.chat-question-panel--collapsed) {
    max-height: min(62vh, 32rem);
    padding: 12px;
  }

  .chat-question-panel__option {
    padding: 10px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-question-panel {
    animation: none;
  }
}

/* ── composer-queue.css ── */
.agent-chat__composer-shell {
  --chat-queue-divider: color-mix(in srgb, var(--text-strong) 6%, transparent);
  --chat-stack-header-height: 40px;
  --chat-stack-icon-size: 14px;
  --chat-stack-leading-inset: 13px;
  --chat-stack-trailing-control-size: 24px;
  --chat-stack-trailing-inset: 8px;
}

.chat-queue {
  --chat-queue-row-height: 42px;

  position: relative;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  margin-inline: 0;
  padding-bottom: 0;
  overflow: hidden;
  border: 1px solid var(--chat-composer-hairline);
  border-radius: calc(20px * var(--openclaw-corner-radius-scale));
  corner-shape: superellipse(1.5);
  background: var(--composer-attached-surface, var(--chat-composer-surface));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.chat-queue__scroll {
  --chat-queue-fade-in:
    transparent 2px, rgb(0 0 0 / 12%) 6px, rgb(0 0 0 / 50%) 12px, rgb(0 0 0 / 88%) 18px, black 24px;
  --chat-queue-fade-out:
    black calc(100% - 24px), rgb(0 0 0 / 88%) calc(100% - 18px), rgb(0 0 0 / 50%) calc(100% - 12px),
    rgb(0 0 0 / 12%) calc(100% - 6px), transparent calc(100% - 2px);

  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  scrollbar-color: color-mix(in srgb, var(--muted) 34%, transparent) transparent;
  scrollbar-width: thin;
}

.chat-queue__global-state {
  display: flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--chat-queue-divider);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.chat-queue__global-state[data-chat-queue-global-state="warn"] {
  color: var(--warn);
}

.chat-queue__scroll[data-scrollable="true"] {
  height: calc(3.55 * var(--chat-queue-row-height));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-queue__scroll[data-scrollable="true"][data-at-start="true"][data-at-end="false"] {
  mask-image: linear-gradient(to bottom, var(--chat-queue-fade-out));
}

.chat-queue__scroll[data-scrollable="true"][data-at-start="false"][data-at-end="true"] {
  mask-image: linear-gradient(to bottom, var(--chat-queue-fade-in));
}

.chat-queue__scroll[data-scrollable="true"][data-at-start="false"][data-at-end="false"] {
  mask-image: linear-gradient(to bottom, var(--chat-queue-fade-in), var(--chat-queue-fade-out));
}

.chat-queue__scroll::-webkit-scrollbar {
  width: 5px;
}

.chat-queue__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.chat-queue__scroll::-webkit-scrollbar-thumb {
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--muted) 34%, transparent);
}

.chat-queue__item {
  --chat-queue-row-surface: var(--composer-attached-surface, var(--chat-composer-surface));

  position: relative;
  display: grid;
  grid-template-columns: var(--chat-stack-icon-size) 20px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  min-height: var(--chat-queue-row-height);
  padding: 6px var(--chat-stack-trailing-inset) 6px var(--chat-stack-leading-inset);
  border-bottom: 1px solid var(--chat-queue-divider);
  background: var(--chat-queue-row-surface);
  color: var(--muted);
}

.chat-queue__item:last-child {
  border-bottom: 0;
}

.chat-queue__item--no-avatar {
  grid-template-columns: var(--chat-stack-icon-size) minmax(0, 1fr) auto;
}

.chat-queue__item--no-avatar .chat-queue__copy,
.chat-queue__item--no-avatar .chat-queue__edit-input {
  grid-column: 2;
}

.chat-queue__item--no-avatar .chat-queue__error,
.chat-queue__item--no-avatar .chat-queue__mentions {
  grid-column: 2 / -1;
}

.chat-queue__item--no-avatar .chat-queue__actions {
  grid-column: 3;
}

@media (hover: hover) and (pointer: fine) {
  .chat-queue__item:hover:not(.chat-queue__item--editing) {
    --chat-queue-row-surface: color-mix(
      in srgb,
      var(--text-strong) 3%,
      var(--composer-attached-surface, var(--chat-composer-surface))
    );
  }
}

.chat-queue__item--steered {
  --chat-queue-row-surface: var(--composer-attached-surface, var(--chat-composer-surface));
}

/* The edited row keeps its slot so the operator can see where the corrected
   message lands. The input owns focus, so the row itself stays neutral. */
.chat-queue__item--editing {
  --chat-queue-row-surface: color-mix(
    in srgb,
    var(--text-strong) 4%,
    var(--composer-attached-surface, var(--chat-composer-surface))
  );
}

/* Drop target reads as an insertion edge rather than a selected row, so the
   dragged message clearly lands at this position. */
.chat-queue__item--drop-target {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

/* The handle owns reordering for both input methods: drag it, or focus it and
   press the arrow keys. It stays a real button so keyboards can reach it. */
.chat-queue__grip {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  justify-content: center;
  width: 24px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: grab;
  grid-column: 1;
}

.chat-queue__grip:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

/* Still occupies the handle column so every row's pill and text share one x,
   and stays visible but dimmer than a live handle: this row is holding its
   place, not offering a drag. Hover leaves it alone for the same reason. */
.chat-queue__grip:disabled {
  cursor: default;
}

.chat-queue__grip-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-queue__grip-state--active {
  display: none;
}

.chat-queue__item:hover .chat-queue__grip:not(:disabled) .chat-queue__grip-state--idle,
.chat-queue__grip:is(:focus-visible, :active) .chat-queue__grip-state--idle {
  display: none;
}

.chat-queue__item:hover .chat-queue__grip:not(:disabled) .chat-queue__grip-state--active,
.chat-queue__grip:is(:focus-visible, :active) .chat-queue__grip-state--active {
  display: inline-flex;
}

.chat-queue__grip svg {
  width: 14px;
  height: 14px;
}

.chat-queue__grip .chat-queue__grip-state--active svg {
  width: 18px;
  height: 18px;
}

.chat-queue__item--failed {
  --chat-queue-row-surface: color-mix(
    in srgb,
    var(--danger) 8%,
    var(--composer-attached-surface, var(--chat-composer-surface))
  );
}

.chat-queue__leading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 28px;
  margin-inline: calc((var(--chat-stack-icon-size) - 24px) / 2);
  color: var(--muted);
  grid-column: 1;
}

.chat-queue__leading svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-queue__item--failed .chat-queue__leading {
  color: var(--danger);
}

.chat-queue__item--steered .chat-queue__leading {
  color: var(--accent);
}

.chat-queue__item > .chat-author-avatar {
  grid-column: 2;
}

.chat-queue__badge {
  padding: 1px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.chat-queue__badge--steered {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--muted);
}

.chat-queue__badge--reconnect {
  padding: 1px 4px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: color-mix(in srgb, var(--warn) 78%, var(--text-strong));
  line-height: 1.25;
}

.chat-queue__state {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.chat-queue__item--failed .chat-queue__badge {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.chat-queue__copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 6px;
  grid-column: 3;
  min-width: 0;
  padding-block: 3px;
}

.chat-queue__text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: var(--chat-text);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-queue__edit-input {
  box-sizing: border-box;
  grid-column: 3;
  min-width: 0;
  min-height: 26px;
  max-height: calc(5 * 1.4em + 10px);
  margin: -1px 0;
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--text-strong) 18%, transparent);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--chat-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  overflow-y: hidden;
  resize: none;
}

.chat-queue__edit-input:focus {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

/* Wraps onto its own flex line below the row (see renderChatQueueItem). */
.chat-queue__error,
.chat-queue__mentions {
  display: flex;
  align-items: center;
  gap: 6px;
  grid-column: 3 / -1;
  min-width: 0;
  padding: 0 0 2px;
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.35;
}

.chat-queue__mentions {
  color: var(--muted);
}

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

.chat-queue__actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  grid-column: 4;
  white-space: nowrap;
}

.chat-queue__action,
.chat-queue__retry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 7px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: var(--cursor-action);
}

.chat-queue__action svg,
.chat-queue__retry svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-queue__action:hover:not(:disabled),
.chat-queue__retry:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.chat-queue__steer {
  border-radius: var(--radius-full);
}

.chat-queue__steer:hover:not(:disabled) {
  background: transparent;
  color: color-mix(in srgb, var(--accent) 84%, var(--text));
}

.chat-queue__action:disabled {
  color: color-mix(in srgb, var(--muted) 48%, transparent);
  cursor: default;
}

.chat-queue__remove,
.chat-queue__more,
.chat-queue__edit-submit,
.chat-queue__edit-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: var(--cursor-action);
}

/* Inert instead of removed: an open edit keeps every action slot in place so the
   rows below it never shift while the operator retypes. */
.chat-queue__remove:disabled,
.chat-queue__more:disabled,
.chat-queue__edit-submit:disabled,
.chat-queue__edit-cancel:disabled {
  color: color-mix(in srgb, var(--muted) 34%, transparent);
  cursor: default;
}

.chat-queue__remove:hover:not(:disabled),
.chat-queue__more:hover:not(:disabled),
.chat-queue__edit-submit:hover:not(:disabled),
.chat-queue__edit-cancel:hover:not(:disabled) {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.chat-queue__remove svg,
.chat-queue__edit-submit svg,
.chat-queue__edit-cancel svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-queue__more svg {
  width: 15px;
  height: 15px;
}

.chat-queue__overflow > .cc-dd__menu {
  width: 132px;
  min-width: 132px;
}

.chat-queue__overflow .cc-item {
  width: 100%;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.chat-queue__overflow .cc-item span[slot="icon"] {
  display: inline-flex;
}

.chat-queue__overflow .cc-item svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 560px) {
  .chat-queue__item {
    grid-template-columns: var(--chat-stack-icon-size) 18px minmax(0, 1fr) auto;
    column-gap: 6px;
    padding-inline: var(--chat-stack-leading-inset) var(--chat-stack-trailing-inset);
  }

  .chat-queue__item--no-avatar {
    grid-template-columns: var(--chat-stack-icon-size) minmax(0, 1fr) auto;
  }

  .chat-queue__retry span {
    display: none;
  }

  .chat-queue__text {
    -webkit-line-clamp: 1;
  }
}

/* ── layout.css (context ring + usage popover) ── */
/* Context usage instrument - compact dial with an on-demand session readout. */
.context-usage {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  color: var(--ctx-color, var(--muted));
}

.context-usage details {
  display: inline-flex;
}

.context-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: var(--radius-full);
  color: inherit;
  list-style: none;
  user-select: none;
  animation: fade-in 0.2s var(--ease-out);
  transition:
    color 150ms ease-out,
    background 150ms ease-out;
}

.agent-chat__input .context-usage {
  color: var(--ctx-color, var(--chat-composer-secondary));
}

.context-ring::-webkit-details-marker {
  display: none;
}

.context-ring:hover,
.context-usage details[open] .context-ring {
  background: transparent;
}

.context-ring--warning {
  background: transparent;
  color: inherit;
}

.context-ring__dial {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.context-ring__track,
.context-ring__fill {
  fill: none;
  stroke-width: 2.5px;
}

.context-ring__track {
  stroke: color-mix(in srgb, currentColor 22%, transparent);
}

.context-ring__fill {
  stroke: currentColor;
  stroke-linecap: round;
}

.context-usage__popover {
  width: min(300px, calc(100vw - 42px));
  max-height: var(--auto-size-available-height, calc(100dvh - 16px));
  overflow-y: auto;
  padding: 14px;
  color: var(--popover-foreground);
  animation: fade-in 150ms var(--ease-out);
}

.context-usage__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.context-usage__title,
.context-usage__section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.context-usage__context-value {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.context-usage__bar {
  height: 5px;
  margin: 8px 0 10px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--muted) 22%, transparent);
}

.context-usage__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ctx-color, var(--accent));
  box-shadow: 0 0 12px color-mix(in srgb, var(--ctx-color, var(--accent)) 46%, transparent);
}

.context-usage__section-label {
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.context-usage__plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.context-usage__plan-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  transition: color 150ms ease-out;
}

.context-usage__plan-link:hover {
  color: var(--text);
}

.context-usage__plan-link svg {
  width: 12px;
  height: 12px;
}

.context-usage__plan-badge {
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
}

.context-usage__account {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-usage__limits {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 12px;
}

.context-usage__limit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.context-usage__limit-label {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-usage__limit-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.context-usage__limit-meta strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.context-usage__limit-bar {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--muted) 20%, transparent);
}

.context-usage__limit-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.context-usage__limit-bar span.context-usage__limit-fill--warn {
  background: var(--warn);
}

.context-usage__limit-bar span.context-usage__limit-fill--danger {
  background: var(--danger);
}

.context-usage__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  margin: 8px 0 0;
  font-size: 12px;
}

.context-usage__stats div {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

/* Trailing separator: on flex-wrap the dot stays at the end of the previous
   line instead of orphaned at the start of the next one. */
.context-usage__stats div:not(:last-child)::after {
  margin-left: 2px;
  color: var(--muted);
  content: "·";
}

.context-usage__stats dt {
  color: var(--muted);
}

.context-usage__stats dd {
  margin: 0;
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.context-usage__provenance {
  display: block;
  margin-top: 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-usage__provenance + .context-usage__provenance {
  margin-top: 3px;
}

.context-usage__provenance strong {
  color: var(--text);
  font-weight: 650;
}