/* ───────────── An agent's question ───────────── */
.question-card {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-width: var(--chat-max);
  margin: 1rem auto;
  padding: 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
}
.question-card.compact { margin: 0; box-shadow: none; }
.question-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.question-kicker { color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.question-progress { color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.question-tag {
  align-self: flex-start;
  padding: 0.0625rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
}
.question-text { margin: 0; font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: 1.4; color: var(--text); }
.question-options { display: flex; flex-direction: column; gap: 0.375rem; }
.question-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: var(--control-h-lg);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.question-option:hover:not(:disabled) { background: var(--bg-hover); }
.question-option:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.question-option.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.question-option:disabled { opacity: var(--disabled-opacity); cursor: default; }
.question-option kbd {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-2xs);
}
.question-option-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.question-option-label { font-size: var(--text-ui); font-weight: var(--weight-medium); }
.question-option-description { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.4; }
.question-mark { flex-shrink: 0; width: 0.875rem; height: 0.875rem; border: 1.5px solid var(--border-strong); }
.question-mark.radio { border-radius: var(--radius-full); }
.question-mark.check { border-radius: var(--radius-xs); }
.question-option.selected .question-mark { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--bg); }
.question-other { height: var(--control-h-md); }
.question-error { margin: 0; color: var(--red); font-size: var(--text-xs); }
.question-note { margin: 0; color: var(--text-muted); font-size: var(--text-xs); }
.question-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.question-decline { margin-right: auto; }
.quote-selection {
  position: fixed;
  z-index: var(--z-menu);
  transform: translateX(-50%);
  height: var(--control-h-sm);
  padding-inline: 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
}
.quote-selection:hover { background: var(--bg-hover); }
.quote-selection:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
/* ───────────── Timeline rail beside a long transcript ───────────── */
.main:has(> .timeline-rail) { position: relative; }
.timeline-rail {
  position: absolute;
  /* Clear of the transcript's own scrollbar. */
  right: calc(var(--app-scrollbar-width, 0.625rem) + 0.375rem);
  width: 0.625rem;
  z-index: var(--z-sticky);
  opacity: 0.8;
  transition: opacity var(--motion-fast) var(--motion-ease);
}
.timeline-rail:hover { opacity: 1; }
.timeline-rail-window {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--text) 9%, transparent);
  pointer-events: none;
}
.timeline-rail-mark {
  position: absolute;
  left: 0.125rem;
  right: 0.125rem;
  min-height: 2px;
  padding: 0;
  border: 0;
  border-top: 2px solid var(--bg);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--text) 42%, transparent);
  cursor: pointer;
}
.timeline-rail-mark:hover { background: var(--accent); }
@media (max-width: 47.99rem) { .timeline-rail { display: none; } }
@media (prefers-reduced-motion: reduce) { .timeline-rail { transition: none; } }
/* Jump to a prompt: a corner control over the conversation and its list. */
.prompt-jump {
  position: sticky;
  top: 0;
  z-index: 6;
  height: 0;
  display: flex;
  justify-content: flex-end;
  align-self: stretch;
}
.prompt-jump-trigger {
  margin-top: -0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-raised);
  color: var(--text-muted);
}
.prompt-jump-trigger:hover,
.prompt-jump-trigger[aria-expanded="true"] { color: var(--text); background: var(--bg-hover); }
.prompt-jump-panel {
  position: absolute;
  top: 1.6rem;
  right: 0;
  width: min(26rem, calc(100vw - 3rem));
  max-height: min(24rem, 60vh);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
}
.prompt-jump-panel input {
  height: 1.9rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-ui);
}
.prompt-jump-panel ul { list-style: none; margin: 0; padding: 0; overflow: auto; overscroll-behavior: contain; }
.prompt-jump-panel li {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-ui);
  cursor: pointer;
}
.prompt-jump-panel li[aria-selected="true"] { background: var(--bg-hover); color: var(--text); }
.prompt-jump-number { color: var(--text-faint); font-size: var(--text-xs); font-variant-numeric: tabular-nums; text-align: right; }
.prompt-jump-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-jump-empty { margin: 0; padding: 0.6rem 0.45rem; color: var(--text-muted); font-size: var(--text-ui); }
.prompt-jump-older { align-self: flex-start; font-size: var(--text-xs); }

/* A jumped-to turn is marked for a moment, then left alone. */
.turn-flash { border-radius: var(--radius-md); animation: turn-flash 1.6s ease-out; }
@keyframes turn-flash {
  0%, 35% { outline: 2px solid color-mix(in srgb, var(--text) 35%, transparent); outline-offset: 2px; }
  100% { outline: 2px solid transparent; outline-offset: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .turn-flash { animation: none; outline: 2px solid color-mix(in srgb, var(--text) 25%, transparent); outline-offset: 2px; }
}

/* In a pane too narrow for gutters, the column steps in so the trigger never sits on a message. */
.conversation:has(> .prompt-jump) > .thread { width: min(var(--chat-max), calc(100% - 4rem)); }
/* Plan / Act chip beside the agent and model picker. */
.turn-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  height: 1.75rem;
  padding: 0 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-ui);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}
.turn-mode-chip:hover { background: var(--bg-hover); color: var(--text); }
.turn-mode-chip:focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--ring-offset); }
.turn-mode-chip.is-plan {
  border-color: var(--border-strong);
  background: var(--surface-1);
  color: var(--text);
}
/* Asked, not enforced: the same chip, drawn with a dashed edge so it does not read as a guarantee. */
.turn-mode-chip.is-plan.is-asked { border-style: dashed; }
.turn-mode-chip[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.turn-mode-chip[aria-disabled="true"]:hover { background: transparent; color: var(--text-muted); }
/* On a narrow composer the chip keeps its icon, like the approvals chip; Plan or Act moves to its tooltip. */
@container composer (max-width: 28rem) {
  .turn-mode-chip { padding: 0 0.35rem; }
  .turn-mode-chip > span { display: none; }
}

/* Act on this plan / Keep planning, under the latest plan turn and in the task list. */
.plan-handoff {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  max-width: var(--chat-max);
  margin: 0.25rem auto 1rem;
}
.plan-handoff-label { color: var(--text-muted); font-size: var(--text-xs); margin-right: 0.25rem; }
.plan-handoff .plan-handoff-act { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.plan-handoff button.plan-handoff-act:hover:not(:disabled) { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); opacity: 0.88; }
.plan-handoff button:disabled { opacity: 0.5; cursor: default; }
.plan-handoff--compact {
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-top: 1px solid var(--border-color);
}

/* Use for Plan / Act, in each model picker row. */
.agent-model-row .model-mode-use {
  flex: 0 0 auto;
  align-self: center;
  padding: 0.2rem 0.4rem;
  font-size: var(--text-2xs);
  color: var(--text-faint);
  opacity: 0;
}
.agent-model-row:hover .model-mode-use,
.agent-model-row:focus-within .model-mode-use,
.agent-model-row .model-mode-use.is-chosen { opacity: 1; }
.agent-model-row .model-mode-use.is-chosen { color: var(--text); background: var(--bg-hover); box-shadow: inset 0 0 0 1px var(--border-strong); }
.agent-model-row .model-mode-use:focus-visible { opacity: 1; outline: var(--ring-width) solid var(--ring); outline-offset: -2px; }
.agent-model-row .model-favorite:disabled { opacity: 0.5; cursor: default; }

/* Settings › Agents › Plan mode. */
.plan-mode-models { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; width: 100%; }
.plan-mode-models li { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.plan-mode-models-agent { font-weight: 500; }
.plan-mode-models-mode { color: var(--text-muted); font-size: var(--text-xs); }
.plan-mode-models code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); }
.plan-mode-models-empty { margin: 0; font-size: var(--text-xs); }
.menu-select-search {
  position: sticky;
  top: -0.3rem;
  z-index: 1;
  margin: -0.3rem -0.3rem 0.2rem;
  padding: 0.35rem;
  background: inherit;
  border-bottom: 1px solid var(--border-color);
}
.menu-select-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--text);
  font-size: var(--text-ui);
}
.menu-select-search input:focus-visible { outline: var(--focus-ring); outline-offset: 0; }
.menu-select-empty { margin: 0; padding: 0.5rem 0.6rem; color: var(--text-muted); font-size: var(--text-ui); }
.menu-select-footer {
  margin: 0.25rem -0.3rem -0.3rem;
  padding: 0.5rem 0.9rem 0.55rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
}
.handoff-dialog { width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem); overflow: auto; }
.dialog .handoff-lede { margin: 0.25rem 0 1.1rem; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.45; }
.handoff-field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.handoff-label { color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.handoff-summary {
  min-height: 12rem;
  max-height: 50vh;
  resize: vertical;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.handoff-summary:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.handoff-hint { color: var(--text-muted); font-size: var(--text-sm); }
.handoff-error, .dialog p.handoff-error { margin: 0 0 0.5rem; color: var(--red); font-size: var(--text-sm); }
.dictation-btn.is-recording {
  background: color-mix(in srgb, var(--red) 16%, transparent);
  color: var(--red);
}
.dictation-btn.is-recording:hover { background: color-mix(in srgb, var(--red) 24%, transparent); color: var(--red); }
.dictation-btn.is-unavailable { opacity: 0.55; }
.composer.composer--resting .dictation-btn:not(.is-recording) { display: none; }

.dictation-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0 0 0.35rem;
  padding: 0.3rem 0.35rem 0.3rem 0.6rem;
  border-radius: var(--control-radius);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
}
.dictation-status.is-error { color: var(--text); background: color-mix(in srgb, var(--red) 10%, transparent); }
.dictation-message { min-width: 0; overflow-wrap: anywhere; }
.dictation-status:not(.is-error) .dictation-message { color: var(--text); }
.dictation-dot {
  width: 0.5rem;
  height: 0.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--text-faint);
}
.dictation-dot.is-live { background: var(--red); animation: dictation-pulse 1.4s ease-in-out infinite; }
@keyframes dictation-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dictation-dot.is-live { animation: none; } }
.dictation-level { display: inline-flex; align-items: center; gap: 2px; height: 0.75rem; }
.dictation-level i {
  width: 3px;
  border-radius: 1px;
  background: var(--text-faint);
  opacity: 0.4;
}
.dictation-level i:nth-child(1) { height: 30%; }
.dictation-level i:nth-child(2) { height: 55%; }
.dictation-level i:nth-child(3) { height: 80%; }
.dictation-level i:nth-child(4) { height: 100%; }
.dictation-level i.on { background: var(--text); opacity: 1; }
.dictation-clock { font-variant-numeric: tabular-nums; }
.dictation-status.is-ending .dictation-clock { color: var(--red); font-weight: 600; }
.dictation-actions { display: inline-flex; gap: 0.25rem; margin-left: auto; }
.dictation-status button.ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.45rem;
  font-size: var(--text-xs);
}
.dictation-status kbd { font-family: inherit; color: var(--text-faint); }
.dictation-dismiss { width: 1.5rem; height: 1.5rem; }
.dictation-status.is-error .dictation-message { flex: 1 1 12rem; }
.composer-field[readonly] { caret-color: transparent; }
/* The status line sits at the end of the workspace strip under the composer and gives way to it. */
.status-line {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  margin-left: auto;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: var(--text-2xs);
  line-height: 1.35;
  text-align: right;
}
.status-line-row {
  display: block;
  overflow: hidden;
  white-space: pre;
  text-overflow: ellipsis;
}
.status-line[data-mode="items"] .status-line-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  white-space: nowrap;
}
.status-line-part {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-line-part + .status-line-part::before {
  content: "·";
  margin-right: 0.6rem;
  color: var(--text-faint);
}
.status-line-part[data-tone="warn"] { color: var(--yellow); }
.status-line-part[data-tone="critical"] { color: var(--red); }
.status-line[data-failed="true"] .status-line-row { opacity: 0.5; }
.status-line-failed { color: var(--text-faint); font-style: italic; }

.status-line-seg[data-fg="red"] { color: var(--red); }
.status-line-seg[data-fg="green"] { color: var(--green); }
.status-line-seg[data-fg="yellow"] { color: var(--yellow); }
.status-line-seg[data-fg="blue"] { color: var(--blue); }
.status-line-seg[data-fg="cyan"] { color: color-mix(in srgb, var(--blue) 55%, var(--green)); }
.status-line-seg[data-fg="magenta"] { color: color-mix(in srgb, var(--red) 55%, var(--blue)); }
.status-line-seg[data-fg="white"] { color: var(--text); }
.status-line-seg[data-fg="black"] { color: var(--text-faint); }
.status-line-seg[data-bg] { border-radius: 0.2rem; padding: 0 0.15rem; }
.status-line-seg[data-bg="red"] { background: color-mix(in srgb, var(--red) 22%, transparent); }
.status-line-seg[data-bg="green"] { background: color-mix(in srgb, var(--green) 22%, transparent); }
.status-line-seg[data-bg="yellow"] { background: color-mix(in srgb, var(--yellow) 22%, transparent); }
.status-line-seg[data-bg="blue"] { background: color-mix(in srgb, var(--blue) 22%, transparent); }
.status-line-seg[data-bg="cyan"], .status-line-seg[data-bg="magenta"], .status-line-seg[data-bg="white"], .status-line-seg[data-bg="black"] {
  background: color-mix(in srgb, var(--text) 12%, transparent);
}

/* Narrow: one line, the rest in the tooltip. */
@media (max-width: 1000px) {
  .status-line .status-line-row + .status-line-row { display: none; }
}

/* Settings → Appearance → Status line. */
.status-line-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.25rem 1rem;
  margin: 0.4rem 0 0.75rem;
  padding: 0;
  list-style: none;
}
.status-line-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.8rem;
  font-size: var(--text-sm);
}
.status-line-items label { display: inline-flex; align-items: center; gap: 0.45rem; }
.status-line-move { display: inline-flex; gap: 0.15rem; }
.status-line-move .icon-btn { width: 1.4rem; height: 1.4rem; font-size: var(--text-xs); }
.status-line-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
}
.status-line-preview .status-line { margin-left: auto; }
.status-line-preview-live { display: flex; flex: 1; min-width: 0; }
.status-line-command {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.status-line-command input[type="text"] { flex: 1; min-width: 0; font-family: var(--mono); }
.status-line-command input[type="number"] { width: 7rem; }
/* Apply to local: the details row, its toast, and the conflict dialog. */
.apply-local { display: flex; flex-direction: column; gap: 0.15rem; }
.apply-local .session-details-action:disabled { color: var(--text-faint); }
.apply-local .session-details-action:disabled:hover { background: transparent; }
.apply-local .session-details-action:disabled > svg:first-child { color: var(--text-faint); }
.apply-local-count { flex: 0 0 auto !important; color: var(--text-faint); font-size: var(--text-xs); }
.apply-local-reason {
  margin: 0 0 0.2rem calc(14px + 0.55rem);
  color: var(--text-faint); font-size: var(--text-xs); line-height: 1.35;
}
.apply-local-last {
  display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.2rem;
  color: var(--text-muted); font-size: var(--text-xs);
}
.apply-local-last > svg { flex-shrink: 0; color: var(--green, var(--text-muted)); }
.apply-local-last > svg.warn { color: var(--text-muted); }
.apply-local-last > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apply-local-last .link-btn {
  padding: 0 0.25rem; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.apply-local-last .link-btn:hover { background: var(--bg-hover); }
.apply-local-last .link-btn:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.apply-local-last .link-btn:disabled { color: var(--text-faint); cursor: default; }

.apply-toast {
  position: fixed; z-index: var(--z-toast); bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.5rem; max-width: min(36rem, calc(100vw - 2rem));
  padding: 0.5rem 0.5rem 0.5rem 0.75rem; border: 1px solid var(--border-color); border-radius: var(--control-radius);
  background: var(--bg-elevated); box-shadow: var(--shadow-raised); color: var(--text);
  font-size: var(--text-ui);
}
.apply-toast > svg { flex-shrink: 0; color: var(--text-muted); }
.apply-toast > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apply-toast > button { flex-shrink: 0; }
.apply-toast > button[data-undo] { color: var(--text); font-weight: 500; }
.apply-toast > button[data-undo]:disabled { color: var(--text-faint); }
.apply-toast.error > svg { color: var(--red); }
.apply-toast.error > span { white-space: normal; overflow-wrap: anywhere; }

.dialog.apply-conflicts h3 { display: flex; align-items: center; gap: 0.5rem; }
.dialog.apply-conflicts h3 > svg { flex-shrink: 0; color: var(--text-muted); }
.apply-conflicts-files {
  margin: 0.75rem 0 0; padding: 0.4rem 0; max-height: 12rem; overflow: auto; list-style: none;
  border: 1px solid var(--border-color); border-radius: var(--radius-md); background: color-mix(in srgb, var(--text) 3%, transparent);
}
.apply-conflicts-files li {
  padding: 0.2rem 0.75rem; font-size: var(--text-xs); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left;
}
.dialog p.apply-conflicts-error { margin-top: 0.6rem; color: var(--red); overflow-wrap: anywhere; }
.dialog.apply-conflicts .actions { flex-wrap: wrap; margin-top: 1rem; }
/* Best-of-N: the composer's Run on… control, the Compare surface, the sidebar group row, ratings and Your results. */

/* --- Run on… in the composer's context row --- */
.run-on { display: inline-flex; align-items: center; gap: 0.15rem; min-width: 0; }
.composer-context .run-on-trigger { gap: 0.3rem; }
.composer-context .run-on-trigger.active { color: var(--text); font-weight: var(--weight-medium); }
.composer-context .run-on-trigger:focus-visible,
.composer-context .run-on-clear:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); border-radius: var(--radius-xs); }
.composer-context .run-on-clear { display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: var(--radius-xs); color: var(--text-faint); }
.composer-context .run-on-clear:hover { background: var(--bg-hover); color: var(--text); }

.run-on-summary { display: inline-flex; align-items: center; gap: 0.3rem; height: var(--control-h-sm); padding: 0 0.5rem; color: var(--text); font-size: var(--text-ui); }
.run-on-summary > span { margin-left: 0.15rem; color: var(--text-muted); }

.run-on-picker {
  z-index: var(--z-menu); display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-elevated); color: var(--text); font-size: var(--text-ui);
  border: 1px solid var(--border-strong); border-radius: var(--popover-radius); box-shadow: var(--shadow-raised);
}
.run-on-picker > header { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.5rem 0.5rem 0.75rem; border-bottom: 1px solid var(--border-color); }
.run-on-picker > header strong { flex: 1; font-weight: var(--weight-semibold); }
.run-on-picker > header .faint { font-size: var(--text-xs); }
.run-on-picker > footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.5rem 0.5rem 0.75rem; border-top: 1px solid var(--border-color); }
.run-on-picker .link-btn { padding: 0; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: var(--text-xs); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.run-on-picker .link-btn:hover { color: var(--text); }
.run-on-picker button:focus-visible, .run-on-picker input:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }

.run-on-picks { display: grid; gap: 0.25rem; padding: 0.5rem; border-bottom: 1px solid var(--border-color); background: color-mix(in srgb, var(--text) 3%, transparent); }
.run-on-empty { margin: 0; padding: 0.25rem; color: var(--text-muted); font-size: var(--text-xs); line-height: 1.45; }
.run-on-pick { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 9rem) auto; align-items: center; gap: 0.5rem; padding: 0.25rem 0.25rem 0.25rem 0.375rem; border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--border-color); }
.run-on-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-on-pick-name small, .run-on-agent-name small { display: block; color: var(--text-muted); font-size: var(--text-2xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-on-pick input {
  min-width: 0; height: var(--control-h-xs); padding: 0 0.375rem; border: 1px solid var(--border-color); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text); font: inherit; font-size: var(--text-xs);
}
.run-on-pick input::placeholder { color: var(--text-faint); }

.run-on-agents { display: grid; gap: 0.125rem; padding: 0.375rem; overflow: auto; min-height: 0; }
.run-on-agent {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.625rem; width: 100%;
  padding: 0.4rem 0.5rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; font: inherit;
}
.run-on-agent > svg { color: var(--text-muted); }
.run-on-agent:hover:not(:disabled) { background: var(--bg-hover); }
.run-on-agent:disabled { color: var(--text-faint); cursor: default; }
.run-on-agent:disabled small { color: var(--text-faint); }
.run-on-agent-name { min-width: 0; }

/* --- Compare surface --- */
.compare-pane { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.75rem; min-width: 0; overflow-x: hidden; font-size: var(--text-ui); }
.compare-empty { align-items: flex-start; color: var(--text-muted); }
.compare-empty p { margin: 0; line-height: 1.5; }
.compare-empty > svg { color: var(--red); }
.compare-summary { display: grid; gap: 0.5rem; }
.compare-prompt {
  margin: 0; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.compare-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.compare-summary-meta { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--text-muted); font-size: var(--text-xs); }
.compare-mode { display: inline-flex; padding: 0.125rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-sunken); }
.compare-mode button { padding: 0.15rem 0.6rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font: inherit; font-size: var(--text-xs); }
.compare-mode button.active { background: var(--bg-elevated); color: var(--text); box-shadow: 0 0 0 1px var(--border-color); }
.compare-mode button:hover:not(.active) { color: var(--text); }
.compare-mode button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.compare-decided {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.5rem 0.625rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-sunken);
  color: var(--text-muted); font-size: var(--text-xs); line-height: 1.4;
}
.compare-decided .chip { display: inline-flex; align-items: center; gap: 0.3rem; }

.compare-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 0.625rem; align-items: start; }
.compare-card {
  display: grid; gap: 0.625rem; min-width: 0; padding: 0.75rem;
  border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-elevated);
}
.compare-card.kept { border-color: color-mix(in srgb, var(--green) 55%, var(--border-color)); }
.compare-card.set-aside { background: transparent; border-style: dashed; }
.compare-card.set-aside .compare-card-head, .compare-card.set-aside .compare-facts, .compare-card.set-aside .compare-reply { opacity: 0.7; }
.skeleton-card { min-height: 9rem; align-content: start; }
.compare-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
.compare-card-name { display: grid; min-width: 0; }
.compare-card-name strong { font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-card-name small { color: var(--text-muted); font-size: var(--text-2xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.45rem; border-radius: var(--radius-full);
  border: 1px solid var(--border-color); color: var(--text-muted); font-size: var(--text-2xs); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.compare-badge.kept { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.compare-badge.phase-failed { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.compare-badge.phase-needs-you { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 45%, transparent); }
.compare-badge.phase-done { color: var(--text); }
.compare-badge .dot { width: 6px; height: 6px; }

.compare-facts { display: grid; gap: 0.25rem; margin: 0; }
.compare-facts > div { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.5rem; font-size: var(--text-xs); }
.compare-facts dt { color: var(--text-faint); }
.compare-facts dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; }
.compare-facts .added { color: var(--green); }
.compare-facts .removed { color: var(--red); }

.compare-reply {
  margin: 0; padding: 0.5rem 0.625rem; border-radius: var(--radius-md); background: var(--surface-sunken);
  color: var(--text-muted); font-size: var(--text-xs); line-height: 1.5; overflow-wrap: anywhere;
}
/* Clamped inside the padded box, so the cut never shows half a line in the padding. */
.compare-reply-text { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.compare-reply.error { display: flex; gap: 0.4rem; align-items: flex-start; color: var(--red); background: color-mix(in srgb, var(--red) 7%, transparent); }
.compare-reply.error > svg { flex-shrink: 0; margin-top: 0.15rem; }

.compare-card-actions { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.compare-card-actions .ghost { display: inline-flex; align-items: center; gap: 0.3rem; font-size: var(--text-xs); }
.compare-card-actions .compare-primary { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--text-xs); }
.compare-card-actions .send.compare-primary:disabled { opacity: var(--disabled-opacity); cursor: default; }
.compare-keep-reason { margin: -0.25rem 0 0; color: var(--text-faint); font-size: var(--text-2xs); text-align: right; }

.compare-same-file { display: grid; gap: 0.625rem; min-width: 0; }
.compare-file-pick { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-xs); color: var(--text-muted); }
.compare-file-pick select {
  flex: 1; min-width: 0; height: var(--control-h-sm); padding: 0 0.375rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text); font: inherit; font-family: var(--mono); font-size: var(--text-xs);
}
.compare-file-pick select:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.compare-grid.same-file { grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); }
.compare-file-column { display: grid; gap: 0.375rem; min-width: 0; align-content: start; }
.compare-file-column h4 { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.compare-file-column h4 small { color: var(--text-muted); font-weight: var(--weight-regular); }
.compare-file-column .faint { margin: 0; font-size: var(--text-xs); }
.compare-empty-inline { margin: 0; color: var(--text-muted); font-size: var(--text-xs); }

/* --- Ratings --- */
.rating-buttons { display: inline-flex; align-items: center; gap: 0.125rem; }
.rating-buttons .icon-btn { color: var(--text-faint); }
.rating-buttons .icon-btn:hover:not(:disabled) { color: var(--text); }
.rating-buttons .icon-btn.active { color: var(--text); background: var(--bg-active); }
.rating-buttons .icon-btn:disabled { cursor: default; }
.turn-rating { display: flex; justify-content: flex-start; margin: -0.5rem 0 0.75rem; }

/* --- Sidebar: one row per comparison --- */
.thread-group-status { color: var(--text-faint); font-size: var(--text-2xs); font-weight: var(--weight-regular); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-group-agents { display: inline-flex; align-items: center; gap: 0.1rem; }
.thread-group-members { position: relative; margin-left: 0.75rem; padding-left: 0.25rem; border-left: 1px solid var(--border-color); }

/* --- Your results --- */
.results-leaderboard h3 { margin: 0; }
.results-leaderboard > .faint { margin: 0.25rem 0 0.75rem; font-size: var(--text-xs); }
.results-leaderboard-empty, .results-leaderboard-error { margin: 0; color: var(--text-muted); font-size: var(--text-xs); line-height: 1.5; }
.results-leaderboard-error { color: var(--red); }
.results-leaderboard-loading { display: grid; gap: 0.4rem; }
.results-leaderboard table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.results-leaderboard th, .results-leaderboard td { padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--border-color); text-align: right; }
.results-leaderboard thead th { color: var(--text-faint); font-weight: var(--weight-medium); }
.results-leaderboard th[scope="row"], .results-leaderboard thead th:first-child { text-align: left; font-weight: var(--weight-regular); }
.results-leaderboard tbody tr:last-child > * { border-bottom: 0; }
.results-leaderboard-agent { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.results-leaderboard-agent small { color: var(--text-muted); }
/* Pull request state on a worktree thread's sidebar row. */
.thread-pr {
  display: inline-flex;
  align-items: center;
  flex: none;
  color: var(--text-faint);
}
.thread-pr.open { color: var(--green); }
.thread-pr.failing { color: var(--red); }
.thread-pr.merged { color: var(--markdown-note); }
.thread-pr.draft,
.thread-pr.closed { color: var(--text-faint); }
.thread-status.paused { color: var(--text-muted); }

/* New conversation and, beside it, the other ways to start one. */
.sidebar-new-row {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  order: -1;
  width: 100%;
}
.sidebar-new-row .sidebar-new { flex: 1; width: auto; order: 0; }
.sidebar-new-more { flex: none; opacity: 0; color: var(--text-muted); }
.sidebar-new-row:hover .sidebar-new-more,
.sidebar-new-more:focus-visible,
.sidebar-new-more[data-open="true"] { opacity: 1; }

/* Temporary threads: a word in the row, a strip above the composer. */
.thread-title-line { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.thread-temporary {
  flex: none;
  padding: 0 0.3rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-3xs);
  font-weight: 600;
  line-height: 1.5;
}
.temporary-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.6rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.temporary-banner strong { color: var(--text); font-weight: 600; }
.temporary-banner .chip { margin-left: auto; flex: none; }

/* Tags: chips plus one field, in Conversation details and the Tags dialog. */
.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
  padding: 0.1rem 0.2rem 0.1rem 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--surface-1);
  color: var(--text);
  font-size: var(--text-xs);
  line-height: 1.4;
}
.tag-editor[data-disabled="true"] .tag-chip { padding-right: 0.45rem; }
.tag-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-editor .tag-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.tag-editor .tag-chip-remove:hover { background: var(--bg-hover); color: var(--text); }
.tag-chip-remove:focus-visible,
.tag-editor-input:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.tag-editor-input {
  flex: 1 1 6rem;
  min-width: 6rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--text-xs);
}
.tag-editor-input:hover { border-color: var(--border-color); }
.tags-dialog { width: min(28rem, calc(100vw - 2rem)); }
.tags-dialog .tags-dialog-lede { margin: 0.25rem 0 0.9rem; color: var(--text-muted); font-size: var(--text-sm); }
.tags-dialog .tag-editor {
  padding: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
}
.session-details-tags { display: grid; gap: 0.35rem; }
.tags-settings-list { display: grid; gap: 0.35rem; margin: 0.6rem 0 0; padding: 0; list-style: none; }
.tags-settings-row { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.tags-settings-count { font-size: var(--text-xs); white-space: nowrap; }
.tags-settings-actions { display: inline-flex; gap: 0.3rem; margin-left: auto; }
.tags-settings-input {
  min-width: 0;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  color: var(--text);
  font-size: var(--text-xs);
}
.tags-settings-error { margin: 0.5rem 0 0; color: var(--red); font-size: var(--text-sm); }
.tags-settings .chip.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.tag-editor .tag-chip-remove { min-height: 0; flex: none; }
.tag-editor .tag-chip-remove svg { flex: none; width: 0.625rem; height: 0.625rem; }
.tags-settings-row { display: grid; grid-template-columns: minmax(6rem, max-content) auto 1fr; }
/*
 * The agent cannot take a turn yet. A quiet line on the composer's own
 * surface, not a tinted slab: a small amber mark carries the warning, the
 * title says what is wrong, and the command is set as code, never in backticks.
 */
.agent-setup {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.15rem 0 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  font-size: var(--text-xs);
  line-height: 1.4;
}
.agent-setup-mark {
  flex-shrink: 0;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: var(--radius-full);
  background: var(--yellow);
}
.agent-setup[data-kind="config"] .agent-setup-mark { background: var(--red); }
.agent-setup-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.45rem;
  row-gap: 0.1rem;
  color: var(--text-muted);
}
.agent-setup-text > strong { color: var(--text); font-weight: var(--weight-medium); }
.agent-setup-text > span { min-width: 0; overflow-wrap: anywhere; }
.agent-setup-text code {
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-xs);
  background: var(--bg-active);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95em;
}
.agent-setup-status { color: var(--text-faint); }
.agent-setup-error { color: var(--red); }
.agent-setup-actions { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.agent-setup-actions :is(.chip, .ghost) { height: 1.65rem; padding: 0 0.55rem; font-size: var(--text-xs); }
.agent-setup-actions .ghost { border-color: transparent; }
.agent-setup-actions .chip { color: var(--text); }
.agent-setup-actions svg.spinning { animation: agent-setup-spin 0.9s linear infinite; }
@keyframes agent-setup-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .agent-setup-actions svg.spinning { animation: none; } }

/* A narrow composer stacks the actions under the words instead of squeezing them. */
@container composer (max-width: 30rem) {
  .agent-setup { flex-wrap: wrap; }
  .agent-setup-actions { margin-left: 1rem; }
}
.composer.composer--resting .agent-setup { display: none; }
.worktree-base-slot { display: inline-flex; align-items: center; gap: 0.2rem; min-width: 0; }
.worktree-base-from { color: var(--text-faint); font-size: var(--text-xs); }

.pr-checkout-title { margin: 0 0 1rem; color: var(--text-muted); font-size: var(--text-ui); overflow-wrap: anywhere; }
.pr-checkout-targets { display: grid; gap: 0.5rem; margin: 0; padding: 0; border: 0; }
.pr-checkout-targets legend { margin-bottom: 0.4rem; padding: 0; color: var(--text-muted); font-size: var(--text-xs); }
.pr-checkout-targets label { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.7rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); cursor: pointer; }
.pr-checkout-targets label.active { border-color: var(--border-strong); background: var(--bg-hover); }
.pr-checkout-targets input { margin: 0.2rem 0 0; accent-color: var(--text); }
.pr-checkout-targets span { display: grid; gap: 0.15rem; }
.pr-checkout-targets b { font-size: var(--text-ui); font-weight: 500; }
.pr-checkout-targets small { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.4; }
.pr-checkout-note { margin: 0.8rem 0 0; color: var(--text-faint); font-size: var(--text-xs); }

.pr-row-wrap { position: relative; }
.pr-row-wrap .pr-row-work {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  opacity: 0;
  background: var(--surface-0);
}
.pr-row-wrap:hover .pr-row-work,
.pr-row-wrap:focus-within .pr-row-work { opacity: 1; }
/* Group headings in the composer's suggestion menu, and the Commands card in Settings. */
.suggest-group {
  padding: 0.45rem 0.5rem 0.2rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.suggest-group:not(:first-child) {
  margin-top: 0.2rem;
  border-top: 1px solid var(--border-color);
}

.commands-card code,
.commands-card pre {
  font-family: var(--mono);
  font-size: var(--text-xs);
}
.commands-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0 0.4rem;
}
.commands-card-error {
  color: var(--red);
  font-size: var(--text-ui);
}
.commands-card-empty {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: var(--text-ui);
}
.commands-card-empty pre {
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}
.commands-card-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.commands-card-list li {
  padding: 0.55rem 0;
  border-top: 1px solid var(--border-color);
  min-width: 0;
}
.commands-card-list li:first-child {
  border-top: 0;
}
.commands-card-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  font-size: var(--text-ui);
}
.commands-card-row > .faint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.commands-card-tags {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
  flex-shrink: 0;
}
.commands-card-tags .suggest-badge {
  max-width: none;
  color: var(--text-muted);
}
.commands-card-tags .commands-card-waiting {
  color: var(--yellow);
  border-color: color-mix(in srgb, var(--yellow) 45%, transparent);
}
.commands-card-description {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-ui);
}
.commands-card-path {
  margin: 0.15rem 0 0;
  /* Cut a long path at its start, so the file name is what stays. */
  direction: rtl;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: var(--text-2xs);
}
.commands-card-problems {
  margin-top: 0.5rem;
}
.commands-card-problems ul {
  margin: 0;
  padding: 0 0.75rem 0.4rem;
  list-style: none;
}
.commands-card-problems li {
  display: grid;
  gap: 0.1rem;
  padding: 0.35rem 0;
  font-size: var(--text-ui);
  min-width: 0;
}
.commands-card-subhead {
  margin: 0.9rem 0 0.2rem;
  font-size: var(--text-ui);
  color: var(--text-muted);
  font-weight: 600;
}
/* Composer context: chips for attached conversations, diffs, pages and output, and the pickers that make them. */
/* The preview anchors to the attachment row, not the chip, so it stays inside the dock at any width. */
.composer-context-chip {
  position: static;
  max-width: 20rem;
  padding-left: 0.2rem;
}
.composer-context-chip > .composer-context-open {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  width: auto;
  height: auto;
  padding: 0.05rem 0.25rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
}
.composer-context-chip > .composer-context-open:hover,
.composer-context-chip > .composer-context-open[aria-expanded="true"] {
  background: var(--bg-active);
  color: var(--text);
}
.composer-context-chip > .composer-context-open:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 1px;
}
.composer-context-chip > svg,
.composer-context-open > svg { flex-shrink: 0; }
.composer-context-kind {
  flex-shrink: 0;
  color: var(--text-faint);
}
.composer-context-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.composer-context-chip.is-loading,
.composer-context-chip.is-error {
  padding-left: 0.45rem;
}
.composer-context-chip.is-loading .composer-context-label { color: var(--text-muted); }
.composer-context-chip.is-error {
  max-width: 28rem;
  border-color: color-mix(in srgb, var(--red) 40%, var(--border-color));
  background: color-mix(in srgb, var(--red) 8%, var(--bg-hover));
  color: var(--red);
}
.composer-context-chip.is-error .composer-context-label { color: var(--text); white-space: normal; }
.composer-context-chip > .composer-context-action {
  width: auto;
  height: auto;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
  white-space: nowrap;
}
.composer-context-spinner {
  flex-shrink: 0;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--text) 20%, transparent);
  border-top-color: var(--text-muted);
  animation: composer-context-spin 0.8s linear infinite;
}
@keyframes composer-context-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .composer-context-spinner { animation-duration: 2.4s; } }

.composer-context-preview {
  position: absolute;
  z-index: 9;
  left: 0;
  bottom: calc(100% + 0.4rem);
  width: min(30rem, 100%);
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--surface-0);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: auto;
}
.composer-context-preview-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem 0.35rem;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-ui);
  font-weight: 600;
}
.composer-context-preview-head small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-weight: 400;
  font-size: var(--text-2xs);
}
.composer-context-preview pre {
  margin: 0;
  max-height: 14rem;
  overflow: auto;
  padding: 0.5rem 0.65rem;
  font-family: var(--mono);
  font-size: var(--text-2xs);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-muted);
}
.composer-context-preview-foot {
  padding: 0.3rem 0.65rem 0.45rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-faint);
  font-size: var(--text-2xs);
}

.composer-context-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.4rem;
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--text);
}

.composer-template-description {
  margin: 0 0.4rem 0.35rem;
  color: var(--text-muted);
  font-size: var(--text-ui);
}
.composer-template-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.5rem;
  padding: 0.25rem 0.4rem;
}
.composer-template-fields label {
  display: grid;
  gap: 0.25rem;
  font-size: var(--text-2xs);
  color: var(--text-muted);
}
.composer-template-fields label > span { font-family: var(--mono); }
.composer-context-picker .composer-template-fields input,
.composer-template-fields select {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  font-size: var(--text-sm);
}
.composer-template-error {
  margin: 0.25rem 0.4rem 0;
  color: var(--red);
  font-size: var(--text-ui);
}
.composer-template-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 0.5rem 0.4rem 0.15rem;
}

.composer-bang-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--text-2xs);
}
.composer-bang-hint code {
  font-family: var(--mono);
  color: var(--text);
}

/* Settings › General › Saved prompts. */
.saved-prompt-row { gap: 0.75rem; }
.saved-prompt-copy { display: flex; min-width: 0; flex: 1; gap: 0.6rem; align-items: baseline; }
.saved-prompt-copy > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-ui); }
.saved-prompt-form { display: grid; gap: 0.6rem; margin-top: 0.5rem; padding-top: 0.6rem; border-top: 1px solid var(--border-color); }
.saved-prompt-form label { display: grid; gap: 0.3rem; font-size: var(--text-ui); color: var(--text-muted); }
.saved-prompt-form textarea { font-family: var(--mono); font-size: var(--text-sm); }
/* Floats over the terminal next to a selection; the pane box positions it. */
.terminal-add-to-chat {
  position: absolute;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0.3rem 0.22rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: var(--text-xs);
  white-space: nowrap;
  cursor: pointer;
}
.terminal-add-to-chat:hover {
  background: var(--bg-hover);
}
.terminal-add-to-chat:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.terminal-add-to-chat kbd {
  padding: 0.05rem 0.3rem;
  border-radius: calc(var(--control-radius) - 2px);
  background: var(--bg-active);
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-3xs);
}

.terminal-link-hint {
  position: absolute;
  z-index: 5;
  max-width: 18.5rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.35;
  pointer-events: none;
}
/* Settings files in the interface: provenance, Save to, the doctor and the notices. */

.setting-source {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.4rem;
  vertical-align: 0.05em;
}
.setting-source-chip {
  display: inline-flex;
  align-items: center;
  height: 1.05rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text-muted);
  font-size: var(--text-3xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.setting-source-chip[data-layer="project"],
.setting-source-chip[data-layer="local"],
.setting-source-chip[data-layer="legacy"],
.setting-source-chip[data-layer="plugin"] {
  border-color: color-mix(in srgb, var(--text) 22%, transparent);
  color: var(--text);
}
.setting-source-chip.is-quiet {
  border-style: dashed;
  background: transparent;
  color: var(--text-faint);
}
button.setting-source-chip { cursor: pointer; }
button.setting-source-chip:hover { border-color: var(--border-strong); color: var(--text); }
.setting-source-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0.55;
}
.setting:hover .setting-source-reset,
.card h3:hover .setting-source-reset,
.setting-source-reset:focus-visible { opacity: 1; }
.setting-source-reset:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
:is(button.setting-source-chip, .setting-source-reset):focus-visible { outline: var(--focus-ring); outline-offset: 1px; }

.settings-crumb-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}
.settings-error { width: 100%; max-width: none; margin: 0 0 0.65rem; }

.save-to {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  margin: -0.25rem 0 0.75rem;
  font-size: var(--text-xs);
}
.save-to-label { color: var(--text-muted); }
.save-to-options {
  display: inline-flex;
  padding: 0.125rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.save-to-options button {
  height: calc(var(--control-h-sm) - 0.375rem);
  padding: 0 0.6rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  white-space: nowrap;
}
.save-to-options button:hover { color: var(--text); }
.save-to-options button.active {
  background: var(--surface-1);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border-color);
}
.save-to-options button:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.save-to-detail { color: var(--text-faint); min-width: 0; overflow-wrap: anywhere; }

.customization-doctor .doctor-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.customization-doctor .doctor-head h3 { margin: 0; }
.doctor-summary { flex: 1; color: var(--text-faint); font-size: var(--text-xs); }
.doctor-summary.has-problems { color: var(--yellow); }
.doctor-heading {
  margin: 0.9rem 0 0.35rem;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.doctor-list { display: grid; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
.doctor-list > li { padding: 0.4rem 0; border-top: 1px solid var(--border-color); font-size: var(--text-xs); }
.doctor-list > li:first-child { border-top: 0; }
.doctor-row {
  display: grid;
  grid-template-columns: 8rem 7.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
}
.doctor-row .doctor-state { justify-self: start; }
.doctor-scope { color: var(--text); font-size: var(--text-xs); white-space: nowrap; }
.doctor-path {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: var(--text-2xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doctor-state {
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text-muted);
  font-size: var(--text-3xs);
  white-space: nowrap;
}
.doctor-state.is-ok { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.doctor-state.is-broken { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.doctor-state.is-untrusted { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 14%, transparent); }
.doctor-state.is-missing,
.doctor-state.is-skipped { color: var(--text-faint); }
.doctor-open { height: var(--control-h-xs); padding: 0 0.55rem; font-size: var(--text-xs); }
.doctor-keys { margin-top: 0.2rem; color: var(--text-faint); font-size: var(--text-2xs); overflow-wrap: anywhere; }
.doctor-error { margin-top: 0.25rem; color: var(--red); font-size: var(--text-2xs); overflow-wrap: anywhere; }
.doctor-empty { margin: 0.2rem 0 0; color: var(--text-faint); font-size: var(--text-xs); }
.doctor-problem { display: flex; align-items: baseline; gap: 0.6rem; }
.doctor-severity {
  flex-shrink: 0;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
  font-size: var(--text-3xs);
}
.doctor-severity.is-error { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.doctor-severity.is-warning { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 14%, transparent); }
.doctor-problem-copy { min-width: 0; color: var(--text-muted); overflow-wrap: anywhere; }
.doctor-problem-copy code,
.doctor-run-body code,
.trust-detail { font-family: var(--mono); font-size: var(--text-2xs); color: var(--text); }
.doctor-problem-file { display: block; margin-top: 0.15rem; color: var(--text-faint); font-size: var(--text-2xs); }
.doctor-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
  cursor: pointer;
}
.doctor-link:hover { color: var(--text); }
.doctor-safe-mode,
.doctor-trust {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.doctor-safe-mode.is-on { padding: 0.45rem 0.6rem; border-radius: var(--radius-md); background: color-mix(in srgb, var(--yellow) 12%, transparent); color: var(--text); }
.doctor-trust.is-pending { display: grid; justify-content: stretch; justify-items: start; }
.doctor-run summary {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}
.doctor-run summary::-webkit-details-marker { display: none; }
.doctor-run-time { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.doctor-run-label { min-width: 0; overflow: hidden; color: var(--text-muted); text-overflow: ellipsis; white-space: nowrap; }
.doctor-exit { color: var(--text-faint); font-size: var(--text-2xs); }
.doctor-exit.is-failed { color: var(--red); }
.doctor-run-body { display: grid; gap: 0.3rem; margin-top: 0.4rem; padding-left: 0.6rem; border-left: 2px solid var(--border-color); }
.doctor-run-output {
  max-height: 12rem;
  min-width: 0;
  overflow: auto;
  font-size: var(--text-xs);
}
.doctor-run-output .body > :first-child { margin-top: 0; }
.doctor-run-output .body > :last-child { margin-bottom: 0; }

.trust-items { display: grid; gap: 0.3rem; width: 100%; margin: 0.35rem 0 0; padding: 0; list-style: none; }
.trust-items li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.6rem;
  font-size: var(--text-xs);
}
.trust-kind { color: var(--text-muted); }
.trust-detail { min-width: 0; overflow-wrap: anywhere; }
.trust-file { color: var(--text-faint); font-size: var(--text-2xs); white-space: nowrap; }

.trust-notice {
  margin: 0.65rem auto 0;
  max-width: var(--chat-max);
  width: calc(100% - 2.5rem);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.trust-notice-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.6rem; }
.trust-notice-row > svg { flex-shrink: 0; color: var(--text-faint); }
.trust-notice-copy { flex: 1 1 16rem; min-width: 0; }
.trust-notice-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-left: auto; }
.trust-notice .trust-items { padding-top: 0.4rem; border-top: 1px solid var(--border-color); }
.trust-notice-error { margin: 0.35rem 0 0; color: var(--red); }

.customization-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-ui);
  flex-shrink: 0;
}
.customization-banner > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.customization-banner.is-safe-mode { background: color-mix(in srgb, var(--yellow) 10%, transparent); color: var(--text); }
.customization-banner.is-broken { background: color-mix(in srgb, var(--red) 8%, transparent); color: var(--text); }
.customization-banner b { font-weight: 600; }
.customization-banner-error { display: block; color: var(--red); }

@media (max-width: 640px) {
  .doctor-row { grid-template-columns: minmax(0, 1fr) auto; }
  .doctor-row .doctor-path { grid-column: 1 / -1; grid-row: 2; }
  .trust-items li { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
}

.settings-nav-count {
  margin-left: auto;
  min-width: 1.1rem;
  padding: 0 0.3rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--yellow) 18%, transparent);
  color: var(--yellow);
  font-size: var(--text-3xs);
  font-weight: 600;
  line-height: 1.1rem;
  text-align: center;
}

/* Always allow on an approval card: the rule first, then where it applies. */
.always-allow {
  /* Below the card's buttons, whichever of them come after the toggle. */
  order: 1;
  flex-basis: 100%;
  display: grid;
  gap: 0.45rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.always-allow-rule { margin: 0; color: var(--text-muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.always-allow-rule code { font-family: var(--mono); font-size: var(--text-2xs); color: var(--text); }
.always-allow-choices { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Settings → Agents → Permission rules, collapsed until opened. */
.permission-rules > details > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}
.permission-rules > details > summary::-webkit-details-marker { display: none; }
.permission-rules > details > summary::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 120ms ease;
}
.permission-rules > details[open] > summary::before { transform: rotate(45deg); }
.permission-rules > details > summary h3 { margin: 0; }
.permission-rules > details > summary:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-xs); }
.permission-rules-count { color: var(--text-faint); font-size: var(--text-xs); }
.permission-rules > details > .muted { margin-top: 0.6rem; }
.permission-list-hint { margin-left: 0.5rem; color: var(--text-faint); font-weight: 400; letter-spacing: 0; text-transform: none; }
.permission-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
}
.permission-rule code { min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: var(--text-2xs); color: var(--text); }
.permission-rule-file { color: var(--text-faint); font-family: var(--mono); font-size: var(--text-2xs); white-space: nowrap; }
.permission-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.permission-add-text { flex: 1 1 12rem; min-width: 0; font-family: var(--mono); font-size: var(--text-xs); }

.hook-row {
  display: grid;
  grid-template-columns: 9rem auto minmax(0, 1fr);
  align-items: center;
  gap: 0.25rem 0.6rem;
}
.hook-matcher { color: var(--text-faint); font-family: var(--mono); font-size: var(--text-2xs); }
.hook-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: var(--text-2xs); color: var(--text); }
.hook-meta { grid-column: 1 / -1; margin-top: 0; }
.doctor-list > li.doctor-empty { border-top: 0; }

@media (max-width: 640px) {
  .permission-rule { grid-template-columns: minmax(0, 1fr) auto; }
  .permission-rule-file { grid-column: 1 / -1; white-space: normal; overflow-wrap: anywhere; }
  .hook-row { grid-template-columns: minmax(0, 1fr) auto; }
  .hook-target { grid-column: 1 / -1; }
}
/* A file header with a "Viewed" box: the row, not the button, sticks. */
.file-diff-head-row {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  background: var(--code-header);
}
.file-diff-head-row:hover { background: var(--bg-hover); }
.file-diff-head-row > .file-diff-head {
  position: static;
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
}
.file-diff-head-row > .file-diff-head:hover { background: transparent; }
.file-diff-viewed {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--control-h-md);
  padding: 0 0.6rem 0 0.4rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  user-select: none;
}
.file-diff-viewed:hover { color: var(--text); }
.file-diff-viewed input { margin: 0; accent-color: var(--text-muted); cursor: pointer; }
.file-diff.is-viewed .file-diff-name { color: var(--text-muted); }
.diff-viewed-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}
/*
 * Review's per-hunk controls. A hunk heading that can be acted on is one
 * focusable row across every column of the file's grid: the @@ line on the
 * left, its controls on the right, and git's refusal underneath when an
 * action failed.
 */
.diff-row--hunk > .diff-hunk-head,
.diff-split-row--hunk > .diff-hunk-head {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  min-width: 0;
  padding: 0.2rem 0.4rem 0.2rem 0;
  background: var(--code-header);
  color: var(--code-muted);
  font-size: var(--text-xs);
  outline: none;
}
/* Beats the wrapped-diff rule: a heading truncates rather than stacking up. */
.file-diff-body .diff-hunk-head > code.diff-text {
  flex: 1 1 0;
  display: flex;
  white-space: nowrap;
  padding: 0.15rem 0.6rem;
}
.diff-hunk-range { flex: none; }
.diff-hunk-section { white-space: pre; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.diff-hunk-head:focus-visible {
  box-shadow: inset 2px 0 0 var(--ring), inset 0 0 0 1px color-mix(in srgb, var(--ring) 45%, transparent);
}
.diff-hunk-head:focus-within { background: color-mix(in srgb, var(--code-header) 70%, var(--bg-hover)); }

.hunk-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  margin-left: auto;
  /* With unwrapped long lines the row is wider than the panel; keep the controls in view. */
  position: sticky;
  right: 0.4rem;
}
.hunk-action {
  height: 1.5rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--text-muted);
  font: inherit;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.hunk-action:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
.hunk-action:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.hunk-action:disabled { opacity: var(--disabled-opacity); cursor: default; }
.hunk-action--keep:hover:not(:disabled) { color: var(--green); border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.hunk-action--reject:hover:not(:disabled) { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, transparent); }

.hunk-stage {
  font-family: var(--font);
  font-size: var(--text-2xs);
  letter-spacing: 0.02em;
  color: var(--green);
  white-space: nowrap;
}
.hunk-stage--partly { color: var(--text-faint); }

.hunk-error {
  flex: 1 0 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  box-sizing: border-box;
  margin: 0.1rem 0 0.15rem;
  padding-left: 0.6rem;
  color: var(--red);
  font-family: var(--font);
  font-size: var(--text-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hunk-error > span { flex: 1 1 auto; min-width: 0; }

.file-diff-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding: 0.3rem 0.4rem;
  background: var(--code-bg);
  border-bottom: 1px solid var(--border-color);
}
.file-diff-tools .hunk-error { padding-left: 0; }

.review-diff-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0.4rem;
}
.review-diff-bar h4 { margin: 0; }
.review-diff-bar .menu-select { margin-left: auto; }
.review-diff-note { margin: 0.25rem 0 0.5rem; font-size: var(--text-xs); }
.review-diff-files { display: flex; flex-direction: column; }
/* Review: what is compared, and the diff for it. */
.review-scope-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.review-scope-select { display: flex; flex: 1 1 14rem; min-width: 0; }
.review-scope-select .field-select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.review-ws-toggle { flex: none; min-height: 2rem; }
.review-ws-toggle.active {
  background: var(--bg-active);
  border-color: var(--border-strong);
  color: var(--text);
}
.review-ws-toggle.active::before { content: "✓"; margin-right: 0.35rem; }
.review-turn-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.review-turn-banner span { flex: 1 1 14rem; min-width: 0; }
.review-turn-banner .chip { flex: none; }
.import-dialog { width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem); display: flex; flex-direction: column; }
.dialog .import-lede { margin: 0.25rem 0 1rem; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.45; }
.import-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.import-filters .chip.active { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
.import-continuation {
  margin: 0 0 1rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.import-list {
  flex: 1 1 auto;
  min-height: 6rem;
  max-height: 24rem;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.import-row { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; }
.import-row + .import-row { border-top: 1px solid var(--border-color); }
.import-row:hover { background: var(--bg-hover); }
.import-row-text { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
.import-row-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-row-meta { color: var(--text-muted); font-size: var(--text-sm); }
.import-row .chip { flex-shrink: 0; }
.import-empty { margin: 0; padding: 1.5rem 1rem; color: var(--text-muted); font-size: var(--text-sm); text-align: center; }
.import-note { margin: 0.6rem 0 0; color: var(--text-muted); font-size: var(--text-sm); }
.import-error, .dialog p.import-error { margin: 0.6rem 0 0; color: var(--red); font-size: var(--text-sm); }
.import-dialog .actions { margin-top: 1rem; }

.import-hint {
  margin-top: 0.9rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.import-hint span { color: var(--text); }
.import-hint:hover { background: var(--bg-hover); color: var(--text); }
.import-hint:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

.thread-origin {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.thread-origin-text { flex: 1; min-width: 0; display: grid; gap: 0.2rem; }
.thread-origin-text strong { color: var(--text); font-weight: var(--weight-medium); }
.thread-origin .link-button { padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.thread-origin details summary { cursor: pointer; color: var(--text-muted); }
.thread-origin details summary:hover { color: var(--text); }
.thread-origin pre { margin: 0.4rem 0 0; max-height: 16rem; overflow: auto; white-space: pre-wrap; font-size: var(--text-sm); color: var(--text-muted); }
/* Diagrams, formulas, images and HTML previews inside replies. */

.md-media-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: var(--control-h-xs);
  padding: 0 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-xs);
  white-space: nowrap;
  cursor: pointer;
}
.md-media-button:hover { background: var(--bg-hover); color: var(--text); }
.md-media-button[aria-pressed="true"] { background: var(--bg-active); color: var(--text); border-color: var(--border-strong); }
.md-media-button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

.md-diagram-tools { display: inline-flex; align-items: center; gap: 0.25rem; }
.msg-code-bar .md-media-button { color: var(--code-muted); border-color: var(--code-border); }
.msg-code-bar .md-media-button:hover { color: var(--code-text); }

/* Mermaid */
.md-diagram {
  margin: 0.8em 0;
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.md-diagram .msg-code { margin: 0; border: 0; border-radius: 0; }
.md-diagram-canvas {
  display: flex;
  justify-content: center;
  padding: 1rem;
  overflow-x: auto;
  background: var(--code-bg);
  cursor: zoom-in;
}
.md-diagram-canvas svg { max-width: 100%; height: auto; }
/* The diagram theme draws a drop shadow under every node; the transcript is flat. */
.md-diagram-canvas svg * { filter: none !important; }
.md-diagram-failed { margin: 0.8em 0; }
.md-diagram-failed .msg-code-wrap { margin-top: 0.35rem; }
.md-media-note {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* Math */
.md-math--block {
  display: block;
  margin: 0.8em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2rem 0;
}
.md-math .katex { font-size: 1.08em; }
.md-math--block .katex-display { margin: 0; }
.md-math-source {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.md-math-source--block { display: block; margin: 0.8em 0; }
.md-math-source[title] { text-decoration: underline dotted var(--warn); text-underline-offset: 0.2em; }

/* Images */
.md-image {
  display: inline-block;
  max-width: 100%;
  margin: 0.25rem 0;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  overflow: hidden;
  vertical-align: middle;
  cursor: zoom-in;
}
.md-image img { display: block; max-width: 100%; max-height: 24rem; object-fit: contain; }
.md-image:hover { border-color: var(--border-strong); }
.md-image:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.md-image-inline { max-height: 1.25em; vertical-align: middle; }

.md-image-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  margin: 0.15rem 0;
  padding: 0.4rem 0.45rem 0.4rem 0.6rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--text-muted);
  vertical-align: middle;
}
.md-image-card > svg { flex-shrink: 0; color: var(--text-faint); }
.md-image-card.is-failed { border-style: solid; }
.md-image-card-text { display: grid; min-width: 0; line-height: 1.3; }
.md-image-card-label { color: var(--text); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-image-card-detail { font-size: var(--text-xs); color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-image-card-url { font-family: var(--mono); }

/* Zoom and preview dialogs */
.md-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.md-zoom {
  display: flex;
  flex-direction: column;
  width: min(72rem, 100%);
  max-height: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--dialog-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.md-zoom-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem 0.45rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
}
.md-zoom-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.md-zoom-modes { display: inline-flex; gap: 0.25rem; }
.md-zoom-stage {
  flex: 1;
  min-height: 12rem;
  overflow: auto;
  background: var(--surface-sunken);
}
.md-zoom-stage:focus-visible { outline: var(--focus-ring); outline-offset: calc(-1 * var(--ring-width)); }
.md-zoom-stage--fit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.md-zoom-stage--fit img { max-width: 100%; max-height: calc(100vh - 8rem); object-fit: contain; }
.md-zoom-stage--actual { padding: 1rem; }
.md-zoom-stage--actual img { display: block; max-width: none; margin: 0 auto; }

.md-html-preview { height: min(48rem, 100%); }
.md-html-scripts {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.md-html-frame {
  flex: 1;
  width: 100%;
  min-height: 16rem;
  border: 0;
  /* A page without its own background reads as one in a browser: light canvas. */
  color-scheme: light;
  background: Canvas;
}
.md-html-note {
  margin: 0;
  padding: 0.45rem 0.9rem;
  border-top: 1px solid var(--border-color);
  font-size: var(--text-xs);
  color: var(--text-faint);
}
/* Fork and restore: the branch point under a shared turn, the restore dialog, the redo banner. */

.branch-point {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.75rem 0 0.5rem;
  padding: 0.25rem 0.35rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-ui);
  max-width: 100%;
  width: fit-content;
}
.branch-point-mark { display: inline-flex; padding: 0 0.2rem; color: var(--text-muted); }
.branch-step { width: var(--control-h-xs); height: var(--control-h-xs); }
.branch-step:disabled { opacity: var(--disabled-opacity); }
.branch-step-flip { transform: scaleX(-1); }
.branch-point-current {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  height: var(--control-h-xs);
  padding: 0 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.branch-point-current:hover,
.branch-point-current[aria-expanded="true"] { background: var(--bg-hover); }
.branch-point-current:focus-visible,
.branch-step:focus-visible,
.branch-point-back:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.branch-point-count { color: var(--text-muted); white-space: nowrap; }
.branch-point-title { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 18rem; }
.branch-point-back { margin-left: 0.25rem; font-size: var(--text-xs); }
.branch-point-list {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: var(--z-menu);
  width: min(26rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  border: 1px solid var(--border-color);
  border-radius: var(--popover-radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
  outline: none;
}
.branch-point-list li {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.branch-point-list li[data-active="true"] { background: var(--bg-hover); }
.branch-point-list li[aria-selected="true"] .branch-point-option-title::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin: 0 0.4rem 0.1rem 0;
  border-radius: var(--radius-full);
  background: var(--accent);
  vertical-align: middle;
}
.branch-point-list:focus-visible li[data-active="true"] { box-shadow: inset 0 0 0 1px var(--ring); }
.branch-point-option-title { color: var(--text); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-point-option-meta { color: var(--text-muted); font-size: var(--text-xs); }

.restore-dialog { width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem); overflow: auto; }
.restore-prompt { margin: 0.25rem 0 1.25rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restore-scopes { display: grid; gap: 0.4rem; margin-bottom: 1rem; }
.restore-scope {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.restore-scope:hover:not(.unavailable) { background: var(--bg-hover); }
.restore-scope.selected { border-color: var(--border-strong); background: var(--surface-0); }
.restore-scope.unavailable { cursor: not-allowed; opacity: 0.7; }
.restore-scope:has(input:focus-visible) { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.restore-scope input { margin: 0.2rem 0 0; accent-color: var(--accent); }
.restore-scope-text { display: grid; gap: 0.15rem; }
.restore-scope-label { color: var(--text); font-weight: var(--weight-medium); }
.restore-scope-detail { color: var(--text-muted); font-size: var(--text-sm); line-height: 1.4; }
.restore-compare { margin-bottom: 0.75rem; }
.restore-compare-head { display: flex; align-items: center; gap: 0.75rem; justify-content: space-between; color: var(--text-muted); font-size: var(--text-sm); }
.restore-compare-diff { margin-top: 0.5rem; max-height: 22rem; overflow: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.restore-redo-note { margin: 0 0 0.5rem; color: var(--text-muted); font-size: var(--text-sm); }
.restore-error, .dialog p.restore-error { margin: 0 0 0.5rem; color: var(--red); font-size: var(--text-sm); }

.redo-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.4rem 0.5rem 0.4rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text);
  font-size: var(--text-ui);
}
.redo-banner-text { flex: 1; min-width: 0; }
.redo-banner-hint { color: var(--text-muted); }
.redo-banner .chip { display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
/*
 * The conversation backdrop. It sits behind the conversation column only,
 * under the transcript and the composer; the sidebar, panels and titlebar
 * keep their own surfaces. Scenes draw from the theme's tokens, so each one
 * follows light and dark. None animates.
 *
 * Variables come from lib/appearance.ts: --backdrop-opacity, --backdrop-blur,
 * --backdrop-veil (the page colour laid over it for readable text), and for
 * an image --backdrop-image, --backdrop-size and --backdrop-repeat.
 */
.conversation-backdrop {
  display: none;
}

:root[data-backdrop] .main:has(> .conversation-backdrop) {
  position: relative;
  isolation: isolate;
}

:root[data-backdrop] .conversation-backdrop {
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.conversation-backdrop::before,
.conversation-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
}

.conversation-backdrop::before {
  inset: calc(var(--backdrop-blur, 0px) * -2);
  opacity: var(--backdrop-opacity, 1);
  filter: blur(var(--backdrop-blur, 0px));
}

.conversation-backdrop::after {
  background: var(--bg);
  opacity: var(--backdrop-veil, 0);
}

/* Over a backdrop, the fade and corner masks in the page colour would draw bands of it. */
:root[data-backdrop] .composer::before,
:root[data-backdrop] .composer-overlay-corner-masks::before,
:root[data-backdrop] .composer-overlay-corner-masks::after {
  display: none;
}

:root[data-backdrop="image"] .conversation-backdrop::before {
  background-image: var(--backdrop-image);
  background-size: var(--backdrop-size, cover);
  background-repeat: var(--backdrop-repeat, no-repeat);
  background-position: center;
}

:root[data-backdrop="grain"] .conversation-backdrop::before,
.backdrop-tile-stage[data-scene="grain"]::before {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -0.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-size: 180px 180px;
}

:root[data-backdrop="mesh"] .conversation-backdrop::before,
.backdrop-tile-stage[data-scene="mesh"]::before {
  background:
    radial-gradient(60% 50% at 12% 8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(55% 45% at 88% 18%, color-mix(in srgb, var(--blue) 13%, transparent), transparent 70%),
    radial-gradient(60% 55% at 70% 92%, color-mix(in srgb, var(--green) 11%, transparent), transparent 70%),
    radial-gradient(50% 45% at 18% 85%, color-mix(in srgb, var(--yellow) 9%, transparent), transparent 70%);
}

:root[data-backdrop="night"] .conversation-backdrop::before,
.backdrop-tile-stage[data-scene="night"]::before {
  background:
    radial-gradient(1px 1px at 12% 18%, color-mix(in srgb, var(--text) 16%, transparent) 50%, transparent 100%),
    radial-gradient(1px 1px at 68% 9%, color-mix(in srgb, var(--text) 14%, transparent) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 84% 31%, color-mix(in srgb, var(--text) 16%, transparent) 50%, transparent 100%),
    radial-gradient(1px 1px at 37% 42%, color-mix(in srgb, var(--text) 12%, transparent) 50%, transparent 100%),
    radial-gradient(1px 1px at 22% 66%, color-mix(in srgb, var(--text) 14%, transparent) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 74%, color-mix(in srgb, var(--text) 12%, transparent) 50%, transparent 100%),
    radial-gradient(1px 1px at 91% 83%, color-mix(in srgb, var(--text) 14%, transparent) 50%, transparent 100%),
    linear-gradient(to bottom, color-mix(in srgb, var(--blue) 12%, transparent), transparent 75%);
  background-size: 320px 320px, 320px 320px, 320px 320px, 320px 320px, 320px 320px, 320px 320px, 320px 320px, 100% 100%;
}

:root[data-backdrop="dots"] .conversation-backdrop::before,
.backdrop-tile-stage[data-scene="dots"]::before {
  background: radial-gradient(circle, color-mix(in srgb, var(--text) 18%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px;
}

:root[data-backdrop="paper"] .conversation-backdrop::before,
.backdrop-tile-stage[data-scene="paper"]::before {
  background: color-mix(in srgb, var(--text) 8%, color-mix(in srgb, var(--yellow) 4%, transparent));
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.38' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.2 -0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  mask-size: 260px 260px;
}
.channels-view { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.channels-connection-state { display: flex; flex: 1; min-width: 0; min-height: 0; padding: 1.5rem; overflow: auto; }
.channels-connection-state > div { width: min(100%, 24rem); margin: auto; text-align: center; overflow-wrap: anywhere; }
.channels-connection-state svg { color: var(--text-muted); }
.channels-connection-state h2 { margin: .85rem 0 .4rem; font-size: 1rem; font-weight: 600; line-height: 1.4; letter-spacing: -.015em; }
.channels-connection-state p { margin: 0; color: var(--text-muted); font-size: var(--text-ui); line-height: 1.5; }
.channels-connection-state button { margin-top: 1rem; max-width: 100%; white-space: normal; }
.app.channels-shell > .sidebar { display: none; }
.app.channels-shell.sidebar-collapsed .channel-directory { display: none; }
.channels-layout { display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.channels-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-width: 0; }
.channels-toolbar h2, .channels-toolbar h3 { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.channels-hint { color: var(--text-muted); font-size: var(--text-ui); line-height: 1.5; overflow-wrap: anywhere; }
.channels-error { padding: .55rem .7rem; margin: .4rem .75rem; border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--red) 8%, transparent); font-size: var(--text-ui); line-height: 1.45; overflow-wrap: anywhere; }

.channels-setup { width: min(28rem, calc(100% - 2rem)); margin: auto; padding: 1.75rem 1.5rem 1.5rem; overflow: auto; border: 1px solid var(--border-color); border-radius: var(--radius-2xl); background: var(--surface-0); box-shadow: var(--shadow); }
.channels-setup > svg { color: var(--text-muted); }
.channels-setup h2 { margin: .85rem 0 .35rem; font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.25; }
.channels-setup p { margin: 0; line-height: 1.55; color: var(--text-muted); font-size: var(--text-sm); }
.channels-setup label, .channel-form label { display: flex; flex-direction: column; gap: .4rem; margin: .9rem 0; font-size: var(--text-xs); font-weight: 550; color: var(--text); }
/* The app's one field spec: every text, URL and key field the same height, corner and border. */
.channels-setup input:not([type="checkbox"]), .channel-form input, .channel-form select, .channel-mention-menu input { box-sizing: border-box; width: 100%; min-width: 0; height: var(--control-h-lg); border: 1px solid var(--border-color); border-radius: var(--control-radius); background: color-mix(in srgb, var(--text) 3%, transparent); padding: 0 .625rem; font-size: var(--text-sm); font-weight: 450; }
.channels-setup input:focus, .channel-form input:focus, .channel-form select:focus, .channel-mention-menu input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 24%, transparent); }
.channels-setup .primary, .channel-form .primary { border: 0; border-radius: var(--control-radius); background: var(--text); color: var(--bg); height: var(--control-h-lg); padding: 0 1rem; font-weight: 600; }
/* The help text, the main button and what follows it each get room. */
.channels-setup > .channels-hint { margin-top: .75rem; }
.channels-setup > button { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 1rem; }
.channels-setup > button + * { margin-top: .75rem; }
.channels-setup button:disabled, .channel-form button:disabled { opacity: .4; }
.channels-setup details { margin-top: 1.25rem; font-size: var(--text-ui); color: var(--text-muted); }
.channels-setup summary { cursor: pointer; }
.channels-setup .channel-remember { flex-direction: row; align-items: center; gap: .55rem; font-weight: 450; }
.channels-setup .channel-remember input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--text); }

.channel-directory { display: flex; flex-direction: column; flex: 0 0 16.5rem; padding: .65rem .45rem .5rem; border-right: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent); background: var(--surface-0); min-width: 0; min-height: 0; }
.channel-community { display: flex; align-items: center; gap: .55rem; margin: .15rem .35rem .7rem; min-height: 2.25rem; }
.channel-community-mark { display: grid; place-items: center; flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: var(--radius-md); background: var(--bg-active); color: var(--text); }
.channel-community > div { min-width: 0; flex: 1; }
.channel-community strong { display: block; font-size: var(--text-ui); font-weight: 600; letter-spacing: -0.01em; }
.channel-community small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-2xs); color: var(--text-muted); }
.channel-connection-menu { position: relative; flex-shrink: 0; }
.channel-connection-menu > summary { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: var(--radius-sm); color: var(--text-muted); list-style: none; cursor: pointer; }
.channel-connection-menu > summary::-webkit-details-marker { display: none; }
.channel-connection-menu > summary:hover, .channel-connection-menu[open] > summary { background: var(--bg-hover); color: var(--text); }
.channel-connection-menu > div { position: absolute; top: calc(100% + .35rem); right: 0; z-index: 8; width: 16rem; padding: .45rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-elevated); box-shadow: var(--shadow); }
.channel-connection-menu p { font-size: var(--text-xs); color: var(--text-muted); overflow-wrap: anywhere; margin: 0; padding: .4rem .45rem; }
.channel-connection-menu button { display: block; width: 100%; text-align: left; padding: .45rem .5rem; border: 0; border-radius: var(--radius-sm); background: transparent; font-size: var(--text-ui); }
.channel-connection-menu button:hover { background: var(--bg-hover); }
.channel-search { display: flex; align-items: center; gap: .4rem; margin: 0 .3rem .45rem; padding: .35rem .55rem; border-radius: var(--radius-md); color: var(--text-muted); background: var(--bg-hover); }
.channel-search:focus-within { outline: 1px solid color-mix(in srgb, var(--text-muted) 35%, transparent); }
.channel-search input { min-width: 0; width: 100%; padding: 0; border: 0; outline: 0; background: transparent; font-size: var(--text-ui); }
.channel-search svg { flex-shrink: 0; }
.channel-directory-heading { display: flex; align-items: center; justify-content: space-between; min-height: 1.6rem; padding: 0 .45rem; color: var(--text-muted); font-size: var(--text-2xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.channel-directory-heading > div { display: flex; gap: .1rem; }
.channel-filters { display: flex; gap: .15rem; margin: .35rem .3rem .4rem; padding: .15rem; border-radius: var(--radius-md); background: var(--bg-hover); }
.channel-filters button { flex: 1; padding: .28rem .25rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font-size: var(--text-xs); }
.channel-filters button[aria-pressed="true"] { color: var(--text); background: var(--surface-0); box-shadow: 0 1px 1px rgb(0 0 0 / 6%); }
.channel-links { flex: 1; min-height: 0; overflow: auto; padding: 0 .15rem; }
.channel-links > p { padding: .45rem .5rem; font-size: var(--text-ui); color: var(--text-muted); }
.channel-section { margin: .7rem .45rem .15rem; color: var(--text-muted); font-size: var(--text-2xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.channel-link { display: flex; align-items: center; width: 100%; height: 2rem; gap: .45rem; border: 0; border-radius: var(--radius-sm); padding: 0 .45rem; background: transparent; color: color-mix(in srgb, var(--text) 78%, transparent); text-align: left; font-size: var(--text-sm); font-weight: 450; }
.channel-link:hover { background: var(--bg-hover); color: var(--text); }
.channel-link.active { background: var(--bg-active); color: var(--text); font-weight: 500; }
.channel-link.unread { color: var(--text); font-weight: 650; }
.channel-link.muted { opacity: .48; }
.channel-link > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-link svg { flex-shrink: 0; opacity: .72; }
.channel-link small { margin-left: auto; color: var(--text-muted); font-size: var(--text-2xs); font-weight: 500; }
.channel-unread-dot { width: .42rem; height: .42rem; margin-left: auto; border-radius: 50%; background: var(--text); flex-shrink: 0; }
.channel-browse { display: flex; align-items: center; gap: .45rem; border: 0; margin: .25rem .3rem 0; padding: .45rem .45rem; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font-size: var(--text-ui); text-align: left; }
.channel-browse:hover { background: var(--bg-hover); color: var(--text); }

.channel-room { position: relative; display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden; container-type: inline-size; }
.channel-main { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.channel-room-header { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; gap: .75rem; min-height: 3rem; padding: 0 1rem; border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); }
.channel-room-header > div:first-child { min-width: 0; }
.channel-room-header h3 { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: .9375rem; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; }
.channel-room-header h3 svg { color: var(--text-muted); flex-shrink: 0; }
.channel-room-header p { margin: .05rem 0 0; color: var(--text-muted); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channels-view .icon-btn,
.channel-dialog .icon-btn {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
  max-height: 1.75rem;
  box-sizing: border-box;
}
.channels-view .icon-btn svg,
.channel-dialog .icon-btn svg { width: 15px; height: 15px; }
.channel-room-header h3 .icon-btn { opacity: 0; }
.channel-room-header h3:hover .icon-btn, .channel-room-header h3:focus-within .icon-btn { opacity: 1; }
.channel-actions { display: flex; align-items: center; flex-shrink: 0; gap: .25rem; }
.channels-view .ghost,
.channels-view .primary,
.channel-actions .ghost,
.channel-actions .primary {
  height: 1.75rem;
  min-height: 1.75rem;
  max-height: 1.75rem;
  box-sizing: border-box;
  padding: 0 .65rem;
  font-size: var(--text-xs);
  line-height: 1;
  white-space: nowrap;
}
.channel-actions .ghost { border-color: transparent; border-radius: var(--radius-md); font-weight: 550; color: var(--text-muted); background: transparent; }
.channel-actions .ghost:hover, .channel-actions .ghost[aria-expanded="true"] { color: var(--text); background: var(--bg-hover); }
.channel-members-btn { display: inline-flex; align-items: center; gap: .4rem; }
.channel-members-btn .channel-reply-avatars .channel-avatar { width: 1.15rem; height: 1.15rem; flex-basis: 1.15rem; font-size: var(--text-3xs); border-radius: 50%; border-color: var(--bg); }
.channel-message-search { display: flex; align-items: center; gap: .3rem; width: 10.5rem; height: 1.75rem; padding: 0 .5rem; border-radius: var(--radius-md); color: var(--text-muted); background: var(--bg-hover); }
.channel-message-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: var(--text-xs); padding: 0; }

.channel-room.has-thread > .channel-thread,
.channel-room.has-thread > .channel-member-drawer,
.channel-room.has-thread > .channel-details {
  position: relative;
  width: 24rem; flex: 0 0 auto; max-width: 50%;
  border-left: 1px solid var(--border-color);
  background: var(--bg);
}
.channel-room.has-thread > .channel-main { position: relative; }
.channel-thread, .channel-member-drawer, .channel-details { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.channel-thread-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.channel-thread-rail:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }

.channel-feed-wrap { flex: 1; position: relative; min-height: 0; min-width: 0; display: flex; }
.channel-feed { flex: 1; overflow: auto; min-height: 0; min-width: 0; overscroll-behavior: contain; padding: .35rem 0 1.25rem; }
.channel-loading { display: flex; flex-direction: column; gap: 1.05rem; padding: 1.1rem 1.25rem; }
.channel-skel-row { display: flex; gap: .7rem; align-items: flex-start; }
.channel-skel-avatar, .channel-skel-hash, .channel-skel-line, .channel-skel-tools span {
  display: block; background: var(--bg-active); animation: channel-skel 1.15s ease-in-out infinite;
}
.channel-skel-avatar { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-lg); flex: 0 0 auto; }
.channel-skel-copy { flex: 1; display: flex; flex-direction: column; gap: .4rem; padding-top: .15rem; }
.channel-skel-line { height: .7rem; width: 38%; border-radius: var(--radius-full); }
.channel-skel-line.name { width: 7rem; height: .8rem; }
.channel-skel-list { display: flex; flex-direction: column; gap: .15rem; padding: .2rem .2rem; }
.channel-skel-link { display: flex; align-items: center; gap: .45rem; height: 2rem; padding: 0 .45rem; }
.channel-skel-hash { width: .85rem; height: .85rem; border-radius: var(--radius-xs); }
.channel-composer-skel { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; min-height: 2.5rem; margin: 0 .75rem .7rem; padding: .35rem .45rem .35rem .85rem; border: 1px solid var(--border-color); border-radius: var(--radius-2xl); background: var(--surface-0); }
.channel-composer-skel .channel-skel-line { width: 42%; margin: 0; }
.channel-skel-tools { display: flex; gap: .35rem; }
.channel-skel-tools span { width: 1.7rem; height: 1.7rem; border-radius: var(--radius-md); }
.channel-skel-tools span:last-child { margin-left: auto; border-radius: 50%; }
.channel-room-skel .channel-room-header .channel-skel-line { width: 8rem; }
@keyframes channel-skel { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .channel-skel-avatar, .channel-skel-hash, .channel-skel-line, .channel-skel-tools span { animation: none; opacity: .7; }
  .channel-avatar img { animation: none; }
}
.channel-day { position: sticky; top: .4rem; z-index: 2; display: flex; justify-content: center; margin: .35rem 0 .55rem; pointer-events: none; }
.channel-day::before, .channel-day::after { content: none; }
.channel-day > span { padding: .18rem .55rem; border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent); border-radius: var(--radius-full); background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--text-muted); font-size: var(--text-2xs); font-weight: 550; letter-spacing: .01em; }
.channel-unread-rule { display: flex; align-items: center; gap: .6rem; margin: .15rem 1.25rem .35rem; color: var(--text); font-size: var(--text-2xs); font-weight: 650; }
.channel-unread-rule::before, .channel-unread-rule::after { content: ""; height: 1px; background: color-mix(in srgb, var(--text) 28%, transparent); flex: 1; }
.channel-post { display: flex; gap: .7rem; position: relative; padding: .28rem 1.15rem .15rem; min-width: 0; }
.channel-post:hover { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.channel-post.compact { padding-top: .05rem; padding-bottom: .05rem; }
.channel-avatar { position: relative; display: grid; place-items: center; flex: 0 0 2.25rem; width: 2.25rem; height: 2.25rem; overflow: hidden; border-radius: var(--radius-lg); background: var(--bg-active); color: var(--text); font-size: var(--text-2xs); font-weight: 650; }
.channel-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: channel-avatar-in 160ms ease forwards; }
@keyframes channel-avatar-in { from { opacity: 0; } to { opacity: 1; } }
.channel-avatar.overflow { font-size: var(--text-3xs); }
.channel-compact-time { display: grid; place-items: start end; flex: 0 0 2.25rem; width: 2.25rem; padding-top: .15rem; color: transparent; font-size: var(--text-3xs); font-variant-numeric: tabular-nums; }
.channel-post.compact:hover .channel-compact-time, .channel-post.compact:focus-within .channel-compact-time { color: var(--text-muted); }
.channel-post-content { flex: 1; min-width: 0; }
.channel-post-content > header { display: flex; align-items: baseline; gap: .4rem; margin: 0 0 .05rem; font-size: var(--text-sm); line-height: 1.3; }
.channel-post-content > header strong { font-weight: 650; letter-spacing: -0.01em; }
.channel-post time { color: var(--text-muted); font-size: var(--text-2xs); font-weight: 450; }
.channel-post time::before { content: "·"; margin-right: .4rem; color: color-mix(in srgb, var(--text-muted) 55%, transparent); }
.channel-agent-label { color: var(--text-muted); font-size: var(--text-3xs); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.channel-post .body { font-size: .9375rem; line-height: 1.5; }
.channel-post .body p { margin: .2rem 0; }
.channel-message-actions { display: flex; align-items: center; position: absolute; right: .7rem; top: -.55rem; gap: .05rem; opacity: 0; border: 1px solid var(--border-color); border-radius: var(--radius-full); padding: .12rem; background: var(--bg-elevated); box-shadow: var(--shadow-raised); z-index: 3; }
.channel-message-actions .icon-btn { width: 1.75rem; height: 1.75rem; min-width: 1.75rem; border-radius: 50%; }
.channel-post:hover .channel-message-actions, .channel-post:focus-within .channel-message-actions, .channel-message-actions.open { opacity: 1; }
.channel-reaction-panel { position: absolute; right: 0; top: calc(100% + .3rem); display: flex; align-items: center; gap: .1rem; width: max-content; max-width: min(22rem, 70vw); margin: 0; padding: .2rem; border: 1px solid var(--border-color); border-radius: var(--radius-full); background: var(--bg-elevated); box-shadow: var(--shadow-raised); }
.channel-reaction-choices { display: flex; align-items: center; gap: .05rem; padding: 0; }
.channel-reaction-entry { display: flex; padding: 0; }
.channel-reaction-choices button { display: inline-flex; align-items: center; justify-content: center; gap: .2rem; min-width: 1.85rem; height: 1.85rem; padding: 0 .35rem; border: 0; border-radius: var(--radius-full); background: transparent; line-height: 1; }
.channel-reaction-glyph { font-size: 1rem; }
.channel-reaction-count { font-size: var(--text-2xs); font-weight: 650; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.channel-reaction-choices button:hover, .channel-reaction-choices button[aria-pressed="true"] { background: color-mix(in srgb, var(--text) 10%, transparent); }
.channel-reaction-choices button[aria-pressed="true"] .channel-reaction-count { color: var(--text); }
.channel-reaction-close { flex-shrink: 0; }
.channel-reaction-counts { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .35rem; }
.channel-reaction-counts button { display: inline-flex; align-items: center; gap: .28rem; height: 1.6rem; padding: 0 .5rem; border: 1px solid var(--border-color); border-radius: var(--radius-full); background: var(--bg-hover); font-size: var(--text-xs); line-height: 1; }
.channel-reaction-counts button.mine, .channel-reaction-counts button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--text) 35%, var(--border-color)); background: color-mix(in srgb, var(--text) 8%, transparent); }
.channel-reaction-counts button:hover { background: var(--bg-active); }
.channel-reaction-counts button span:last-child { font-size: var(--text-2xs); font-weight: 650; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.channel-action-notice { margin: .35rem 0 0; font-size: var(--text-xs); color: var(--text-muted); }
.channel-inline-mention { padding: .02em .28em; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--text) 9%, transparent); font-weight: 600; }
.channel-avatar.person { border-radius: 50%; }
.channel-avatar.emoji > span { font-size: 1.65em; line-height: 1; }
.channel-profile-trigger { display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.channel-profile-trigger:hover { text-decoration: underline; }
.channel-profile-trigger.channel-inline-mention { padding: .02em .28em; background: color-mix(in srgb, var(--text) 9%, transparent); vertical-align: baseline; }
.channel-inline-mention .channel-avatar, .channel-mentions .channel-avatar { width: 1.15em; height: 1.15em; min-width: 1.15em; flex-basis: 1.15em; font-size: .7em; }
.channel-post > .channel-profile-trigger { align-self: flex-start; }
.channel-member-identity { flex: 1; min-width: 0; gap: .75rem; }
.channel-member-identity > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.channel-profile-dialog { width: min(25rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--border-color); border-radius: var(--radius-xl); background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-raised); }
.channel-profile-dialog::backdrop { background: #0008; }
.channel-profile-dialog > section { padding: 1.25rem; }
.channel-profile-dialog header { display: flex; align-items: center; justify-content: space-between; }
.channel-profile-heading { display: flex; flex-direction: column; align-items: center; gap: .65rem; margin: 1.5rem 0; }
.channel-profile-heading .channel-avatar { flex: none; width: 4.5rem; height: 4.5rem; font-size: 2rem; }
.channel-profile-heading h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; max-width: 100%; }
.channel-profile-heading > span:last-child { color: var(--text-muted); font-size: var(--text-ui); }
.channel-agent-host { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); font-size: var(--text-ui); line-height: 1.5; }
.channel-agent-host p { margin: .5rem 0 0; color: var(--text-muted); }
.channel-composer-tools { flex-wrap: wrap; }
.channel-format-toggle { font-size: var(--text-ui); font-weight: 600; }
.channel-format-bar { display: flex; flex-wrap: wrap; gap: .2rem; flex-basis: 100%; order: 3; border-top: 1px solid var(--border-color); padding-top: .4rem; margin-top: .25rem; }
.channel-format-bar .icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 2rem; width: 2rem; height: 2rem; padding: .2rem; white-space: nowrap; font-family: var(--mono); font-size: var(--text-sm); }
.channel-emoji-picker { position: absolute; bottom: calc(100% + .5rem); left: .5rem; z-index: 20; width: min(19rem, calc(100% - 1rem)); padding: .75rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-elevated); box-shadow: var(--shadow-raised); }
.channel-emoji-picker input { width: 100%; min-width: 0; padding: .5rem; margin-bottom: .5rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.channel-emoji-picker > div { display: grid; grid-template-columns: repeat(6, 1fr); }
.channel-emoji-picker button { padding: .4rem; border: 0; border-radius: var(--radius-sm); background: transparent; font-size: 1.35rem; }
.channel-emoji-picker button:hover { background: var(--bg-hover); }
.channel-emoji-picker small { display: block; margin-top: .6rem; font-size: var(--text-2xs); color: var(--text-muted); }
.channel-replies { display: inline-flex; align-items: center; gap: .4rem; margin-top: .3rem; padding: .15rem .45rem .15rem 0; border: 0; border-radius: var(--radius-full); background: none; font-size: var(--text-xs); color: var(--text); }
.channel-replies:hover { background: var(--bg-hover); }
.channel-replies > span:last-child { color: var(--text-muted); }
.channel-reply-avatars { display: inline-flex; align-items: center; }
.channel-reply-avatars .channel-avatar { flex-basis: 1.25rem; width: 1.25rem; height: 1.25rem; font-size: var(--text-3xs); border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); }
.channel-reply-avatars .channel-avatar + .channel-avatar { margin-left: -.35rem; }
.channel-latest { position: absolute; bottom: .65rem; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: .3rem; padding: .35rem .7rem; border: 1px solid var(--border-color); border-radius: var(--radius-full); background: var(--bg-elevated); box-shadow: var(--shadow-raised); font-size: var(--text-xs); font-weight: 550; white-space: nowrap; z-index: 3; }

.channel-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 2rem; color: var(--text-muted); }
.channel-empty h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: .6rem 0 .25rem; }
.channel-empty p { max-width: 22rem; font-size: var(--text-sm); line-height: 1.5; }
.channel-welcome { display: flex; flex-direction: column; align-items: flex-start; padding: 2rem 1.25rem 1.5rem; text-align: left; }
.channel-welcome-mark { display: grid; place-items: center; width: 3.75rem; height: 3.75rem; font-size: 1.6rem; border: 1px solid var(--border-color); border-radius: var(--radius-xl); background: var(--bg-hover); color: var(--text-muted); }
.channel-welcome h2 { margin: .9rem 0 .2rem; font-size: 1.25rem; letter-spacing: -0.02em; }
.channel-welcome p { max-width: 32rem; margin: .15rem 0; line-height: 1.5; color: var(--text-muted); }
.channel-welcome-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.25rem; width: 100%; }
.channel-welcome-actions button { display: flex; flex: 1 1 9rem; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: .8rem; max-width: 14rem; min-height: 5.5rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: transparent; padding: .85rem; font-size: var(--text-sm); text-align: left; }
.channel-welcome-actions button:hover { background: var(--bg-hover); }
.channel-welcome-actions button:disabled { opacity: .45; }

.channel-composer { position: relative; display: flex; flex-direction: column; gap: .6rem; flex: 0 0 auto; margin: 0 .85rem .85rem; padding: .85rem .85rem .6rem; border: 1px solid var(--border-color); border-radius: var(--radius-xl); background: var(--surface-0); }
.channel-composer.is-holding { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.channel-composer:focus-within { border-color: color-mix(in srgb, var(--text-muted) 40%, var(--border-color)); }
.channel-composer textarea { display: block; width: 100%; min-width: 0; height: 2.5rem; min-height: 2.5rem; max-height: 9rem; flex: 0 0 auto; resize: none; border: 0; outline: 0; padding: 0; background: transparent; font-size: .9375rem; line-height: 1.5; box-sizing: border-box; overflow-y: auto; }
.channel-composer textarea::placeholder { color: var(--text-faint); }
.channel-composer-tools { display: flex; align-items: center; gap: .5rem; min-height: 2rem; }
.channel-mentions, .channel-composer > .channels-error { grid-column: 1 / -1; }
.channel-mention-trigger { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; min-width: 1.75rem; padding: 0; border: 0; border-radius: var(--radius-md); background: none; color: var(--text-muted); font-size: 1rem; font-weight: 650; }
.channel-mention-trigger > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.channel-mention-trigger:hover { color: var(--text); background: var(--bg-hover); }
.channel-send-hint { font-size: var(--text-2xs); color: var(--text-muted); }
.channel-send { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; min-width: 1.75rem; margin-left: auto; flex: 0 0 1.75rem; border: 0; border-radius: 50%; background: var(--text); color: var(--bg); }
.channel-send:disabled { opacity: .28; }
.channel-mentions { display: flex; flex-wrap: wrap; gap: .25rem; margin: .15rem .1rem .2rem; }
.channel-mentions button { display: inline-flex; align-items: center; gap: .2rem; height: 1.45rem; border: 0; border-radius: var(--radius-full); padding: 0 .45rem 0 .5rem; background: color-mix(in srgb, var(--text) 8%, transparent); font-size: var(--text-xs); font-weight: 600; }
.channel-mention-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + .4rem); width: auto; padding: .3rem; border: 1px solid var(--border-color); border-radius: var(--radius-xl); background: var(--bg-elevated); box-shadow: var(--shadow-raised); z-index: 6; }
.channel-mention-menu > div { max-height: 16rem; overflow: auto; }
.channel-mention-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 2.35rem; padding: .25rem .55rem; border: 0; border-radius: var(--radius-lg); background: transparent; text-align: left; }
.channel-mention-menu button:hover, .channel-mention-menu button:focus-visible, .channel-mention-menu button[aria-selected="true"] { background: var(--bg-hover); }
.channel-mention-menu .channel-avatar { width: 1.5rem; height: 1.5rem; flex-basis: 1.5rem; border-radius: var(--radius-md); font-size: var(--text-3xs); }
.channel-mention-copy { display: flex; align-items: baseline; gap: .4rem; min-width: 0; }
.channel-mention-copy strong { font-size: var(--text-ui); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-mention-menu small { color: var(--text-muted); font-size: var(--text-2xs); font-weight: 500; }
.channel-mention-menu p { margin: 0; font-size: var(--text-ui); padding: .55rem .6rem; color: var(--text-muted); }

.channel-dialog { width: min(28rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); padding: 1.15rem 1.15rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-xl); background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow); }
.channel-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.channel-dialog > header { margin-bottom: .35rem; }
.channel-access { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .75rem 0; padding: 0; border: 0; }
.channel-access legend { grid-column: 1 / -1; font-size: var(--text-xs); font-weight: 550; }
.channel-access button { display: flex; align-items: flex-start; gap: .5rem; width: 100%; padding: .7rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: transparent; text-align: left; }
.channel-access button[aria-pressed="true"] { border-color: var(--text); background: var(--bg-hover); }
.channel-access strong { display: block; font-size: var(--text-ui); }
.channel-access small { display: block; color: var(--text-muted); font-size: var(--text-2xs); font-weight: 450; margin-top: .1rem; }

.channel-members ul { padding: 0; list-style: none; margin: .25rem 0 .75rem; }
.channel-members li { position: relative; display: flex; align-items: center; gap: .7rem; min-height: 3rem; padding: .35rem 0; font-size: var(--text-sm); }
.channel-members li + li::before { content: ""; position: absolute; top: 0; left: 3rem; right: 0; height: 1px; background: var(--border-color); }
.channel-members li > span:not(.channel-avatar) { overflow-wrap: anywhere; min-width: 0; flex: 1; font-weight: 550; }
.channel-members .icon-btn { opacity: 0; }
.channel-members li:hover .icon-btn, .channel-members li:focus-within .icon-btn { opacity: 1; }
.channel-member-role { display: block; margin-top: .05rem; color: var(--text-muted); font-size: var(--text-2xs); font-weight: 500; text-transform: lowercase; }
.channel-members details { border-top: 1px solid var(--border-color); padding-top: .75rem; }
.channel-members summary { display: flex; justify-content: space-between; align-items: center; font-size: var(--text-ui); font-weight: 550; list-style: none; cursor: pointer; }
.channel-member-content { overflow: auto; padding: .35rem 1rem 1rem; min-height: 0; }
.channel-remove-confirm { font-size: var(--text-ui); line-height: 1.5; padding: .7rem; background: var(--bg-hover); border-radius: var(--radius-lg); margin: .4rem 0 .8rem; }
.channel-details-heading { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.5rem .5rem; }
.channel-details-heading .channel-welcome-mark { width: 4.5rem; height: 4.5rem; border-radius: 50%; font-size: 1.25rem; }
.channel-details-heading h2 { font-size: 1.15rem; margin: .65rem 0 .2rem; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.channel-details-heading p { font-size: var(--text-ui); color: var(--text-muted); line-height: 1.5; overflow-wrap: anywhere; }
.channel-facts { margin-top: .5rem; font-size: var(--text-sm); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.channel-facts > div { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; border-top: 1px solid var(--border-color); }
.channel-facts > div:first-child { border-top: 0; }
.channel-facts dt { font-weight: 550; }
.channel-facts dd { margin: 0; color: var(--text-muted); text-align: left; overflow-wrap: anywhere; }
.channel-id { font-family: var(--mono); font-size: var(--text-2xs); }
.channel-member-preview { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: .45rem; padding: 0; border: 0; background: transparent; color: inherit; }
.channel-management { display: flex; flex-direction: column; margin-top: 1.25rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; }
.channel-management button { display: flex; align-items: center; gap: .7rem; box-sizing: border-box; width: 100%; min-height: 3.25rem; padding: .85rem 1rem; border: 0; border-bottom: 1px solid var(--border-color); background: transparent; text-align: left; font-size: var(--text-sm); line-height: 1.4; }
.channel-management button:last-child { border-bottom: 0; }
.channel-management button:hover { color: var(--text); }
.channel-destructive { color: var(--red); }

@container (max-width: 48rem) {
  .channel-room.has-thread > .channel-main { display: none; }
  .channel-room.has-thread > .channel-thread,
  .channel-room.has-thread > .channel-member-drawer,
  .channel-room.has-thread > .channel-details { width: 100% !important; max-width: 100%; }
  .channel-thread-rail { display: none; }
  .channel-room-header { flex-wrap: wrap; padding-top: .6rem; padding-bottom: .6rem; }
  .channel-actions { flex-wrap: wrap; }
  .channel-message-search { width: 8rem; }
  .channel-send-hint { display: none; }
}
.channel-browser { min-width: 0; }
.channel-browser .channel-search { margin: 1.25rem 0 .75rem; padding: .8rem; border: 1px solid var(--border-color); }
.channel-browser-tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1rem; }
.channel-browser-tabs button { padding: .7rem 0; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: var(--text-sm); color: var(--text-muted); }
.channel-browser-tabs button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--text); }
.channel-browser-create { display: flex; align-items: center; gap: .75rem; width: 100%; padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: transparent; text-align: left; }
.channel-browser-results { margin-top: 1rem; max-height: 45vh; overflow: auto; border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.channel-browser-results > button { display: flex; flex-direction: column; gap: .35rem; width: 100%; padding: 1rem; border: 0; border-bottom: 1px solid var(--border-color); background: transparent; text-align: left; }
.channel-browser-results > button:hover, .channel-browser-create:hover { background: var(--bg-hover); }
.channel-browser-results strong { display: flex; align-items: center; gap: .45rem; font-size: .9375rem; }
.channel-browser-results span { color: var(--text-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.channel-browser-results small { color: var(--text-muted); font-size: var(--text-xs); }
@media (hover: none) {
  .channel-message-actions { position: static; opacity: 1; width: fit-content; margin-top: .35rem; }
  .channel-members .icon-btn, .channel-room-header h3 .icon-btn { opacity: 1; }
}
@media (max-width: 720px) {
  .channels-layout { flex-direction: column; }
  .channel-directory { flex: 0 0 auto; max-height: 11rem; border-right: 0; border-bottom: 1px solid var(--border-color); }
  .channel-community-mark, .channel-filters, .channel-browse, .channel-message-search { display: none; }
  .channel-links { display: flex; overflow-x: auto; gap: .15rem; }
  .channel-section { display: none; }
  .channel-link { width: auto; flex: 0 0 auto; max-width: 12rem; }
  .channel-post-content { padding-right: 0; }
}
.channel-harness-dialog {
  box-sizing: border-box;
  width: min(38rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 3rem);
  overflow: auto;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--surface-0);
  color: var(--text);
  font-size: var(--text-sm);
}
.channel-harness-dialog::backdrop { background: #0009; }
.channel-harness-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.channel-harness-dialog h2 { margin: 0; font-size: 1.125rem; }
.channel-run-permissions summary { cursor: pointer; color: var(--text-muted); font-size: var(--text-ui); }
.channel-harness-dialog blockquote { margin: 1rem 0; padding: .75rem; border-left: 2px solid var(--border-color); overflow-wrap: anywhere; white-space: pre-wrap; max-height: 9rem; overflow: auto; }
.channel-run-result { display: grid; gap: .75rem; }
.channel-run-result label { display: grid; gap: .5rem; }
.channel-run-result textarea { box-sizing: border-box; width: 100%; resize: vertical; min-height: 8rem; padding: .75rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg); color: inherit; font: inherit; }
.channel-route-control { min-width: 0; padding: 0.65rem 0.35rem; border-bottom: 1px solid var(--border-color); margin-bottom: 0.5rem; font-size: var(--text-ui); }
.channel-route-heading, .channel-route-run { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; min-width: 0; }
.channel-route-heading > svg { flex: none; color: var(--text-muted); }
.channel-route-heading > button { text-align: start; white-space: normal; }
.channel-route-heading select, .channel-route-settings select { max-width: 100%; min-width: 0; background: var(--surface-0); color: var(--text); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.35rem 0.5rem; font: inherit; }
.channel-route-settings { display: grid; gap: 0.9rem; padding-block: 0.65rem; font-size: var(--text-sm); }
.channel-route-dialog { width: min(32rem, calc(100vw - 2rem)); }
.channel-harness-dialog .primary { border: 1px solid transparent; border-radius: var(--radius-md); background: var(--text); color: var(--bg); padding: 0.6rem 0.85rem; font: inherit; font-weight: 600; cursor: pointer; }
.channel-harness-dialog .primary:disabled { opacity: 0.45; cursor: not-allowed; }
.channel-harness-dialog .primary:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.channel-route-settings > .primary { justify-self: start; margin-top: 0.5rem; white-space: normal; }
.channel-route-settings label { display: grid; gap: 0.25rem; }
.channel-route-settings p, .channel-route-control > p { margin: 0.4rem 0 0; }
.channel-route-run { margin-top: 0.45rem; }
.channel-route-run > span { color: var(--text-muted); }

.channel-connection-menu > div, .channel-mention-menu, .channel-emoji-picker {
  border-color: var(--border-strong);
  border-radius: var(--popover-radius);
  box-shadow: var(--shadow-raised);
}
.channel-dialog, .channel-profile-dialog, .channel-harness-dialog {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  border-radius: var(--dialog-radius);
  box-shadow: var(--shadow);
}
.channel-dialog::backdrop, .channel-profile-dialog::backdrop, .channel-harness-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.channel-job-status { display: inline-flex; align-items: center; gap: .4rem; margin-top: .45rem; padding: .3rem .6rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-hover); color: var(--text-muted); font-size: var(--text-xs); }
.channel-job-status:hover { color: var(--text); }
.channel-saved-routes { list-style: none; padding: 0; font-size: var(--text-ui); }
.channel-saved-routes li { padding: .8rem 0; border-top: 1px solid var(--border-color); overflow-wrap: anywhere; }
.channel-saved-routes p { margin: .35rem 0; }
.channel-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.channel-profile-about { font-size: var(--text-sm); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.channel-profile-about small { color: var(--text-muted); }
/* Plugins: the installed list, the install screen, and what a plugin adds. */
.plugins-git {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  min-width: 0;
}
.plugins-git input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: var(--text-xs);
}

.plugin-row-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
  font-size: var(--text-ui);
}
.plugin-author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.plugin-row-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.plugin-row-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.plugin-missing {
  margin: 0.25rem 0 0;
  color: var(--yellow);
  font-size: var(--text-xs);
}
.plugin-details {
  margin-top: 0.35rem;
}
.plugin-details > summary {
  font-size: var(--text-xs);
}
.plugin-details > :not(summary) {
  margin-left: 0.75rem;
  margin-right: 0.75rem;
}
.plugin-details > :last-child {
  margin-bottom: 0.75rem;
}
.commands-card-actions button.plugin-uninstall {
  color: var(--red);
}

.plugin-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  line-height: 1.5;
  white-space: nowrap;
}
.plugin-tag[data-runs] {
  border-color: color-mix(in srgb, var(--yellow) 45%, transparent);
  color: var(--yellow);
}
.plugin-tag[data-dev] {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

.plugin-contents {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
  min-width: 0;
}
.plugin-section h4,
.plugin-install-options h4 {
  margin: 0 0 0.25rem;
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 600;
}
.plugin-section ul {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.plugin-section li {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding: 0;
  border: 0;
}
.plugin-item-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
  font-size: var(--text-xs);
}
.plugin-item-head strong {
  font-weight: 600;
}
.plugin-run {
  display: block;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--text-2xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.plugin-empty {
  margin: 0.5rem 0 0;
  font-size: var(--text-xs);
}

.plugin-problems {
  display: grid;
  gap: 0.25rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}
.plugin-problems li {
  display: grid;
  gap: 0.1rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--yellow) 35%, transparent);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text);
}
.plugin-problems li[data-severity="error"] {
  border-color: color-mix(in srgb, var(--red) 45%, transparent);
}
.plugin-problem-where {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: var(--text-2xs);
}

.plugin-options {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.plugin-option {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  font-size: var(--text-xs);
}
.plugin-option label {
  color: var(--text);
  font-weight: 500;
}
.plugin-option input,
.plugin-option select {
  width: 100%;
  min-width: 0;
}
.plugin-option-path {
  font-family: var(--mono);
}
.plugin-option-inline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}
.plugin-option-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  line-height: 1.4;
}
.plugin-approve {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-color);
}
.plugin-install-options {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-color);
}

.plugin-install-dialog {
  display: flex;
  flex-direction: column;
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
}
.plugin-install-dialog .dialog-header {
  flex-shrink: 0;
  min-width: 0;
}
.plugin-install-dialog .dialog-header > div {
  min-width: 0;
}
.plugin-source {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  font-family: var(--mono);
  font-size: var(--text-2xs);
}
.plugin-install-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.dialog .plugin-description {
  margin: 0 0 0.5rem;
  color: var(--text);
}
.dialog .plugin-replaces {
  margin: 0 0 0.5rem;
  font-size: var(--text-xs);
}
.dialog .plugin-rights {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.25rem 0 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--yellow) 40%, transparent);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-xs);
}
.dialog .plugin-rights svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--yellow);
}
.plugin-install-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-top: 1rem;
}
/* Agent-created tasks: who made a card, and whether such cards may start. */
.board-card-origin { display: flex; align-items: center; gap: 0.25rem; margin: 0; font-size: var(--text-xs); color: var(--text-faint); min-width: 0; }
.board-card-origin > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card-origin > svg { flex: none; }
.board-agent-tasks { position: relative; margin-left: auto; }
.board-agent-tasks > summary { list-style: none; cursor: pointer; gap: 0.35rem; }
.board-agent-tasks > summary::-webkit-details-marker { display: none; }
.board-agent-tasks-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 20;
  width: min(22rem, calc(100vw - 2rem));
  padding: 0.75rem;
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
  font-size: var(--text-ui);
  color: var(--text);
}
.board-agent-tasks-panel p { margin: 0; font-size: var(--text-xs); line-height: 1.45; color: var(--text-muted); }
.board-agent-tasks-panel p.muted { color: var(--text-faint); }
.board-agent-tasks-switch { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; }
.board-agent-tasks-switch input { margin-top: 0.15rem; }
/* Board: threads as cards in status columns. */
.board-page {
  background: var(--bg);
  overflow: hidden;
  padding: 0.75rem 1rem 1rem;
  gap: 0.625rem;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--control-h-md);
}

.board-scope,
.board-segmented {
  display: inline-flex;
  padding: 0.125rem;
  gap: 0.125rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  min-width: 0;
}
.board-scope button,
.board-segmented button {
  height: calc(var(--control-h-sm) - 0.375rem);
  padding: 0 0.625rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-scope button:hover:not(:disabled),
.board-segmented button:hover { color: var(--text); }
.board-scope button.active,
.board-segmented button.active {
  background: var(--surface-1);
  color: var(--text);
  box-shadow: var(--shadow);
}
.board-scope button:disabled { opacity: var(--disabled-opacity); cursor: default; }
.board-scope button:focus-visible,
.board-segmented button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }

.board-readonly { color: var(--text-faint); font-size: var(--text-xs); }

.board-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.board-banner > span { flex: 1; min-width: 0; }
.board-banner.error { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border-color)); }

.board-empty {
  margin: 4rem auto 0;
  max-width: 26rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: var(--text-sm);
}
.board-empty p { margin: 0; }
.board-empty .muted { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.5; }
.board-empty .chip { margin-top: 0.5rem; }

.board-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(12rem, 1fr);
  gap: 0.625rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.board-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border-color);
}
.board-column > header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.375rem 0 0.75rem;
  height: 2.25rem;
  flex: none;
}
.board-column > header .icon-btn { width: 1.5rem; height: 1.5rem; }
.board-column h2 {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.board-count { color: var(--text-faint); font-size: var(--text-xs); font-variant-numeric: tabular-nums; flex: 1; }
.board-column.column-needs-you h2 { color: var(--yellow); }

.board-cards {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0 0.375rem 0.5rem;
}

.board-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--surface-1);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--motion-instant) var(--ease-in-out), background var(--motion-instant) var(--ease-in-out);
}
.board-card:hover { border-color: var(--border-strong); }
.board-card:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.board-card.needs-you { border-left: 2px solid var(--yellow); }
.board-card.linking { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.board-card-title {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.3;
}
.board-card-title > :first-child { flex: none; margin-top: 0.1rem; }
.board-card-title > span {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.board-card-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}
.board-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  max-width: 9rem;
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.board-badge > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.board-badge > svg { flex: none; }
.board-badge.quiet { font-family: var(--font); background: transparent; padding-inline: 0; color: var(--text-faint); }
.board-elapsed { margin-left: auto; font-variant-numeric: tabular-nums; flex: none; }

.board-card-step,
.board-card-alert,
.board-card-after {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-card-step { color: var(--text-muted); }
.board-card-step.loading { padding-top: 0.25rem; }
.board-card-step.loading .skeleton-line { margin: 0; height: 0.5rem; }
.board-card-alert { color: var(--yellow); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.board-card-after { display: flex; align-items: center; gap: 0.25rem; color: var(--text-faint); }
.board-card-after > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.board-card-after small { flex: none; font-size: inherit; }

.board-card-actions { display: flex; gap: 0.25rem; margin-top: 0.15rem; min-width: 0; container-type: inline-size; }
.board-card-actions .chip { height: var(--control-h-xs); padding: 0 0.5rem; font-size: var(--text-2xs); gap: 0.25rem; }
.board-card-actions .chip.quiet { border-color: transparent; padding: 0 0.375rem; }
.board-card-actions .chip.quiet:hover { border-color: var(--border-color); }

.board-link-menu { position: relative; display: inline-flex; min-width: 0; }
.board-link-menu > .chip { flex-shrink: 1; min-width: 0; }
.board-link-menu > .chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* A clipped "Depe…" reads as broken; on a narrow card the link icon stands alone, named by its tooltip. */
@container (max-width: 15.5rem) {
  .board-link-menu > .chip > span { display: none; }
}
.board-menu {
  position: fixed;
  z-index: var(--z-menu);
  min-width: 12rem;
  max-width: 18rem;
  display: flex;
  flex-direction: column;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--popover-radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
}
.board-menu p { margin: 0; padding: 0.375rem 0.5rem; font-size: var(--text-xs); color: var(--text-muted); }
.board-menu button,
.board-dialog-list button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  font-size: var(--text-xs);
  text-align: left;
  cursor: pointer;
}
.board-menu button > span:last-child,
.board-dialog-list button > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-menu button:hover,
.board-menu button:focus-visible,
.board-dialog-list button:hover,
.board-dialog-list button:focus-visible { background: var(--bg-hover); outline: none; }
.board-menu-list { min-height: 0; overflow-y: auto; }
.board-menu-separator { flex: none; height: 1px; margin: 0.25rem 0.375rem; background: var(--border-color); }
.board-menu-check {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 0.875rem;
  height: 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  color: var(--accent);
}

.board-card-dialog { width: min(36rem, calc(100vw - 2rem)); display: flex; flex-direction: column; gap: 0.75rem; }
.board-card-dialog label { display: flex; flex-direction: column; gap: 0.3rem; }
.board-card-dialog label > span,
.board-dialog-field > span,
.board-dialog-depends legend { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-medium); }
.board-card-dialog textarea { resize: vertical; min-height: 6rem; font: inherit; font-size: var(--text-sm); }
.board-dialog-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.board-dialog-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.board-dialog-depends legend { padding: 0; margin-bottom: 0.3rem; }
.board-dialog-depends { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.board-dialog-depends .muted { margin: 0; font-size: var(--text-xs); color: var(--text-faint); }
.board-dialog-list {
  max-height: 8.5rem;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.board-card-dialog label.board-dialog-toggle { flex-direction: row; align-items: center; gap: 0.4rem; font-size: var(--text-xs); color: var(--text); }
.board-card-dialog label.board-dialog-toggle > span { color: var(--text); font-weight: var(--weight-regular); }

@media (max-width: 720px) {
  .board-page { padding: 0.5rem; }
  .board-columns { grid-auto-columns: minmax(13rem, 82vw); }
}
/* Settings → Appearance: theme lists and the backdrop picker. */
.theme-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.7rem;
}
@container (max-width: 34rem) {
  .theme-lists { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .theme-lists { grid-template-columns: minmax(0, 1fr); }
}
.theme-list-wrap { display: grid; gap: 0.35rem; align-content: start; min-width: 0; }
.theme-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--control-h-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.theme-copy { font-size: var(--text-xs); text-transform: none; letter-spacing: 0; }
.theme-list {
  display: grid;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-hover);
}
.theme-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--control-h-lg);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-ui);
  cursor: default;
  outline: none;
}
.theme-option:hover { background: var(--bg-hover); }
.theme-option:focus-visible { box-shadow: 0 0 0 var(--ring-width) var(--ring); }
.theme-option.active { background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--border-strong); }
.theme-option.active:focus-visible { box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 var(--ring-width) var(--ring); }
.theme-option-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-option-source { font-size: var(--text-2xs); color: var(--text-faint); }
.theme-option-warning {
  font-size: var(--text-2xs);
  color: var(--yellow);
  white-space: nowrap;
}
.theme-swatch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid;
  border-radius: var(--radius-sm);
}
.theme-swatch > span { width: 0.6rem; height: 0.6rem; border-radius: var(--radius-full); }
.theme-contrast { font-size: var(--text-xs); color: var(--text-muted); }
.theme-contrast summary { cursor: default; }
.theme-contrast ul { margin: 0.3rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.15rem; }
.theme-import {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.theme-import input { flex: 1 1 14rem; min-width: 0; }
.theme-note { margin: 0.5rem 0 0; font-size: var(--text-xs); }
.theme-message { margin: 0.5rem 0 0; font-size: var(--text-xs); color: var(--text-muted); }
.theme-message.is-error { color: var(--red); }

.backdrop-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.backdrop-tile {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  min-width: 0;
  padding: 0.4rem 0.4rem 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.backdrop-tile.active { border-color: var(--accent); color: var(--text); background: var(--bg-elevated); }
.backdrop-tile-stage {
  position: relative;
  width: 100%;
  height: 3rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
}
.backdrop-tile-stage::before { content: ""; position: absolute; inset: 0; }
.backdrop-tile-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backdrop-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.4rem 1rem;
  margin-top: 0.85rem;
}
.backdrop-slider {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-ui);
  color: var(--text-muted);
}
.backdrop-slider .mono { font-size: var(--text-xs); text-align: right; }
.backdrop-slider select { grid-column: 2 / 4; }
.backdrop-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
/* Settings → Shortcuts, the shortcuts sheet's chords, and the sequence hint. */
.shortcut-chord { display: inline-flex; gap: 0.2rem; }
.shortcut-chord + .shortcut-chord { margin-left: 0.35rem; }
.shortcut-binding + .shortcut-binding { margin-left: 0.6rem; }
.shortcut-context {
  margin-left: 0.45rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  font-size: var(--text-2xs);
  color: var(--text-muted);
}
.keybindings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.keybindings-head .ghost { flex-shrink: 0; }
.keybindings-search { display: flex; align-items: center; gap: 0.45rem; margin: 0.75rem 0 0.5rem; }
.keybindings-search > :first-child { flex: 1; min-width: 0; }
.keybindings-keysearch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--control-h-md);
  cursor: text;
}
.keybindings-keysearch.capturing { box-shadow: 0 0 0 var(--ring-width) var(--ring); }
.keybindings-keysearch kbd,
.shortcut-keys kbd,
.chord-hint kbd {
  min-width: 1.35rem;
  padding: 0 0.3rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  font: inherit;
  font-size: var(--text-xs);
  text-align: center;
  color: var(--text-muted);
}
.keybindings-conflicts {
  margin: 0.25rem 0 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--yellow) 45%, var(--border-color));
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.keybindings-conflicts strong { color: var(--text); font-weight: var(--weight-semibold); }
.keybindings-conflicts ul { margin: 0.3rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.15rem; }
.keybindings-empty { margin: 0.75rem 0; font-size: var(--text-ui); }
.keybindings-add { margin-top: 0.6rem; }
.keybindings-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-top: 0.6rem; }
.keybindings-add-row select { flex: 1 1 10rem; min-width: 0; }
.keybindings-note { margin: 0.6rem 0 0; font-size: var(--text-xs); }
.chord-hint {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: var(--z-palette);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  transform: translateX(-50%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
  font-size: var(--text-xs);
  color: var(--text-muted);
  pointer-events: none;
}
.shortcut-row .shortcut-unbind { opacity: 0; transition: opacity var(--motion-fast) var(--motion-ease); }
.shortcut-row:hover .shortcut-unbind,
.shortcut-row:focus-within .shortcut-unbind { opacity: 1; }
.shortcut-binding.is-dead kbd { text-decoration: line-through; color: var(--text-faint); }
/* A sequence is four keys wide, so the sheet makes room and its columns may shrink their labels. */
.shortcuts-sheet { width: min(46rem, calc(100vw - 2rem)); }
.shortcuts-sheet .shortcuts-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 52rem) { .shortcuts-sheet .shortcuts-list { grid-template-columns: minmax(0, 1fr); } }
/* Open in: the split button, the app list it opens, and its Settings card. */
.open-in-icon { flex-shrink: 0; width: 1rem; height: 1rem; object-fit: contain; }
.open-in-icon-blank, .open-in-icon-glyph { display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.open-in-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.open-in-control { position: relative; display: flex; align-items: stretch; min-width: 0; border-radius: var(--radius-sm); }
.open-in-control button {
  display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0;
  border: 0; background: transparent; color: var(--text); font: inherit; cursor: default;
}
.open-in-control button:hover, .open-in-control button[aria-expanded="true"] { background: var(--bg-hover); }
.open-in-control button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }

/* In Conversation details: a full-width row like the actions below it. */
.open-in-row { margin: 0.3rem -0.4rem 0; }
.open-in-row .open-in-primary {
  flex: 1; min-height: var(--control-h-md); padding: 0 0.4rem; border-radius: var(--radius-sm);
  font-size: var(--text-ui); text-align: left;
}
.open-in-row .open-in-more { flex-shrink: 0; width: var(--control-h-md); justify-content: center; border-radius: var(--radius-sm); color: var(--text-faint); }
/* Line the row's glyph up with the 14px icons in the rows above it. */
.open-in-row .open-in-primary { gap: 0.55rem; }
.open-in-row .open-in-icon-glyph { width: 0.875rem; }
.open-in-kbd { flex-shrink: 0; color: var(--text-faint); font-family: inherit; font-size: var(--text-2xs); }

/* In a surface header: as tall as the ghost buttons beside it. */
.open-in-bar { border: 1px solid var(--border-color); flex-shrink: 1; max-width: 12rem; }
.open-in-bar .open-in-primary { min-height: var(--control-h-sm); padding: 0 0.5rem; font-size: var(--text-xs); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.open-in-bar .open-in-primary:only-child { border-radius: var(--radius-sm); }
.open-in-bar .open-in-more { padding: 0 0.3rem; border-left: 1px solid var(--border-color); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-muted); }

.open-in-picker { width: min(17rem, calc(100vw - 2rem)); max-height: min(26rem, calc(100vh - 5rem)); }
.open-in-picker [role="menu"] { display: flex; flex-direction: column; gap: 0.125rem; }
.open-in-heading { margin: 0; padding: 0.35rem 0.65rem 0.2rem; color: var(--text-faint); font-size: var(--text-2xs); }
.topbar-dropdown-menu .open-in-item { width: 100%; font-size: var(--text-ui); }
.topbar-dropdown-menu .open-in-item:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); background: var(--bg-hover); }
.open-in-favorite { display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; color: var(--text-faint); }
.open-in-favorite kbd { font-family: inherit; font-size: var(--text-2xs); }
.open-in-note { margin: 0; padding: 0.4rem 0.65rem; color: var(--text-faint); font-size: var(--text-xs); line-height: 1.4; }
.open-in-error { color: var(--red); }
.open-in-footer { display: flex; flex-direction: column; gap: 0.125rem; margin-top: 0.2rem; padding-top: 0.2rem; border-top: 1px solid var(--border-color); }

.open-in-settings-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.15rem; }
.open-in-settings-row { display: flex; align-items: center; gap: 0.65rem; min-height: 2.4rem; padding: 0 0.25rem; border-radius: var(--radius-sm); }
.open-in-settings-row:hover { background: var(--bg-hover); }
.open-in-settings-row > .open-in-icon { width: 1.5rem; height: 1.5rem; }
.open-in-settings-copy { display: grid; flex: 1; min-width: 0; font-size: var(--text-ui); }
.open-in-settings-copy .faint { font-size: var(--text-2xs); }
.open-in-star { color: var(--text-faint); }
.open-in-star.active { color: var(--yellow); }
.open-in-star.active svg { fill: currentColor; }
/* Agent profiles and MCP servers: lists in Settings, the composer picker and the titlebar chip. */

.profile-dot {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: var(--radius-full);
  background: var(--profile-color, var(--text-faint));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 14%, transparent);
}
.agent-profile-choice .profile-dot { margin: 0 0.075rem 0 0.2rem; }

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.35rem;
  margin-left: 0.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  white-space: nowrap;
}

.profiles-card-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.profiles-card-row strong { font-weight: 600; }
.profiles-card-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
}
.profiles-card-line {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.mcp-row-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.mcp-row-head code { font-weight: 600; }
.mcp-row-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}
.mcp-row-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.mcp-detail {
  margin: 0.25rem 0 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mcp-status {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.mcp-status[data-state="offered"] { color: var(--text); }
.mcp-status[data-state="needs-env"] { color: var(--text); font-weight: 500; }
.mcp-test {
  margin: 0.35rem 0 0;
  font-size: var(--text-xs);
}
.mcp-test[data-ok="false"] { color: var(--red); }
.mcp-test pre {
  max-height: 8rem;
  margin: 0.3rem 0 0;
  overflow: auto;
  white-space: pre-wrap;
}
.mcp-reach {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}
.mcp-reach th,
.mcp-reach td {
  padding: 0.3rem 0.5rem 0.3rem 0;
  border-top: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
}
.mcp-reach th { color: var(--text-muted); font-weight: 500; }
.mcp-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.mcp-link:hover { text-decoration-color: currentColor; }
.mcp-link:disabled { color: var(--text-faint); cursor: default; }
.mcp-link:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.automation-row-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}
.automation-row-head strong { font-weight: 600; font-size: var(--text-sm); }
.automation-row-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}
.automation-row-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.automation-schedule,
.automation-last {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.automation-problem { color: var(--red); }
.automation-last[data-status="failed"] { color: var(--red); }
.automation-prompt {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.automations-card li[data-enabled="false"] .automation-row-head strong { color: var(--text-muted); }
.automation-missed {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--yellow) 45%, var(--border-color));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--yellow) 8%, transparent);
  font-size: var(--text-xs);
}
.automation-missed span { margin-right: auto; }
.automation-rules {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* Sidebar: a thread an automation started. */
.thread-automation {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  line-height: 1.5;
}
/* Export, share links and presence. */
.dialog.share-dialog { width: min(34rem, calc(100vw - 2rem)); }
.dialog .share-dialog-lede { margin: 0.25rem 0 0.9rem; color: var(--text-muted); font-size: var(--text-ui); line-height: 1.45; overflow-wrap: anywhere; }
.share-dialog-lede b { color: var(--text); font-weight: 500; }
.dialog .share-reach, .dialog .share-hint, .dialog .share-empty { margin: 0 0 0.6rem; color: var(--text-muted); font-size: var(--text-xs); line-height: 1.4; }
.dialog .share-hint { margin-top: 0.5rem; color: var(--text-faint); }
.share-error, .dialog p.share-error { margin: 0.5rem 0 0; color: var(--red); font-size: var(--text-xs); overflow-wrap: anywhere; }

.share-options { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; padding: 0; border: 0; }
.share-option {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-color); border-radius: var(--radius-md); cursor: pointer;
}
.share-option:hover { background: var(--bg-hover); }
.share-option:has(input:focus-visible) { outline: var(--focus-ring); outline-offset: 1px; }
.share-option input { margin: 0.15rem 0 0; accent-color: var(--text); }
.share-option span { display: flex; flex-direction: column; gap: 0.1rem; font-size: var(--text-ui); }
.share-option b { font-weight: 500; }
.share-option small { color: var(--text-muted); font-size: var(--text-xs); }

.share-expiry { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0.25rem 0 0.75rem; }
.share-expiry-label { margin-right: 0.35rem; color: var(--text-muted); font-size: var(--text-xs); }
.share-expiry-option {
  position: relative; padding: 0.25rem 0.65rem; border: 1px solid var(--border-color); border-radius: var(--radius-full);
  color: var(--text-muted); font-size: var(--text-xs); cursor: pointer;
}
.share-expiry-option:hover { background: var(--bg-hover); color: var(--text); }
.share-expiry-option.selected { border-color: var(--text); color: var(--text); font-weight: 500; }
.share-expiry-option input { position: absolute; opacity: 0; pointer-events: none; }
.share-expiry-option:has(input:focus-visible) { outline: var(--focus-ring); outline-offset: 1px; }

.share-created { display: flex; gap: 0.4rem; align-items: stretch; }
.share-url {
  flex: 1 1 auto; min-width: 0; padding: 0.4rem 0.55rem; border: 1px solid var(--border-color); border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--text) 3%, transparent); color: var(--text); font-size: var(--text-xs);
}
.share-url:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.share-copy { display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

.share-notice {
  display: flex; gap: 0.6rem; padding: 0.7rem 0.75rem; margin-bottom: 0.75rem;
  border: 1px solid var(--border-color); border-radius: var(--radius-md); background: color-mix(in srgb, var(--text) 3%, transparent);
  font-size: var(--text-ui);
}
.share-notice > svg { flex-shrink: 0; margin-top: 0.15rem; color: var(--text-muted); }
.dialog .share-notice p { margin: 0 0 0.55rem; }
.share-notice-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.share-links-heading { margin: 1rem 0 0.4rem; color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; }
.share-links { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border-color); border-radius: var(--radius-md); max-height: 12rem; overflow: auto; }
.share-links li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.35rem 0.4rem 0.35rem 0.7rem; font-size: var(--text-xs); }
.share-links li + li { border-top: 1px solid var(--border-color); }
.share-link-meta { min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-revoke { flex-shrink: 0; }
.dialog.share-dialog .actions { flex-wrap: wrap; margin-top: 1rem; }

.share-toast {
  position: fixed; z-index: var(--z-toast); bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.5rem; max-width: min(36rem, calc(100vw - 2rem));
  padding: 0.5rem 0.5rem 0.5rem 0.75rem; border: 1px solid var(--border-color); border-radius: var(--control-radius);
  background: var(--bg-elevated); box-shadow: var(--shadow-raised); color: var(--text); font-size: var(--text-ui);
}
.share-toast > svg { flex-shrink: 0; color: var(--text-muted); }
.share-toast > span { min-width: 0; overflow-wrap: anywhere; }
.share-toast.error > svg { color: var(--red); }

.presence-indicator {
  display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; margin-left: 0.5rem; padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full); background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; cursor: default;
}
.presence-indicator:hover { color: var(--text); }
.presence-indicator:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
@media (max-width: 760px) { .presence-indicator > span { display: none; } }

.share-settings { margin-top: 0.75rem; }
.share-settings-label { padding-left: 0 !important; margin-top: 0.75rem; }
.share-settings-list { margin: 0; padding: 0; list-style: none; }
.share-settings-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 6px; }
.share-settings-list li > div { min-width: 0; }
.share-thread-link {
  padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left;
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; cursor: pointer;
}
.share-thread-link.strong { color: var(--text); font-weight: 600; }
.share-thread-link:hover { text-decoration-color: currentColor; }
.share-thread-link:focus-visible { outline: var(--focus-ring); outline-offset: 1px; border-radius: 2px; }
.browser-find {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg);
}
.browser-find input { flex: 1; min-width: 0; height: var(--control-h-sm); font-size: var(--text-ui); }
.browser-find-count { min-width: 4.5rem; color: var(--text-muted); font-size: var(--text-xs); text-align: right; font-variant-numeric: tabular-nums; }
.preview-menu-kbd { margin-left: auto; color: var(--text-muted); font-family: var(--font); font-size: var(--text-xs); }
/* Device sizes: a fixed device keeps its CSS size and scrolls inside the panel. */
.embedded-browser-frame:not([data-device="responsive"]) {
  overflow: auto;
  background: var(--surface-0);
  padding: .75rem;
}
.embedded-browser-frame:not([data-device="responsive"]) .embedded-browser-webview {
  flex: 0 0 var(--device-width);
  width: var(--device-width);
  height: var(--device-height);
  margin-inline: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--border-color);
}
.embedded-browser-frame[data-inspecting] { box-shadow: inset 0 0 0 2px var(--ring); }

.preview-chrome-btn.browser-device-btn { width: auto; gap: .3rem; padding-inline: .4rem; }
.browser-device-size {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.browser-device-menu { min-width: 12rem; }
.browser-device-item { justify-content: space-between; gap: .75rem; }
.browser-device-item small { color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.browser-device-item[aria-checked="true"] { background: color-mix(in srgb, var(--text) 8%, transparent); font-weight: 600; }

/* The panel header is the container: a narrow panel keeps its room for the tabs. */
.inspector-head:has(.browser-head) { container: browser-head / inline-size; }
@container browser-head (max-width: 540px) {
  .browser-device-size { display: none; }
}
/* Follow agent: one quiet line above Files while a turn runs. */
.follow-agent-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.3rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-0);
  color: var(--text-muted);
  font-size: var(--text-xs);
  flex-shrink: 0;
}
.follow-agent-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-agent-text code { font-size: var(--text-xs); color: var(--text); }
.follow-agent-bar .ghost { flex: none; font-size: var(--text-xs); padding: 0.1rem 0.4rem; }
.follow-agent-dot {
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--green);
  animation: follow-agent-pulse 1.6s ease-in-out infinite;
}
@keyframes follow-agent-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .follow-agent-dot { animation: none; } }
/* A fixed height, so the dialog does not resize under the cursor while results narrow. */
.search-dialog.command-palette { height: min(31rem, calc(84dvh - 1rem)); }
.search-dialog.command-palette .palette-list { max-height: none; }
.command-palette .palette-empty { flex-shrink: 0; }

.search-dialog-copy mark {
  background: none;
  color: var(--text);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 0.18em;
}
.search-dialog-item[aria-disabled="true"] mark { color: inherit; }
/* ───────────── Folder drop on the sidebar ───────────── */
.sidebar.folder-drop-over { position: relative; }
.sidebar-drop-hint {
  position: absolute;
  inset: 0.5rem;
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-sidebar) 88%, transparent);
  color: var(--text);
  font-size: var(--text-ui);
  text-align: center;
  pointer-events: none;
}

/* ───────────── Dragging a project into place ───────────── */
.project-row.project-drop-target { position: relative; }
.project-row.project-drop-target::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0.5rem;
  right: 0.5rem;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--accent);
  pointer-events: none;
}
.project-row[draggable="true"] { cursor: default; }
/* ───────────── Toast stack ───────────── */
.toast-stack {
  position: fixed;
  z-index: var(--z-toast);
  top: calc(var(--workspace-topbar-height) + 0.5rem);
  right: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast-stack:empty { display: none; }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  min-height: var(--control-h-lg);
  padding: 0.375rem 0.375rem 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--popover-radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-raised);
  color: var(--text);
  font-size: var(--text-ui);
  animation: toast-enter var(--motion-standard) var(--motion-ease-arrival);
}
.toast-icon { flex-shrink: 0; color: var(--text-muted); }
.toast-success .toast-icon { color: var(--green); }
.toast-error { border-color: color-mix(in srgb, var(--red) 45%, var(--border-color)); }
.toast-error .toast-icon { color: var(--red); }
.toast-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.toast-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.toast-detail {
  color: var(--text-muted);
  font-size: var(--text-xs);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.toast-action {
  flex-shrink: 0;
  height: var(--control-h-sm);
  padding-inline: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--surface-0);
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: var(--weight-medium);
  cursor: pointer;
}
.toast-action:hover { background: var(--bg-hover); }
.toast-action:focus-visible, .toast-close:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.toast-close { flex-shrink: 0; }
@keyframes toast-enter {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
/* ───────────── Snooze dialog ───────────── */
.snooze-dialog { width: min(24rem, calc(100vw - 2rem)); }
.snooze-dialog h3 { margin: 0; }
.snooze-dialog .snooze-subject { margin: 0.25rem 0 0; color: var(--text-muted); font-size: var(--text-ui); }
.snooze-presets { display: flex; flex-direction: column; gap: 0.125rem; margin-top: 1rem; }
.snooze-preset {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: var(--control-h-lg);
  padding-inline: 0.5rem;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text);
  font-size: var(--text-ui);
  text-align: left;
  cursor: pointer;
}
.snooze-preset:hover, .snooze-preset:focus-visible { background: var(--bg-hover); }
.snooze-preset:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.snooze-preset kbd {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: var(--text-2xs);
}
.snooze-preset-time { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.snooze-custom { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.snooze-custom label { display: block; margin-bottom: 0.375rem; color: var(--text-muted); font-size: var(--text-xs); }
.snooze-custom-row { display: flex; gap: 0.5rem; }
.snooze-custom-row input { flex: 1; min-width: 0; height: var(--control-h-md); }
.snooze-custom-row button { flex-shrink: 0; }
.snooze-dialog .snooze-error { margin: 0.375rem 0 0; color: var(--red); font-size: var(--text-xs); }
.snooze-dialog .snooze-hint { margin: 0.75rem 0 0; color: var(--text-faint); font-size: var(--text-xs); }

/* ───────────── Unread and shelves in the sidebar ───────────── */
.thread-unread-dot {
  display: block;
  width: 0.4375rem;
  height: 0.4375rem;
  margin: auto;
  border-radius: var(--radius-full);
  background: var(--accent);
}
.thread-row.unread .thread-title .truncate { font-weight: var(--weight-semibold); color: var(--text); }
.thread-wake { color: var(--text-muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sidebar-shelf-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  height: var(--control-h-sm);
  padding-left: var(--sidebar-title-inset);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: left;
  cursor: pointer;
}
.sidebar-shelf-toggle:hover { color: var(--text); }
.sidebar-shelf-toggle:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); border-radius: var(--control-radius); }
.sidebar-shelf-toggle .shelf-count { color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* ───────────── Where the last visit ended, in the transcript ───────────── */
.thread-visit-rule {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0.5rem 0 1rem;
  color: var(--accent);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.01em;
}
.thread-visit-rule::before, .thread-visit-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--accent) 40%, transparent);
}

.site {
  --base: #faf9f6;
  --text: #252622;
  --subtext-1: #65665f;
  --text-faint: #65665f;
  --text-muted: #65665f;
  --bg-hover: #eeede7;
  --border-color: #deded6;
  --site-gutter: clamp(1.25rem, 4vw, 3rem);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--base);
  color: var(--text);
  color-scheme: light;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  font-size: 1rem;
  line-height: 1.6;
}
.site *, .site *::before, .site *::after { box-sizing: border-box; }
.site a { color: inherit; text-underline-offset: .25em; }
.site a:focus-visible, .site button:focus-visible, .site summary:focus-visible { outline: 2px solid var(--text); outline-offset: 5px; }
.site-skip { position: absolute; top: -5rem; left: 1rem; z-index: 20; padding: .75rem; background: var(--text); color: var(--base) !important; }
.site-skip:focus { top: .5rem; }
.site-bar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2rem; padding: 1.15rem var(--site-gutter); background: rgb(250 249 246 / 96%); border-bottom: 1px solid rgb(37 38 34 / 6%); }
.site-mark { display: inline-flex; justify-self: start; align-items: center; gap: .6rem; font-size: 1.125rem; font-weight: 650; letter-spacing: -.03em; text-decoration: none; }
.site-mark img { border-radius: .35rem; }
.site-nav, .site-footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.75rem; }
.site-nav a, .site-header-download { font-size: .8125rem; text-decoration: none; }
.site-nav a { color: var(--subtext-1); }
.site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }
.site-mobile-nav { display: none; }
.site-nav a:hover, .site-footer a:hover { text-decoration: underline; }
.site-header-download { justify-self: end; display: inline-flex; gap: 1rem; padding: .55rem 1rem; background: #eeede7; border-radius: .5rem; }
.site-header-download:hover { background: #e4e3dc; }
.site-hero { max-width: 62rem; margin: 0 auto; padding: 5rem var(--site-gutter) 3.5rem; text-align: center; }
.site-hero-badge { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1.5rem; padding: .3rem .7rem; border: 1px solid var(--border-color); border-radius: 2rem; color: var(--subtext-1); font-size: .75rem; }
.site-hero-badge span { width: .375rem; height: .375rem; border-radius: 50%; background: #737b60; }
.site-hero h1, .site-section h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.05em; text-wrap: balance; }
.site-hero h1 { margin: 0 0 1.5rem; font-size: clamp(2.65rem, 5vw, 4.5rem); line-height: 1.09; }
.site-hero h1 em { color: #777a6b; font-weight: 400; }
.site-lede { max-width: 36rem; margin: 0 auto; color: var(--subtext-1); font-size: 1rem; line-height: 1.75; }
.site-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: .65rem; margin: 1.75rem 0 1rem; }
.site-btn-primary, .site-btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 1.25rem; padding: .75rem 1.15rem; border: 1px solid transparent; border-radius: .5rem; font-size: .875rem; font-weight: 550; text-decoration: none; }
.site a.site-btn-primary { background: var(--text); color: var(--base); }
.site a.site-btn-primary:hover { background: #41423c; }
.site-btn-ghost { background: #eeede7; }
.site-btn-ghost:hover { background: #e4e3dc; }
.site-note { margin: 0; color: var(--subtext-1); font-size: .75rem; line-height: 1.7; }
.site-hero .site-note span { margin-inline: .4rem; }
.site-shot { max-width: 77rem; margin: 0 auto; padding: 0 var(--site-gutter); }
.site-shot-wrapper { padding: .6rem; background: #ecece5; border: 1px solid #deded5; border-radius: 1rem; }
.site-shot-caption { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem .5rem .7rem; font-size: .625rem; letter-spacing: .07em; color: var(--subtext-1); }
.site-shot-frame { height: 40rem; overflow: hidden; border: 1px solid #d1d1c8; border-radius: .5rem; background: #181818; box-shadow: 0 12px 30px -20px rgb(25 25 20 / 35%); }
.site-preview { display: block; width: 100%; height: 100%; border: 0; }
.site-shot-note { margin-top: 1rem; text-align: center; }
.site-section { max-width: 70rem; margin: 0 auto; padding: 7rem var(--site-gutter) 0; text-align: center; }
.site-eyebrow { margin: 0 0 1rem; font-size: .6875rem; font-weight: 550; letter-spacing: .12em; text-transform: uppercase; color: var(--subtext-1); }
.site-section h2 { margin: 0 auto 1.25rem; font-size: clamp(2rem, 3.6vw, 3.25rem); line-height: 1.15; }
.site-workflow-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.75rem; margin-top: 3rem; text-align: left; }
.site-workflow-grid article { border-top: 1px solid var(--border-color); padding-top: 1rem; }
.site-step { font: .6875rem var(--mono); color: var(--subtext-1); }
.site-workflow h3, .site-download h3 { margin: .85rem 0 .6rem; font-size: 1rem; line-height: 1.5; font-weight: 600; }
.site-workflow p, .site-download article > p, .site-source p, .site-question-list p { font-size: .875rem; line-height: 1.75; color: var(--subtext-1); }
.site-workflow a { font-size: .75rem; }
.site-text-link { display: inline-block; margin-top: 1rem; font-size: .8125rem; }
.site-harness-grid { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem; max-width: 45rem; margin: 2rem auto 1.5rem; padding: 0; list-style: none; }
.site-harness-grid li { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border: 1px solid var(--border-color); border-radius: .5rem; font-size: .8125rem; }
.site-harness-grid svg { color: #737b60; }
.site-questions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 4rem; text-align: left; }
.site-question-list details { border-bottom: 1px solid var(--border-color); }
.site-question-list details:first-child { border-top: 1px solid var(--border-color); }
.site-question-list summary { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 0; cursor: pointer; font-size: .9375rem; font-weight: 500; list-style: none; }
.site-question-list summary::-webkit-details-marker { display: none; }
.site-question-list summary::after { content: "+"; font-size: 1.25rem; line-height: 1.2; color: var(--subtext-1); }
.site-question-list details[open] summary::after { content: "−"; }
.site-question-list p { margin: 0 0 1.25rem; }
.site-download { max-width: 62rem; }
.site-download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin: 2.5rem 0 1.5rem; text-align: left; }
.site-download-grid article { background: #f0efe9; border: 1px solid #e5e4dc; border-radius: .75rem; padding: 1.75rem; }
.site-download-grid h3 { margin-top: 0; font-size: 1.25rem; }
.site-download-grid .site-note { margin-top: 1rem; font-size: .75rem; }
.site-source { text-align: left; margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.site-source summary { cursor: pointer; font-size: .875rem; }
.site-clone { display: flex; align-items: center; gap: .5rem; margin: 1rem 0; padding: .75rem; border: 1px solid var(--border-color); border-radius: .5rem; background: #eeede7; }
.site-clone code { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: normal; font: .75rem/1.7 var(--mono); }
.site-copy { flex-shrink: 0; border: 0; background: transparent; color: var(--text); cursor: pointer; padding: .5rem; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; max-width: 77rem; margin: 6rem auto 0; padding: 1.75rem var(--site-gutter) 2.5rem; border-top: 1px solid var(--border-color); color: var(--subtext-1); font-size: .75rem; }
.site-footer a { text-decoration: none; }
.site-footer { align-items: flex-start; }
.site-footer > div { max-width: 18rem; }
.site-footer p { font-size: .8125rem; }
.site-footer nav { align-items: flex-start; gap: clamp(2rem, 5vw, 5rem); }
.site-footer nav > div { display: grid; gap: .5rem; }
.site-footer nav > div > span { color: var(--text); margin-bottom: .5rem; font-weight: 600; }
.site-tour-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem; margin: 2rem 0 1.25rem; }
.site-tour-tabs button, .site-filter-group button { border: 1px solid transparent; border-radius: 2rem; background: transparent; padding: .6rem 1rem; color: var(--subtext-1); font: inherit; font-size: .8125rem; cursor: pointer; }
.site-tour-tabs button[aria-selected="true"], .site-filter-group button[aria-pressed="true"] { background: #e8e8df; color: var(--text); border-color: #d5d6ca; }
.site-tour-tabs button:hover, .site-filter-group button:hover { background: #eeede7; }
.site-tour-panel { display: grid; grid-template-columns: 1.4fr 1fr; border: 1px solid var(--border-color); border-radius: 1rem; overflow: hidden; text-align: left; }
.site-tour-visual { min-width: 0; background: #eeeee7; padding: 1.5rem; min-height: 22rem; display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; }
.site-example-label { display: block; font-size: .6875rem; color: var(--subtext-1); letter-spacing: .04em; }
.site-tour-copy { padding: clamp(1.5rem, 3vw, 2.5rem); align-self: center; }
.site-tour-copy h3 { font-family: Georgia, serif; font-size: 1.65rem; line-height: 1.25; font-weight: 400; letter-spacing: -.025em; margin: 1rem 0; }
.site-tour-copy p { font-size: .875rem; color: var(--subtext-1); }
.site-tour-copy a { font-size: .8125rem; }
.site-tour-conversation, .site-tour-diff, .site-tour-approval { padding: 1.25rem; background: var(--base); border: 1px solid var(--border-color); border-radius: .65rem; font-size: .8125rem; box-shadow: 0 10px 24px -20px rgb(20 25 15 / 30%); }
.site-tour-prompt { background: #e7e8df; padding: .6rem .8rem; border-radius: .5rem; margin-left: 1.5rem; }
.site-example-activity { display: grid; gap: .4rem; color: var(--subtext-1); padding-top: .75rem; border-top: 1px solid var(--border-color); }
.site-example-activity b { color: #456649; font-weight: 500; float: right; }
.site-tour-toolbar { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); font: .75rem var(--mono); }
.site-tour-diff pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .8125rem/1.8 var(--mono); margin-block: 2rem; }
.site-tour-diff code { font: inherit; }
.site-tour-footnote { color: var(--subtext-1); font-size: .6875rem; }
.site-tour-approval h3 { font-size: 1rem; font-weight: 550; margin-block: .8rem; }
.site-tour-approval > code { display: block; background: #eeede7; border-radius: .4rem; padding: .6rem .75rem; }
.site-example-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.5rem; }
.site-example-actions span { padding: .5rem .75rem; border: 1px solid var(--border-color); border-radius: .4rem; }
.site-example-actions span:last-child { color: var(--base); background: var(--text); }
.site-tour-pair { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.site-tour-pair > div { display: grid; gap: .25rem; background: var(--base); border: 1px solid var(--border-color); border-radius: .6rem; padding: .75rem 1.5rem; text-align: center; width: 100%; }
.site-tour-pair strong { font-size: .875rem; font-weight: 500; }
.site-tour-pair span { font-size: .6875rem; color: var(--subtext-1); }
.site-feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 2.5rem; text-align: left; }
.site-feature-card { border: 1px solid var(--border-color); border-radius: .75rem; padding: 1.25rem; text-decoration: none; }
.site-feature-card:hover { border-color: #929585; background: #f4f3ed; }
.site-feature-visual { height: 7rem; display: grid; place-items: center; font: .6875rem var(--mono); color: #5d6550; background: #edeee5; border-radius: .4rem; margin-bottom: 1.25rem; overflow: hidden; }
.site-feature-tools, .site-feature-channels { background: #eceae4; color: #6b6251; }
.site-feature-keys span { font: 1.4rem var(--mono); padding: .75rem 1rem; background: var(--base); border: 1px solid #d3d5c7; box-shadow: 0 3px 0 #d3d5c7; border-radius: .6rem; }
.site-feature-branch span, .site-feature-history span { padding-block: 1rem; border-block: 1px dashed #c3c7b8; }
.site-feature-status span { display: block; padding: .7rem; border: 1px solid #c3c7b8; border-radius: 2rem; font-size: .625rem; }
.site-feature-card h3 { display: flex; justify-content: space-between; gap: .5rem; font-size: .9375rem; font-weight: 550; margin: 0; }
.site-feature-card p { font-size: .8125rem; color: var(--subtext-1); margin-bottom: 0; }
.site-page-heading { max-width: 53rem; margin: 0 auto; padding: 5rem var(--site-gutter) 3rem; text-align: center; }
.site-page-heading h1 { font: 400 clamp(2.3rem, 4.5vw, 3.6rem)/1.12 Georgia, serif; letter-spacing: -.045em; text-wrap: balance; margin: 0 0 1.25rem; }
.site-page-heading > p:last-child { max-width: 36rem; margin-inline: auto; color: var(--subtext-1); }
.site-page-content { max-width: 66rem; margin: 0 auto; padding-inline: var(--site-gutter); }
.site-page-features { max-width: 77rem; }
.site-page-features > .site-section:first-child { padding-top: 1rem; }
.site-editorial { max-width: 40rem; margin-inline: auto; }
.site-editorial p, .site-editorial li { color: var(--subtext-1); font-size: .9375rem; line-height: 1.9; }
.site-editorial h2, .site-support-checklist h2 { font: 400 1.9rem/1.3 Georgia, serif; letter-spacing: -.035em; margin-top: 2.5rem; }
.site-editorial h3 { font-size: 1rem; margin-top: 1.75rem; font-weight: 550; }
.site-editorial .site-editorial-lead { font-size: 1.25rem; color: var(--text); }
.site-editorial blockquote { font: 400 2rem/1.3 Georgia, serif; letter-spacing: -.03em; margin: 2.5rem 0; padding: 1.5rem; border-left: 2px solid #939b80; background: #eeeee7; }
.site-resource-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.site-filter-group { display: flex; flex-wrap: wrap; gap: .25rem; }
.site-search input { border: 1px solid var(--border-color); border-radius: .5rem; background: transparent; color: var(--text); padding: .65rem .8rem; font: inherit; font-size: .875rem; width: 100%; }
.site-search input:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.site-resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem 1.5rem; margin-top: 1.5rem; }
.site-resource-card { text-decoration: none; }
.site-guide-cover { display: grid; place-items: center; height: 9rem; margin-bottom: 1.1rem; background: #ebede4; border: 1px solid #dfe1d4; border-radius: .65rem; font: italic 2.8rem Georgia, serif; color: #707960; }
.site-resource-card:nth-child(3n + 2) .site-guide-cover { background: #efebe3; border-color: #e3ded2; color: #80715c; }
.site-resource-card:nth-child(3n + 3) .site-guide-cover { background: #e7eceb; border-color: #d8dfdd; color: #6b7b78; }
.site-resource-card h2 { font-size: 1rem; line-height: 1.5; font-weight: 550; margin: .5rem 0; }
.site-resource-card:hover h2 { text-decoration: underline; text-underline-offset: .2em; }
.site-resource-card p { font-size: .8125rem; color: var(--subtext-1); margin: 0; }
.site-empty { padding: 3rem 1rem; text-align: center; background: #eeede7; border-radius: .5rem; margin-top: 1.5rem; }
.site-empty h2 { font: 400 1.8rem Georgia, serif; }
.site-empty button { font: inherit; font-size: .875rem; padding: .6rem 1rem; color: var(--base); background: var(--text); border: 0; border-radius: .4rem; cursor: pointer; }
.site-inline-callout { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-block: 2rem; margin-top: 3rem; border-block: 1px solid var(--border-color); }
.site-inline-callout h2 { font: 400 1.7rem Georgia, serif; letter-spacing: -.025em; margin: 0 0 .5rem; }
.site-inline-callout p { font-size: .875rem; color: var(--subtext-1); margin: 0; }
.site-inline-callout > a { flex-shrink: 0; }
.site-faq-groups > section + section { margin-top: 3rem; }
.site-faq-groups h2, .site-page-faq > h2 { font: 400 1.8rem Georgia, serif; letter-spacing: -.025em; margin: 0 0 1.5rem; }
.site-page-faq { max-width: 42rem; margin: 3rem auto 0; }
.site-page-faq.site-page-content, .site-page-content.site-page-faq { max-width: 48rem; margin-top: 0; }
.site-release { display: grid; grid-template-columns: 9rem 1fr; gap: 2rem; border-top: 1px solid var(--border-color); padding-top: 2rem; }
.site-release aside { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; }
.site-release-version { background: #e5e9db; border: 1px solid #d8dfc8; padding: .2rem .6rem; border-radius: 2rem; font-size: .8125rem; }
.site-release time { font-size: .75rem; color: var(--subtext-1); }
.site-release h2 { font: 400 2rem/1.25 Georgia, serif; letter-spacing: -.03em; margin-top: 0; }
.site-release h3 { font-size: .9375rem; font-weight: 550; margin-top: 2rem; }
.site-release p, .site-release li { font-size: .875rem; color: var(--subtext-1); }
.site-release li { padding-left: .25rem; margin-block: .75rem; }
.site-release ul { padding-left: 1rem; }
.site-roadmap > section { display: grid; grid-template-columns: 9rem 1fr; gap: 2rem; padding: 2rem 0; border-bottom: 1px solid var(--border-color); }
.site-roadmap > .site-note { margin-bottom: 2rem; }
.site-status-label { font-size: .75rem; color: #596847; }
.site-roadmap h2 { font-size: 1rem; font-weight: 550; margin-top: 0; }
.site-roadmap section p { font-size: .875rem; color: var(--subtext-1); }
.site-roadmap section a { display: inline-block; font-size: .8125rem; margin-right: 1rem; }
.site-cost-grid { display: grid; grid-template-columns: 1fr 1fr; padding: .5rem; gap: .5rem; border-radius: 1rem; background: #eeede7; }
.site-cost-grid section { padding: 2rem; }
.site-cost-grid section:first-child { background: var(--base); border: 1px solid var(--border-color); border-radius: .75rem; }
.site-cost-grid h2 { font-size: 2.5rem; line-height: 1.2; font-weight: 450; letter-spacing: -.04em; margin: 1rem 0; }
.site-cost-grid p:not(.site-eyebrow), .site-cost-grid li { color: var(--subtext-1); font-size: .875rem; }
.site-cost-grid .site-btn-primary, .site-cost-grid .site-btn-ghost { display: flex; margin-block: 1.5rem; }
.site-cost-grid ul { border-top: 1px solid var(--border-color); padding: 1.25rem 0 0 1rem; margin-top: 1.5rem; }
.site-cost-grid li { padding-block: .35rem; }
.site-cost-grid section > a:last-child { font-size: .8125rem; }
.site-support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.site-support-grid > a { padding: 1.5rem; border: 1px solid var(--border-color); border-radius: .6rem; text-decoration: none; }
.site-support-grid > a:hover { background: #eeede7; }
.site-support-grid h2 { font-size: 1rem; font-weight: 550; }
.site-support-grid p { font-size: .875rem; color: var(--subtext-1); }
.site-closing { text-align: center; margin: 5rem var(--site-gutter) 0; padding-top: 3rem; border-top: 1px solid var(--border-color); }
.site-closing h2 { font: 400 2.5rem/1.2 Georgia, serif; letter-spacing: -.035em; margin: 0 0 1rem; }
.site-closing p { font-size: .9375rem; color: var(--subtext-1); margin-bottom: 1.5rem; }
.site .policy-page { min-height: 0; padding-top: 3rem; }
@media (max-width: 1000px) { .site-feature-grid, .site-resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 850px) {
  .site-bar { grid-template-columns: 1fr auto; gap: 1rem; }
  .site-nav { display: none; }
  .site-mobile-nav { display: block; grid-column: 1 / -1; font-size: .8125rem; }
  .site-mobile-nav summary { cursor: pointer; text-align: center; }
  .site-mobile-nav nav { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; padding-top: 1rem; }
  .site-mobile-nav a { text-decoration: none; padding: .25rem; }
}
@media (max-width: 640px) {
  .site-tour-panel, .site-feature-grid, .site-resource-grid, .site-cost-grid, .site-support-grid, .site-release, .site-roadmap > section { grid-template-columns: minmax(0, 1fr); }
  .site-page-heading { padding-top: 3rem; }
  .site-tour-visual { min-height: 20rem; padding: 1rem; }
  .site-tour-copy { padding: 1.25rem; }
  .site-tour-tabs { justify-content: flex-start; }
  .site-tour-tabs button { padding: .5rem .75rem; }
  .site-page-features { padding-inline: 0; }
  .site-inline-callout { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .site-release, .site-roadmap > section { gap: 1rem; }
  .site-resource-controls { align-items: stretch; }
  .site-search { width: 100%; }
  .site-filter-group button { padding: .5rem .7rem; }
  .site-cost-grid section { padding: 1.25rem; }
  .site-footer nav { width: 100%; justify-content: space-between; }
}
.site-compact-preview { margin: 0; padding: 1.25rem; border: 1px solid var(--border-color); border-radius: .75rem; background: #f0efe9; font-size: .875rem; line-height: 1.65; }
.site-compact-preview figcaption { font-size: .75rem; color: var(--subtext-1); margin-bottom: 1.25rem; }
.site-sample-prompt { padding: .9rem 1rem; border: 1px solid var(--border-color); border-radius: .7rem; background: var(--base); }
.site-sample-label { color: var(--subtext-1); font-size: .75rem; margin: 1.25rem 0 .35rem; }
.site-sample-label + p { margin-top: 0; }
.site-sample-diff { margin: 1.25rem 0; border: 1px solid var(--border-color); border-radius: .5rem; overflow: hidden; background: var(--base); }
.site-sample-diff > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border-color); font: .75rem var(--mono); }
.site-sample-diff > div span { color: var(--subtext-1); }
.site-sample-diff pre { margin: 0; padding: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; font: .75rem/1.7 var(--mono); }
.site-sample-diff code { font: inherit; }
.site-diff-removed { color: #a1372c; }
.site-diff-added { color: #306b40; }
@media (max-width: 1000px) { .site-workflow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .site-bar { grid-template-columns: 1fr auto; gap: 1rem; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; justify-content: center; gap: 1.75rem; }
  .site-hero { padding-top: 3rem; padding-bottom: 2.5rem; }
  .site-hero h1 { font-size: clamp(2.35rem, 8.5vw, 3.2rem); }
  .site-desktop-break { display: none; }
  .site-section { padding-top: 4rem; }
  .site-workflow-grid, .site-download-grid, .site-questions { grid-template-columns: minmax(0, 1fr); }
  .site-workflow-grid, .site-questions { gap: 1.75rem; }
  .site-download-grid article { padding: 1.25rem; }
  .site-harness-grid { gap: .5rem; }
  .site-footer { margin-top: 3.5rem; }
  .site-footer nav { gap: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { .site { scroll-behavior: auto; } }
/**
 * Copyright (c) 2014 The xterm.js authors. All rights reserved.
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 * @license MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */

/**
 *  Default styles for xterm.js
 */

.xterm {
    cursor: text;
    position: relative;
    user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
}

.xterm.focus,
.xterm:focus {
    outline: none;
}

.xterm .xterm-helpers {
    position: absolute;
    top: 0;
    /**
     * The z-index of the helpers must be higher than the canvases in order for
     * IMEs to appear on top.
     */
    z-index: 5;
}

.xterm .xterm-helper-textarea {
    padding: 0;
    border: 0;
    margin: 0;
    /* Move textarea out of the screen to the far left, so that the cursor is not visible */
    position: absolute;
    opacity: 0;
    left: -9999em;
    top: 0;
    width: 0;
    height: 0;
    z-index: -5;
    /** Prevent wrapping so the IME appears against the textarea at the correct position */
    white-space: nowrap;
    overflow: hidden;
    resize: none;
}

.xterm .composition-view {
    /* TODO: Composition position got messed up somewhere */
    background: #000;
    color: #FFF;
    display: none;
    position: absolute;
    white-space: nowrap;
    z-index: 1;
}

.xterm .composition-view.active {
    display: block;
}

.xterm .xterm-viewport {
    /* On OS X this is required in order for the scroll bar to appear fully opaque */
    background-color: #000;
    overflow-y: scroll;
    cursor: default;
    position: absolute;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
}

.xterm .xterm-screen {
    position: relative;
}

.xterm .xterm-screen canvas {
    position: absolute;
    left: 0;
    top: 0;
}

.xterm-char-measure-element {
    display: inline-block;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: -9999em;
    line-height: normal;
}

.xterm.enable-mouse-events {
    /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
    cursor: default;
}

.xterm.xterm-cursor-pointer,
.xterm .xterm-cursor-pointer {
    cursor: pointer;
}

.xterm.column-select.focus {
    /* Column selection mode */
    cursor: crosshair;
}

.xterm .xterm-accessibility:not(.debug),
.xterm .xterm-message {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 10;
    color: transparent;
    pointer-events: none;
}

.xterm .xterm-accessibility-tree:not(.debug) *::selection {
  color: transparent;
}

.xterm .xterm-accessibility-tree {
  font-family: monospace;
  user-select: text;
  white-space: pre;
}

.xterm .xterm-accessibility-tree > div {
  transform-origin: left;
  width: fit-content;
}

.xterm .live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.xterm-dim {
    /* Dim should not apply to background, so the opacity of the foreground color is applied
     * explicitly in the generated class and reset to 1 here */
    opacity: 1 !important;
}

.xterm-underline-1 { text-decoration: underline; }
.xterm-underline-2 { text-decoration: double underline; }
.xterm-underline-3 { text-decoration: wavy underline; }
.xterm-underline-4 { text-decoration: dotted underline; }
.xterm-underline-5 { text-decoration: dashed underline; }

.xterm-overline {
    text-decoration: overline;
}

.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }

.xterm-strikethrough {
    text-decoration: line-through;
}

.xterm-screen .xterm-decoration-container .xterm-decoration {
	z-index: 6;
	position: absolute;
}

.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
	z-index: 7;
}

.xterm-decoration-overview-ruler {
    z-index: 8;
    position: absolute;
    top: 0;
    right: 0;
    pointer-events: none;
}

.xterm-decoration-top {
    z-index: 2;
    position: relative;
}



/* Derived from vs/base/browser/ui/scrollbar/media/scrollbar.css */

/* xterm.js customization: Override xterm's cursor style */
.xterm .xterm-scrollable-element > .scrollbar {
    cursor: default;
}

/* Arrows */
.xterm .xterm-scrollable-element > .scrollbar > .scra {
	cursor: pointer;
	font-size: 11px !important;
}

.xterm .xterm-scrollable-element > .visible {
	opacity: 1;

	/* Background rule added for IE9 - to allow clicks on dom node */
	background:rgba(0,0,0,0);

	transition: opacity 100ms linear;
	/* In front of peek view */
	z-index: 11;
}
.xterm .xterm-scrollable-element > .invisible {
	opacity: 0;
	pointer-events: none;
}
.xterm .xterm-scrollable-element > .invisible.fade {
	transition: opacity 800ms linear;
}

/* Scrollable Content Inset Shadow */
.xterm .xterm-scrollable-element > .shadow {
	position: absolute;
	display: none;
}
.xterm .xterm-scrollable-element > .shadow.top {
	display: block;
	top: 0;
	left: 3px;
	height: 3px;
	width: 100%;
	box-shadow: var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset;
}
.xterm .xterm-scrollable-element > .shadow.left {
	display: block;
	top: 3px;
	left: 0;
	height: 100%;
	width: 3px;
	box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset;
}
.xterm .xterm-scrollable-element > .shadow.top-left-corner {
	display: block;
	top: 0;
	left: 0;
	height: 3px;
	width: 3px;
}
.xterm .xterm-scrollable-element > .shadow.top.left {
	box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset;
}
:root {
  color-scheme: dark;

  /* Compact workspace geometry. Graphite pigment matching the Capsule mark. */
  --workspace-topbar-height: 52px;
  --workspace-traffic-inset: 90px;
  --workspace-titlebar-control-size: 1.75rem;
  --workspace-titlebar-control-gap: 0.35rem;
  --workspace-titlebar-content-left: calc(
    var(--workspace-traffic-inset) + var(--workspace-titlebar-control-size) +
      var(--workspace-titlebar-control-gap)
  );
  --sidebar-width: 18rem;
  --sidebar-min-width: 15rem;
  --sidebar-max-width: 22rem;
  --inspector-width: 32rem;
  --inspector-min-width: 22rem;
  --inspector-max-width: 60rem;
  --chat-max: 48rem;
  --control-radius: 0.375rem;
  --composer-radius: 1.25rem;
  --glass-blur: 16px;
  --glass-opacity: 80%;
  --glass-saturation: 1.08;
  --sidebar-content-inset: 0.5rem;
  --app-scrollbar-width: 6px;

  /* Graphite, matching the Capsule mark — not purple */
  --crust: #000000;
  /*
   * The sidebar sits on the same ground as the workspace, with its border
   * doing the separating. Pure black beside #0a0a0a read as two apps joined
   * down the middle, and on first launch — before the panes have painted
   * anything — that seam was the whole window.
   */
  --mantle: #0a0a0a;
  --base: #0a0a0a;
  --surface-0: #111111;
  --surface-1: #191919;
  --overlay-0: #5f5f5f;
  --overlay-1: #7d7d7d;
  --subtext-0: #949494;
  --subtext-1: #bdbdbd;
  --text: #f2f2f2;
  --accent: #f3f3ee;
  --accent-fg: #111111;
  --blue: #b0b0aa;
  --green: #8fbf88;
  --yellow: #d6c37a;
  --red: #d98989;

  /* Code has its own restrained palette, independent of interface accents.
     light-dark follows explicit themes and the system color-scheme. */
  --code-bg: light-dark(#f5f6f7, #1b1d1f);
  --code-text: light-dark(#24292f, #e4e6e8);
  --code-header: light-dark(#eef0f2, #202326);
  --code-border: light-dark(#d5d9dd, #34383d);
  --code-muted: light-dark(#59636e, #a0a6ad);
  /* Opaque diff surfaces keep syntax contrast stable over custom palettes
     and prevent scrolled code showing through pinned line numbers. */
  --diff-added-bg: light-dark(#edf5ed, #202b23);
  --diff-removed-bg: light-dark(#fbeded, #302325);
  --syntax-keyword: light-dark(#305d8a, #91b8e5);
  --syntax-string: light-dark(#40632d, #a8c990);
  --syntax-number: light-dark(#73550d, #dbc18a);
  --syntax-function: light-dark(#28646a, #91c2c6);
  --syntax-type: light-dark(#365f82, #a8c5df);
  --syntax-attribute: light-dark(#705b2e, #c9b994);
  --syntax-added: light-dark(#31643a, #a0c59a);
  --syntax-removed: light-dark(#9b3d3d, #dda0a0);
  --inline-code-bg: light-dark(rgb(0 0 0 / 5%), rgb(255 255 255 / 6%));
  --markdown-note: light-dark(#305d8a, #91b8e5);
  --markdown-tip: light-dark(#40632d, #a8c990);
  --markdown-important: light-dark(#28646a, #91c2c6);
  --markdown-warning: light-dark(#73550d, #dbc18a);
  --markdown-caution: light-dark(#9b3d3d, #dda0a0);

  --background: 0 0% 3.9%;
  --foreground: 60 14% 95%;
  --card: 0 0% 6.7%;
  --primary: 60 14% 95%;
  --primary-foreground: 0 0% 7%;
  --muted: 0 0% 9%;
  --muted-foreground: 0 0% 64%;
  --border: 0 0% 100% / 0.08;
  --sidebar-background: 0 0% 0%;
  --sidebar-foreground: 60 14% 95%;
  --good: 112 28% 64%;
  --warn: 44 52% 66%;
  --bad: 0 45% 69%;
  --radius: 0.5rem;
  --border-strong: rgb(255 255 255 / 14%);

  /* Keyboard focus. Offsetting the ring keeps it legible against the
     element's own background instead of blending into the border. */
  --ring: var(--accent, #f3f3ee);
  --ring-width: 2px;
  --ring-offset: 2px;

  /* Motion: feedback → state change → composed arrival. */
  --motion-instant: 100ms;
  --motion-fast: 140ms;
  --motion-standard: 180ms;
  --motion-arrival: 120ms;
  --motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-ease-arrival: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-distance-arrival: 0.25rem;
  --motion-blur-arrival: 0px;

  /* Typography scale. --type-scale is the user font-size preference knob;
     Cmd+/- zoom scales the root font-size (every rem), while this nudges
     only the type tokens so text resizes without moving layout. */
  --type-scale: 1;
  --type-rem: calc(1rem * var(--type-scale));
  --text-xs: calc(var(--type-rem) * 0.75);
  --text-sm: calc(var(--type-rem) * 0.875);
  --text-base: var(--type-rem);
  --text-lg: calc(var(--type-rem) * 1.125);
  --text-xl: calc(var(--type-rem) * 1.25);
  --text-message: var(--transcript-size, calc(var(--type-rem) * 0.9375));
  /* The steps between: badges, captions, and the default size of UI text. */
  --text-3xs: calc(var(--type-rem) * 0.625);
  --text-2xs: calc(var(--type-rem) * 0.6875);
  --text-ui: calc(var(--type-rem) * 0.8125);
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* Corner radius scale. Controls use sm, menus and cards md, popovers lg,
     dialogs and message bubbles xl, the composer 2xl. */
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 999px;

  /* Control heights on a 0.25rem grid. */
  --control-h-xs: 1.5rem;
  --control-h-sm: 1.75rem;
  --control-h-md: 2rem;
  --control-h-lg: 2.25rem;

  /* Stacking layers, lowest first. One table instead of numbers chosen per rule. */
  --z-base: 1;
  --z-sticky: 10;
  --z-dock: 40;
  --z-dialog: 50;
  --z-palette: 60;
  --z-menu: 130;
  --z-tooltip: 140;
  --z-toast: 150;

  /* Overlays enter and leave the same way: a short fade from slightly smaller. */
  --motion-overlay: 200ms;
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --enter-scale: 0.98;
  --press-scale: 0.97;
  --disabled-opacity: 0.64;

  /* One focus treatment. Rows inside scrolling lists use the inset offset so
     the ring is not clipped by the list's edge. */
  --focus-ring: 2px solid color-mix(in srgb, var(--ring) 70%, transparent);
  --focus-offset: 2px;
  --focus-offset-inset: -2px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --bg: var(--base);
  --text-muted: var(--subtext-0);
  --text-faint: var(--overlay-1);
  --bg-elevated: var(--surface-1);
  /* A sent message: one opaque step above the canvas, so it reads in both themes. */
  --surface-message: #1c1c1c;
  /* Below the canvas: inputs, wells, code and output panes. */
  --surface-sunken: color-mix(in srgb, var(--bg) 72%, #000);
  --bg-sidebar: var(--mantle);
  --bg-hover: rgb(255 255 255 / 6%);
  --bg-active: rgb(255 255 255 / 9%);
  --border-color: rgb(255 255 255 / 8%);
  --shadow-raised: 0 4px 16px -2px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.55), 0 4px 12px -2px rgba(0, 0, 0, 0.35);
  --popover-radius: var(--radius-lg);
  --dialog-radius: var(--radius-xl);
  --glass: color-mix(in srgb, var(--surface-0) var(--glass-opacity), transparent);

  /* Sidebar: optional gradient (graphite depth, not color) and active row
     treatment. Components read these semantically. */
  --sidebar-gradient-top: #0d0d0d;
  --sidebar-gradient-bottom: #050505;
  --sidebar-row-active-surface: rgb(255 255 255 / 16%);
  --sidebar-row-subtle-active-surface: rgb(255 255 255 / 9%);
}

html[data-theme="light"],
html[data-theme="system"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
  }
}

html[data-theme="light"] {
  --crust: #e8e8e4;
  --mantle: #ecece8;
  --base: #f4f4f1;
  --surface-0: #ffffff;
  --surface-1: #f0f0ec;
  --overlay-0: #6a6a66;
  --overlay-1: #7d7d78;
  --subtext-0: #5c5c58;
  --subtext-1: #3a3a36;
  --text: #161614;
  --accent: #1a1a18;
  --accent-fg: #f4f4f1;
  --blue: #4a5a66;
  --green: #3d6b3a;
  --yellow: #8a7018;
  --red: #a04848;
  --bg: var(--base);
  --text-muted: var(--subtext-0);
  --text-faint: var(--overlay-1);
  --bg-elevated: var(--surface-0);
  --surface-message: #e6e6e1;
  --surface-sunken: color-mix(in srgb, var(--bg) 94%, #000);
  --bg-sidebar: #ecece8;
  --shadow-raised: 0 8px 24px -12px rgb(0 0 0 / 0.12);
  --bg-hover: rgb(0 0 0 / 5%);
  --bg-active: rgb(0 0 0 / 8%);
  --border-color: rgb(0 0 0 / 8%);
  --border-strong: rgb(0 0 0 / 14%);
  --shadow: 0 24px 64px -24px rgb(0 0 0 / 0.18);
  --glass: color-mix(in srgb, var(--surface-0) 86%, transparent);
  --sidebar-gradient-top: #f0f0ec;
  --sidebar-gradient-bottom: #e6e6e2;
  --sidebar-row-active-surface: rgb(0 0 0 / 12%);
  --sidebar-row-subtle-active-surface: rgb(0 0 0 / 7%);
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    --crust: #e8e8e4;
    --mantle: #ecece8;
    --base: #f4f4f1;
    --surface-0: #ffffff;
    --surface-1: #f0f0ec;
    --overlay-0: #6a6a66;
    --overlay-1: #7d7d78;
    --subtext-0: #5c5c58;
    --subtext-1: #3a3a36;
    --text: #161614;
    --accent: #1a1a18;
    --accent-fg: #f4f4f1;
    --blue: #4a5a66;
    --green: #3d6b3a;
    --yellow: #8a7018;
    --red: #a04848;
    --bg: var(--base);
    --text-muted: var(--subtext-0);
    --text-faint: var(--overlay-1);
    --bg-elevated: var(--surface-0);
    --surface-message: #e6e6e1;
    --surface-sunken: color-mix(in srgb, var(--bg) 94%, #000);
    --bg-sidebar: #ecece8;
    --shadow-raised: 0 8px 24px -12px rgb(0 0 0 / 0.12);
    --bg-hover: rgb(0 0 0 / 5%);
    --bg-active: rgb(0 0 0 / 8%);
    --border-color: rgb(0 0 0 / 8%);
    --border-strong: rgb(0 0 0 / 14%);
    --shadow: 0 24px 64px -24px rgb(0 0 0 / 0.18);
    --glass: color-mix(in srgb, var(--surface-0) 86%, transparent);
    --sidebar-gradient-top: #f0f0ec;
    --sidebar-gradient-bottom: #e6e6e2;
    --sidebar-row-active-surface: rgb(0 0 0 / 12%);
    --sidebar-row-subtle-active-surface: rgb(0 0 0 / 7%);
  }
}

* { box-sizing: border-box; }
html, body, #root {
  height: 100%;
  min-height: 100%;
  width: 100%;
}
html, body {
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.45;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}
button, input, textarea, select { font: inherit; color: inherit; }
button:not(:disabled),
a[href],
summary,
[role="button"]:not([aria-disabled="true"]),
[role="menuitem"]:not([aria-disabled="true"]),
[role="option"]:not([aria-disabled="true"]),
[role="tab"]:not([aria-disabled="true"]) {
  cursor: pointer;
}
button:disabled, [aria-disabled="true"] { cursor: default; }

/* Baseline keyboard focus for everything that does not opt out. Pointer
   interaction never triggers this — :focus-visible only matches when the
   engine decides a focus ring is warranted. Capsule is palette-driven
   (Cmd+K, Tab through the sidebar), so this is load-bearing, not polish. */
:focus-visible {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: var(--ring-offset);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
::selection { background: rgb(255 255 255 / 0.16); }

/* Scrollbars: auto-fading thumbs — transparent at rest, visible on interaction. */
::-webkit-scrollbar { width: var(--app-scrollbar-width); height: var(--app-scrollbar-width); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 0%);
  border-radius: 99px;
  transition: background 200ms ease;
}
*:hover > ::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb:hover {
  background: rgb(255 255 255 / 12%);
}
::-webkit-scrollbar-thumb:active {
  background: rgb(255 255 255 / 20%);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover,
html[data-theme="light"] *:hover > ::-webkit-scrollbar-thumb {
  background: rgb(0 0 0 / 10%);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:active {
  background: rgb(0 0 0 / 18%);
}

.agent-model-picker, .menu-select-pop, .action-menu, .topbar-dropdown-menu, .composer-tools-popover,
.agent-command-popover, .context-card, .sidebar-thread-preview, .preview-more-menu, .pr-action-menu {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--popover-radius);
  box-shadow: var(--shadow-raised);
}
.dialog, .palette, .about-modal-card {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--dialog-radius);
  box-shadow: var(--shadow);
}

.composer-agent-controls { display: flex; flex-wrap: wrap; gap: 0.25rem; min-width: 0; }
.composer-row:has(.composer-agent-controls) { flex-wrap: wrap; }
.composer-controls:has(.composer-agent-controls) { flex-wrap: wrap; }
.composer-row:has(.composer-agent-controls) .composer-prompt-actions { margin-left: auto; }
.agent-model-picker { z-index: var(--z-menu); display: flex; flex-direction: column; overflow: hidden; font-size: var(--text-ui); }
.agent-model-picker header { display: flex; align-items: center; padding: 0.625rem; border-bottom: 1px solid var(--border-color); gap: 0.25rem; }
.agent-model-picker header input { background: transparent; border: 0; border-radius: var(--radius-xs); color: var(--text); min-width: 0; flex: 1; padding: 0.375rem; font: inherit; }
.agent-model-picker header:focus-within { box-shadow: inset 0 -1px var(--text-muted); }
.agent-model-picker header input:focus { outline: none; box-shadow: none; }
.agent-model-picker-body { display: flex; min-height: 0; max-height: 20rem; overflow: auto; }
.agent-model-picker nav { display: flex; flex-direction: column; flex: 0 0 3.25rem; padding: 0.375rem; gap: 0.25rem; border-right: 1px solid var(--border-color); }
.agent-model-picker nav button { display: grid; place-items: center; min-height: 2rem; background: transparent; border: 0; border-radius: var(--radius-md); color: var(--text-muted); }
.agent-model-picker nav button[aria-pressed="true"], .agent-model-row button[aria-pressed="true"], .agent-model-picker button:hover { background: var(--bg-hover); color: var(--text); }
.agent-model-picker button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.agent-model-picker section { min-width: 0; flex: 1; padding: 0.5rem; }
.agent-model-heading { margin: 0.25rem 0.5rem 0.5rem; color: var(--text-muted); font-size: var(--text-xs); }
.agent-model-row { display: flex; gap: 0.125rem; margin-bottom: 0.125rem; }
.agent-model-row button { border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text); padding: 0.625rem; }
.agent-model-row button[data-model-choice] { flex: 1; min-width: 0; text-align: left; }
.agent-model-row span, .agent-model-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model-row small { color: var(--text-muted); font-size: var(--text-2xs); margin-top: 0.25rem; }
.agent-model-row .model-favorite { flex: 0 0 2rem; color: var(--text-muted); }
.agent-model-empty, .agent-model-note { display: block; margin: 0.5rem; color: var(--text-muted); line-height: 1.5; overflow-wrap: anywhere; }
/* Actions under an empty or failed list line up with its text, not with the panel edge. */
.agent-model-actions { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0.25rem 0.5rem 0.5rem; }
.agent-model-note { font-size: var(--text-2xs); }
.agent-model-picker button:disabled { opacity: 0.45; cursor: default; }
.agent-harness-choice { display: flex; width: 100%; align-items: center; gap: 0.625rem; padding: 0.5rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; font: inherit; }
.agent-harness-choice span { min-width: 0; }
.agent-harness-choice small { display: block; color: var(--text-muted); font-size: var(--text-2xs); margin-top: 0.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-model-manage { border: 0; border-top: 1px solid var(--border-color); background: transparent; color: var(--text-muted); width: 100%; text-align: left; padding: 0.625rem; font: inherit; }

.turn-verification { margin: 0.75rem 0 1.5rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); font-size: var(--text-ui); min-width: 0; }
.turn-verification > summary { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; cursor: pointer; list-style: none; }
.turn-verification > summary::-webkit-details-marker { display: none; }
.turn-verification > summary:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); border-radius: var(--radius-lg); }
.verification-chevron { flex-shrink: 0; color: var(--text-muted); }
.turn-verification[open] > summary .verification-chevron { transform: rotate(90deg); }
.verification-state { color: var(--text-muted); margin-left: auto; text-align: right; }
.verification-state.passed { color: var(--green); }
.verification-state.failed, .verification-state.stale { color: var(--red); }
.verification-body { display: grid; gap: 0.75rem; padding: 0.25rem 0.75rem 0.75rem; min-width: 0; }
.verification-body p { margin: 0; }
.verification-path, .verification-command { overflow-wrap: anywhere; }
.verification-command { padding: 0.625rem; background: var(--bg); border-radius: var(--radius-sm); }
.verification-body .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.verification-body .actions button { min-height: 2rem; gap: 0.375rem; }
.verification-body .ghost:disabled { opacity: 0.4; cursor: default; }
.verification-add { display: grid; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.verification-details { border-top: 1px solid var(--border-color); padding-top: 0.625rem; min-width: 0; }
.verification-details > summary { color: var(--text-muted); cursor: pointer; }
.verification-details > :not(summary) { margin-top: 0.75rem; }
.verification-path { display: block; }
.verification-error { color: var(--red); overflow-wrap: anywhere; }
.turn-missing-reply { font-size: var(--text-ui); line-height: 1.5; margin: 1rem 0; }
.verification-check { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 1rem; }
.verification-check small { grid-column: 1 / -1; color: var(--text-muted); font-size: var(--text-ui); }
.verification-action { display: grid; gap: 0.5rem; }
.verification-body pre { max-height: 18rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-ui); }

.app {
  position: relative;
  display: flex;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior-x: none;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-width: var(--sidebar-min-width);
  max-width: var(--sidebar-max-width);
  flex-shrink: 0;
  background: var(--sidebar-fill, var(--bg-sidebar));
  backdrop-filter: var(--sidebar-filter, none);
  -webkit-backdrop-filter: var(--sidebar-filter, none);
  border-right: 1px solid var(--border-color);
  min-height: 0;
  overflow: hidden;
  transition:
    width var(--motion-fast) var(--motion-ease),
    min-width var(--motion-fast) var(--motion-ease),
    max-width var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease);
}
.app.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  max-width: 0;
  border-right-color: transparent;
  pointer-events: none;
}

/* Fullscreen hides the window controls, so the 90px reserved for them is dead
   space. Collapsing to the sidebar's own gutter lines the toggle up with the
   search field and the rows under it; the page header follows the same token. */
:root[data-fullscreen="true"], :root[data-platform="windows"], :root[data-platform="browser"] {
  --workspace-traffic-inset: var(--sidebar-content-inset);
}

.sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  /* The toggle and the wordmark sit together after the traffic-light inset.
     With space-between the wordmark started at the 4.5rem padding and drifted
     to the middle of the rail, which read as a centred dialog title rather
     than a sidebar header. */
  justify-content: flex-start;
  gap: 0.45rem;
  height: var(--workspace-topbar-height);
  /* The app already has one number for clearing the window controls, and the
     page header uses it. This hardcoded 4.5rem was 18px tighter, so the toggle
     sat against the green button and under the Move & Resize menu macOS shows
     on hover. */
  padding: 0 0.5rem 0 var(--workspace-traffic-inset);
  border-bottom: 1px solid var(--border-color);
  -webkit-app-region: drag;
  flex-shrink: 0;
}
.sidebar-header button,
.sidebar-header input,
.sidebar-toggle {
  -webkit-app-region: no-drag;
}

.sidebar-header .sidebar-toggle {
  position: static;
  /* No auto margin. It pushed the toggle to the right when it was the second
     child; with the toggle first it absorbed the free space and shoved the
     toggle and the wordmark together into the middle of the rail. */
}

.page-header .sidebar-toggle {
  position: absolute;
  left: var(--workspace-traffic-inset);
  top: calc((var(--workspace-topbar-height) - var(--workspace-titlebar-control-size)) / 2);
  z-index: 3;
}
.icon-btn.sidebar-toggle:hover,
.icon-btn.sidebar-toggle:active {
  transform: none;
}

.sidebar-swipe-edge {
  position: absolute;
  left: 0;
  top: var(--workspace-topbar-height);
  bottom: 0;
  width: 12px;
  z-index: 6;
  pointer-events: none;
}
.app.sidebar-collapsed .sidebar-swipe-edge {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: -0.02em;
  color: var(--text);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--workspace-titlebar-control-size);
  height: var(--workspace-titlebar-control-size);
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-faint);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.icon-btn.active {
  background: var(--bg-active);
  color: var(--text);
}

.sidebar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem var(--sidebar-content-inset) 0.2rem;
}
.sidebar-new {
  color: var(--text);
  width: 100%;
  order: -1;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0 0.4rem;
  font-size: var(--text-ui);
}
.sidebar-text-btn {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-align: left;
  padding: 0.1rem var(--sidebar-content-inset) 0.45rem;
  width: 100%;
}
.sidebar-text-btn:hover {
  color: var(--text);
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  height: 1.875rem;
  box-sizing: border-box;
  margin: 0;
  padding: 0 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  background: transparent;
}
.sidebar-search:focus-within {
  border-color: transparent;
  background: var(--bg-hover);
}
.sidebar-search input,
.sidebar-search input[type="search"] {
  font-size: var(--text-ui);
}
.sidebar-search svg {
  display: block;
  flex-shrink: 0;
}
.search-clear {
  width: 1.25rem !important;
  height: 1.25rem !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
.sidebar-search input,
.sidebar-search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
  font-size: var(--text-xs);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}
.sidebar-search input::-webkit-search-decoration,
.sidebar-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.sidebar-search input::placeholder {
  color: var(--text-faint);
}

.sidebar-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 0 var(--sidebar-content-inset) 0.5rem;
}

.nav-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  padding: 0.65rem 0.5rem 0.25rem;
}
.sidebar-empty {
  color: var(--text-faint);
  font-size: var(--text-xs);
  padding: 0.4rem 0.5rem;
}
.sidebar-scroll {
  --sidebar-row-inset: 0.2rem;
  --sidebar-icon-column: 1rem;
  --sidebar-column-gap: 0.25rem;
  --sidebar-title-inset: calc(var(--sidebar-row-inset) + 2 * (var(--sidebar-icon-column) + var(--sidebar-column-gap)));
}
.project-block .sidebar-empty,
.session-list > .sidebar-empty,
.sidebar-scroll .session-label {
  padding-left: var(--sidebar-title-inset);
}

.nav-item,
.list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--subtext-1);
  border-radius: var(--control-radius);
  padding: 0.32rem 0.5rem;
  text-align: left;
  font-size: var(--text-ui);
  min-height: 1.875rem;
  min-width: 0;
  overflow: hidden;
}
.nav-item svg,
.list-item svg {
  color: var(--text-faint);
  flex-shrink: 0;
}
.nav-item:hover,
.list-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active,
.list-item.active {
  background: var(--bg-active);
  color: var(--text);
}
.list-item .meta {
  margin-left: auto;
  font-size: var(--text-2xs);
  color: var(--text-faint);
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.session-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  padding: 0.5rem 0.5rem 0.25rem;
}
.session-list {
  padding: 0.05rem 0 0.25rem;
}
.project-block {
  margin-bottom: 0.45rem;
  min-width: 0;
}
.project-row,
.thread-row {
  display: grid;
  /* Chevron/indent, glyph, title, metadata. The overflow menu is positioned
     out of flow so an invisible action never shortens the title. */
  position: relative;
  grid-template-columns: var(--sidebar-icon-column, 1rem) var(--sidebar-icon-column, 1rem) minmax(0, 1fr) auto;
  column-gap: var(--sidebar-column-gap, 0.25rem);
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--subtext-1);
  border-radius: var(--radius-md);
  text-align: left;
  overflow: visible;
}
.project-row {
  padding: 0.28rem var(--sidebar-row-inset, 0.2rem);
  min-height: var(--control-h-md);
  line-height: 1.25;
  font-size: var(--text-ui);
  font-weight: var(--weight-medium);
  color: var(--text);
  cursor: pointer;
}
.project-row.active {
  background: transparent;
}
.project-row:hover,
.thread-row:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.project-toggle,
.row-slot,
.project-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 1.15rem;
  min-width: 0;
  overflow: hidden;
  color: var(--text-faint);
}
.project-toggle {
  border: 0;
  background: transparent;
  border-radius: var(--radius-xs);
  padding: 0;
}
.project-toggle:hover {
  background: var(--bg-active);
  color: var(--text);
}
.row-slot svg,
.project-toggle svg {
  flex-shrink: 0;
  display: block;
}
.project-icon img,
.project-settings-icon img {
  display: block;
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-xs);
  object-fit: contain;
}
.thread-row {
  /* The first column lines up with the project chevron above it, placing the
     conversation glyph cleanly under the project folder icon. */
  padding: 0.24rem var(--sidebar-row-inset, 0.2rem);
  font-size: var(--text-ui);
  min-height: var(--control-h-sm);
  cursor: pointer;
}
.thread-row.active {
  background: var(--bg-active);
  color: var(--text);
  font-weight: 550;
}
.thread-row.recede .truncate {
  color: var(--subtext-1);
  font-weight: 400;
}
.thread-row.recede:hover .truncate,
.thread-row.recede.active .truncate {
  color: inherit;
}
.project-row .truncate,
.thread-row .truncate {
  min-width: 0;
}
.thread-title { min-width: 0; display: grid; }
.thread-project {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  font-weight: 400;
  line-height: 1.5;
}
.sidebar-status-group { margin-bottom: 0.75rem; }
.sidebar-status-group > .session-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}
.sidebar-status-group > .session-label > span { font-variant-numeric: tabular-nums; opacity: 0.7; }
.thread-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  min-width: 0;
  max-width: 6rem;
  overflow: hidden;
}
.thread-status {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--text-3xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.thread-status.working {
  color: var(--blue, #5b9fd4);
}
.thread-status.approval {
  color: var(--yellow);
}
.thread-status.failed {
  color: var(--red);
}
.thread-duration {
  font-variant-numeric: tabular-nums;
  margin-left: 0.25rem;
  font-weight: 500;
}
.thread-time {
  font-size: var(--text-3xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.thread-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  /* Out of the grid: invisible controls should not reserve width. */
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 0;
  opacity: 0;
  z-index: 1;
}
.project-row:hover .thread-meta,
.thread-row:hover .thread-meta,
.project-row:focus-within .thread-meta,
.thread-row:focus-within .thread-meta,
.project-row[data-menu-open] .thread-meta,
.thread-row[data-menu-open] .thread-meta,
.project-row:has(.thread-more[aria-expanded="true"]) .thread-meta,
.thread-row:has(.thread-more[aria-expanded="true"]) .thread-meta {
  opacity: 0;
}
.thread-meta {
  transition: opacity var(--motion-instant, 120ms) var(--motion-ease, ease);
}
.project-row:hover .thread-more,
.thread-row:hover .thread-more,
.project-row:focus-within .thread-more,
.thread-row:focus-within .thread-more,
.project-row[data-menu-open] .thread-more,
.thread-row[data-menu-open] .thread-more,
.thread-more:focus-visible,
.thread-more[aria-expanded="true"] {
  opacity: 1;
}
.thread-more:hover,
.thread-more[aria-expanded="true"] {
  background: var(--bg-active);
  color: var(--text);
}
.sidebar-preview-anchor { display: contents; }
.thread-quick-actions {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  background: transparent;
  opacity: 0;
  pointer-events: none;
}
.thread-row:is(:hover, :focus-within, [data-menu-open]) .thread-quick-actions {
  opacity: 1;
  pointer-events: auto;
}
.thread-quick-actions .thread-more,
.thread-quick-action {
  position: static;
  transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
}
.thread-quick-action:hover { color: var(--text); background: var(--bg-active); }
.thread-row:is(:hover, :focus-within, [data-menu-open]) .thread-title { margin-right: 4.5rem; }
.thread-row:is(:hover, :focus-within, [data-menu-open]) .thread-meta { width: 0; }
.project-row:is(:hover, :focus-within, [data-menu-open]) > .truncate { margin-right: 1.5rem; }
.sidebar-thread-preview {
  position: fixed;
  z-index: var(--z-menu);
  width: min(20rem, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: none;
  padding: 0.65rem 0.8rem;
  font-size: var(--text-ui);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.sidebar-preview-context { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.4rem; color: var(--text-faint); }
.sidebar-preview-context span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-preview-context time { font-size: var(--text-2xs); }
.sidebar-preview-detail { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border-color); color: var(--subtext-1); }
.sidebar-recents { margin-top: 1rem; }
.sidebar-recents h3 { padding: 0 0.4rem; margin: 0 0 0.4rem; color: var(--text-faint); font-size: var(--text-xs); font-weight: 400; }
.thread-row.sidebar-recent-row { padding-left: 0.4rem; grid-template-columns: 0 0 minmax(0, 1fr) auto; }
.sidebar-recent-row > .row-slot { overflow: hidden; }
.sidebar-recents .show-more { padding-left: 0.4rem; }
.sidebar-recents > input { width: 100%; padding: 0.25rem 0.4rem; font-size: var(--text-ui); }
.sidebar-scroll .project-block > input,
.sidebar-scroll .session-list > input {
  width: calc(100% - var(--sidebar-title-inset) - 0.2rem + 0.4rem + 1px);
  margin: 0.15rem 0.2rem 0.15rem calc(var(--sidebar-title-inset) - 0.4rem - 1px);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  border-radius: var(--control-radius);
  padding: 0.22rem 0.4rem;
  font-size: var(--text-xs);
  outline: none;
}
.show-more {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  text-align: left;
  padding: 0.2rem 0.5rem 0.3rem var(--sidebar-title-inset, 2.7rem);
}
.show-more:hover {
  color: var(--text);
}

.sidebar-footer {
  padding: 0.4rem var(--sidebar-content-inset) 0.55rem;
  border-top: 1px solid transparent;
}
.sidebar-utils {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.sidebar-utils .icon-btn {
  position: relative;
}
.sidebar-utils .dot {
  margin-left: 0.35rem;
  margin-right: 0.25rem;
}
.update-feedback-bubble {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.45rem;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.3;
  border-radius: var(--control-radius, var(--radius-sm));
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.15s ease-out;
  cursor: pointer;
  user-select: none;
}
.update-feedback-bubble.has-update {
  border-color: var(--green, #22c55e);
  color: var(--green, #22c55e);
  background: color-mix(in srgb, var(--green) 12%, var(--bg-sidebar, #16171a));
}
.update-dot {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-full);
  background: var(--green, #22c55e);
}
@keyframes icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.icon-btn.is-spinning svg {
  animation: icon-spin 0.75s linear infinite;
}
.util-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.1rem;
  min-width: 0.85rem;
  height: 0.85rem;
  padding: 0 0.15rem;
  border-radius: var(--radius-full);
  background: var(--yellow);
  color: #111;
  font-size: var(--text-3xs);
  font-weight: 700;
  line-height: 0.85rem;
  text-align: center;
}

.sidebar-rail {
  touch-action: none;
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}
.sidebar-rail:hover,
.sidebar-rail:active {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.page-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  height: var(--workspace-topbar-height);
  min-height: var(--workspace-topbar-height);
  padding: 0 0.75rem 0 1rem;
  border-bottom: 1px solid var(--border-color);
  -webkit-app-region: drag;
  flex-shrink: 0;
  container-type: inline-size;
  container-name: page-header;
}
/* Chips give up what they can spare before they start losing letters: first
   the branch, which the composer's footer also carries, then the labels. Left
   to shrink on their own they compressed into unreadable slivers of icon. */
@container page-header (max-width: 46rem) {
  .topbar-chip-btn.git-chip {
    display: none;
  }
}
@container page-header (max-width: 34rem) {
  .topbar-chip-btn > span {
    display: none;
  }
  .topbar-chip-btn {
    padding: 0 0.4rem;
  }
}
.page-header.with-traffic {
  padding-left: var(--workspace-titlebar-content-left);
}
.page-header button,
.page-header input {
  -webkit-app-region: no-drag;
}

.page-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-ui);
  color: var(--text-muted);
}
.page-title b {
  color: var(--text);
  font-weight: 600;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
/* The action group gives way before the title does. It used to be the other
   way round: at a narrow window the chips held their full width and the
   breadcrumb was squeezed to nothing, so the header stopped saying which
   conversation you were in. */
.header-actions:not(.header-lead) {
  min-width: 0;
  flex-shrink: 1;
}
.header-lead {
  flex: 1 1 auto;
  min-width: 4rem;
  justify-content: flex-start;
}
.grow {
  flex: 1;
  min-width: 0;
}
.inline-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.status-dot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--workspace-titlebar-control-size);
  height: var(--workspace-titlebar-control-size);
  border: 0;
  background: transparent;
  border-radius: var(--control-radius);
}
.status-dot-btn:hover {
  background: var(--bg-hover);
}

.dot {
  /* Colour drives `background` through currentColor so the pulse ring below can
     pick up the same value without repeating every state. */
  color: var(--text-faint);
  background: currentColor;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.dot.on {
  color: var(--green);
}
.dot.warn {
  color: var(--yellow);
}
.dot.off {
  color: var(--red);
}

/*
 * Live indicator: a ring that expands out of the dot and fades.
 *
 * Only `transform` and `opacity` are animated — both run on the compositor, so
 * the pulse never forces a style resolve or repaint on the main thread. An
 * equivalent effect built from an animated box-shadow or width/height does,
 * and costs real CPU for something that runs forever behind a live session.
 */
/* Pulse means "work is happening", not "state is good" — a permanently
   pulsing healthy indicator is just noise. Applied to a live harness turn and
   to `connecting`, never to a settled `connected`. */
.dot.live {
  position: relative;
  overflow: visible;
}
.dot.live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  animation: dot-pulse 1.9s var(--motion-ease, cubic-bezier(0.25, 1, 0.5, 1)) infinite;
  pointer-events: none;
}
@keyframes dot-pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  70% {
    transform: scale(2.8);
    opacity: 0;
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

.workspace-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.page-content,
.main,
.panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.main {
  background: var(--bg);
}

.conversation {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 1.25rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
}
.thread {
  width: min(var(--chat-max), 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  /*
   * A short thread sits on the composer instead of pinned to the top with a
   * void beneath it. `auto` on the top margin does the work: the column grows
   * downward once it is taller than the scroller, and the reader's eye stays
   * where the next message will appear.
   */
  margin-top: auto;
  min-height: min-content;
}
.thread:has(.empty-thread) {
  flex: 1;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}
.main.conversation-empty {
  /* Safe: when the terminal dock leaves too little room, the empty state
     scrolls down instead of being pushed up over the titlebar. */
  justify-content: safe center;
  overflow-y: auto;
}
.conversation-empty .conversation {
  flex: 0 0 auto;
  overflow: visible;
  padding: 0 1.5rem;
}
.conversation-empty .thread:has(.empty-thread) {
  flex: 0 0 auto;
  min-height: 0;
}
.conversation-empty .composer {
  padding-bottom: 0;
}
.conversation-empty .composer::before {
  display: none;
}
.conversation-empty .composer-glass {
  display: flex;
  flex-direction: column;
  min-height: 6rem;
}
.conversation-empty .composer-glass textarea {
  flex: 1;
}
.conversation-empty .composer-row {
  margin-top: auto;
}

.empty-thread {
  width: min(36rem, 100%);
  margin: 0 auto;
  text-align: center;
  padding: 0 1rem 1.65rem;
}
/*
 * The mark alone, with no tile behind it.
 *
 * The app icon is a dark square with the mark drawn on it, so dropping it on
 * this page put a slightly darker rectangle in the middle of the screen. This
 * is the glyph lifted out of that icon as an alpha mask, painted in the text
 * colour — which also means it follows the theme rather than being a white
 * PNG that vanishes on a light background.
 */
.empty-thread-mark {
  width: 3.5rem;
  height: 3.5rem;
  background: currentColor;
  color: var(--text-faint);
  -webkit-mask-image: url("./mark-DA5W5cnl.png");
  mask-image: url("./mark-DA5W5cnl.png");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  /*
   * Room above the heading. Fourteen pixels between a 40px mark and a 32px
   * heading read as one crowded lump; the mark is its own thing and needs to
   * sit apart from the sentence.
   */
  margin: 0 auto 1.75rem;
  display: block;
}
.empty-thread h1 {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  text-wrap: balance;
  /* The heading and the line under it are one thought; the gap says so. */
  margin: 0 0 0.75rem;
  line-height: 1.15;
}
.empty-thread h1 span {
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.14em;
}
.empty-thread p {
  color: var(--text-muted);
  margin: 0 auto 1.35rem;
  font-size: .9375rem;
  line-height: 1.5;
  max-width: 28rem;
}
.empty-thread .actions {
  justify-content: center;
}
.empty-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin: 0 0 0.25rem;
}

.msg {
  width: 100%;
  margin: 0 0 0.45rem;
}
.msg:has(+ .inline-activity) { margin-bottom: 0.15rem; }
/*
 * The time stays visible. Copy stays chrome: it appears on hover so the
 * timestamp is not a blank row and is not missing either.
 */
.msg .who {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.5rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: 0.15rem;
  font-weight: var(--weight-regular);
}
/* A steer marker is semantic, not chrome — it stays legible without hover. */
.msg .who:has(.tag) {
  opacity: 1;
}
.msg .who:has(.copy-action[data-feedback="true"]) { opacity: 1; }
.copy-action { display: inline-flex; align-items: center; gap: 0.35rem; }
.copy-action-feedback { font-size: var(--text-2xs); color: var(--text-muted); font-weight: 400; }
.copy-action-feedback:empty { display: none; }
@media (hover: none) { .msg .who { opacity: 1; } }
/* Pagination control sits above the oldest loaded message. */
.load-older {
  display: flex;
  justify-content: center;
  padding: 0 0 0.75rem;
}
/* Marks a turn that steered an in-flight run rather than starting one. */
.msg .tag {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 0 0.3rem;
  font-size: var(--text-3xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.msg .when {
  font-weight: 400;
  color: var(--text-faint);
}
.msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity var(--motion-overlay) var(--ease-in-out);
}
.msg:hover .msg-actions {
  opacity: 1;
}
/*
 * MessageBody's own presentation, wherever it is mounted.
 *
 * It used to hang off `.msg .body` alone. The pull-request panel mounts the
 * same component, so a description arrived there with its line breaks
 * collapsed into one run-on paragraph and its inline code and links rendered
 * as plain prose — the markdown was parsed correctly and then thrown away by
 * the stylesheet.
 */
.body {
  line-height: 1.65;
  white-space: normal;
  /* Long paths and URLs must wrap rather than widen the panel they sit in. */
  overflow-wrap: anywhere;
}
.md-p { margin: 0.85em 0; white-space: pre-wrap; }
.body strong { font-weight: 600; }
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }
.md-literal { white-space: pre-wrap; }
.body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--inline-code-bg);
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-xs);
}
.body code.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  vertical-align: baseline;
  padding: 0.05rem 0.4rem 0.05rem 0.28rem;
  border-radius: var(--radius-sm);
}
.file-chip-kind {
  font-size: 0.7em;
  font-weight: 650;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.body code.file-chip.file-mention:hover {
  text-decoration: none;
  background: var(--bg-hover);
}
.md-task {
  display: grid;
  grid-template-columns: 0.85rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
  list-style: none;
}
.md-task-mark {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.28em;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  font-size: var(--text-3xs);
  line-height: 1;
  color: var(--green);
}
.md-task.is-done {
  color: var(--text-muted);
}
.md-task.is-done .md-task-mark {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.body a, .body .md-file-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.body .md-file-link { display: inline; padding: 0; border: 0; border-radius: 0; background: none; font: inherit; text-align: inherit; white-space: normal; cursor: pointer; }
.msg .body {
  font-size: var(--text-message);
}
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.message-attachment {
  display: grid;
  align-items: center;
  gap: 0.4rem;
  min-width: 9rem;
  max-width: 18rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-muted);
  padding: 0.4rem 0.55rem;
  text-align: left;
}
.message-attachment:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.message-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
}
.message-attachment small {
  color: var(--text-faint);
  font-size: var(--text-3xs);
}
.message-attachment .message-attachment-caption {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.message-attachment-caption > span { flex: 1; }
.message-attachment-caption > svg, .message-attachment-caption > small { flex-shrink: 0; }
.message-attachment-image { width: min(20rem, 100%); max-width: 20rem; padding: 0; overflow: hidden; }
.message-attachment-image .message-attachment-caption { padding: 0.45rem 0.65rem; }
.message-image-preview { display: grid; place-items: center; min-height: 6rem; height: 11.25rem; background: var(--surface-1); }
.message-image-preview img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.message-attachments { max-width: 100%; }
.app-update-control { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; min-width: 0; max-width: 100%; }
.app-update-control p { font-size: var(--text-ui); max-width: 28rem; overflow-wrap: anywhere; margin: 0; }
.app-update-control p:empty { display: none; }
.app-update-control progress { width: 100%; max-width: 18rem; }
.app-update-release-link { color: var(--text-muted); font-size: var(--text-ui); text-underline-offset: .2em; }
.about-modal-actions > button { min-height: 2.4rem; margin: 0; }
.sidebar-footer button.update-feedback-bubble { width: 100%; text-align: left; font-size: var(--text-xs); line-height: 1.4; overflow-wrap: anywhere; }
.msg-code {
  margin: 0.55rem 0;
  padding: 0.7rem 0.8rem;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-md);
  font-family: var(--mono);
  font-size: max(0.8125rem, 0.9em);
  line-height: 1.65;
  /* Wrap rather than scroll: a reply is read in a narrow column, and having to
     scroll right to see the end of a command is worse than a wrapped line.
     overflow-wrap catches tokens with no break opportunity (long paths, URLs). */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

/* Semantic syntax colours, shared by chat, file previews and diffs. */
.tok-str { color: var(--syntax-string); }
.tok-com { color: var(--code-muted); }
.tok-num { color: var(--syntax-number); }
.tok-kw { color: var(--syntax-keyword); }
.tok-title { color: var(--syntax-function); }
.tok-type { color: var(--syntax-type); }
.tok-attr { color: var(--syntax-attribute); }
.tok-add { color: var(--syntax-added); }
.tok-del { color: var(--syntax-removed); }
.msg.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg.user .who {
  justify-content: flex-end;
}
.msg.user .body {
  max-width: 80%;
  width: fit-content;
  background: var(--surface-message);
  border-radius: var(--radius-xl);
  padding: 0.75rem 0.875rem;
  color: var(--text);
}

.progress {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.375rem;
  /* Grid tracks size to their content, so one long command stretched every
     row past the card and the card clipped it mid-word. */
  min-width: 0;
}
.progress > * {
  min-width: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--text-ui);
}
.step > .glyph,
.step > svg {
  flex-shrink: 0;
}
.step.active {
  color: var(--text);
}
.step.error { color: var(--red); }
/* The label names the phase; the detail is the agent's most recent line for
   that phase and must not push the label out of the row. */
.step-label { flex-shrink: 0; }
.step-detail {
  /* Takes what is left of the row and ends in an ellipsis. Without the flex
     basis it kept its content width and there was nothing to truncate. */
  flex: 1 1 auto;
  color: var(--text-faint);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step.complete {
  color: var(--green);
}
.glyph {
  width: 0.875rem;
  text-align: center;
  font-size: var(--text-xs);
}

.advanced {
  margin-top: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  overflow: hidden;
}
.advanced summary {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-ui);
}
/* Execution rows: fixed-width time, a dim kind tag, then the text. */
.event-log > div {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}
.event-time { color: var(--text-faint); flex-shrink: 0; }
.event-kind {
  color: var(--text-faint);
  flex-shrink: 0;
  min-width: 4.5rem;
}
.event-text { min-width: 0; overflow-wrap: anywhere; }
.run-event-log .event-text { white-space: pre-wrap; }
.run-log-pages { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0.75rem; }
.event-log {
  font-family: var(--mono);
  font-size: var(--text-xs);
  padding: 0 0.75rem 0.75rem;
  color: var(--text-muted);
  display: grid;
  gap: 0.25rem;
}

.jump-latest {
  align-self: center;
  z-index: 2;
  margin: 0 0 0.35rem;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-full);
  padding: 0.22rem 0.7rem;
  color: var(--subtext-1);
  font-size: var(--text-xs);
}
.jump-latest:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.composer {
  --composer-field-min: 3.5rem;
  position: relative;
  container-type: inline-size;
  container-name: composer;
  padding: 0 1.25rem 1.05rem;
  flex-shrink: 0;
}
.composer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -2.75rem;
  height: 2.75rem;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.composer-glass {
  position: relative;
  z-index: 1;
  isolation: isolate;
  max-width: var(--chat-max);
  margin: 0 auto;
  border-radius: var(--composer-radius);
  padding: 0.875rem 0.875rem 0.625rem;
  box-shadow: 0 12px 28px -18px rgb(0 0 0 / 55%);
  overflow: visible;
  transition: padding var(--motion-standard) var(--motion-ease);
}
.composer-prompt {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  position: relative;
  z-index: 1;
}
.composer-prompt textarea {
  flex: 1;
  min-width: 0;
}
.composer-prompt-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.composer.composer--resting {
  --composer-field-min: 2.35rem;
}
.composer.composer--resting .composer-glass {
  padding: 0.15rem 0.2rem 0.15rem 0.95rem;
  border-radius: var(--radius-2xl);
}
.composer.composer--resting .composer-prompt {
  align-items: center;
  min-height: 2.35rem;
}
.composer.composer--resting .composer-controls,
.composer.composer--resting .composer-tools,
.composer.composer--resting .context-meter-wrapper,
.composer.composer--resting .steer-row,
.composer.composer--resting .composer-preflight,
.composer.composer--resting .capability-hint,
.composer.composer--resting .composer-stash,
.composer.composer--resting .composer-context-chips,
.composer.composer--resting .composer-context-picker,
.composer.composer--resting .composer-switch-note,
.composer.composer--resting .gateway-recovery,
.composer.composer--resting .composer-attachments {
  display: none;
}
.composer.composer--resting textarea,
textarea.composer-field--resting {
  --composer-field-min: 2.35rem;
  min-height: 2.35rem;
  max-height: 2.35rem;
  height: 2.35rem;
  line-height: 2.35rem;
  padding: 0 4.8rem 0 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  resize: none;
}
.composer.composer--resting .composer-context {
  margin-top: -0.6rem;
  padding: 1rem 0.85rem 0.4rem;
}
.composer.composer--resting .composer-row { display: contents; }
.composer.composer--resting .composer-prompt-actions {
  position: absolute;
  right: 0.2rem;
  top: 0.15rem;
  min-height: 2.35rem;
  z-index: 2;
}
.composer-tasks {
  max-width: var(--chat-max);
  margin: 0 auto 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--surface-0);
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.composer-tasks-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.7rem;
  text-align: left;
  font-size: var(--text-xs);
}
.composer-tasks-toggle svg.open { transform: rotate(90deg); }
.composer-tasks-current {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}
.composer-tasks-count {
  flex-shrink: 0;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-2xs);
}
.composer-tasks-count.is-complete { color: var(--green); }
.composer-tasks-segments {
  display: flex;
  width: 3.5rem;
  gap: 0.15rem;
  flex-shrink: 0;
}
.composer-tasks-segment {
  flex: 1;
  height: 3px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 12%, transparent);
}
.composer-tasks-segment.is-completed { background: var(--green); }
.composer-tasks-segment.is-inProgress { background: var(--text); }
.composer-tasks-list {
  list-style: none;
  margin: 0;
  padding: 0 0.35rem 0.4rem;
  max-height: 12rem;
  overflow: auto;
}
.composer-tasks-item {
  display: grid;
  grid-template-columns: 0.9rem minmax(0, 1fr) auto auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.28rem 0.4rem;
  font-size: var(--text-xs);
}
.composer-tasks-item.is-completed { color: var(--text-faint); }
.composer-tasks-item.is-inProgress { color: var(--text); }
.composer-tasks-mark {
  font-size: var(--text-3xs);
  text-align: center;
}
.composer-tasks-item.is-completed .composer-tasks-mark { color: var(--green); }
.composer-tasks-copy {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.suggest-menu {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: calc(100% + 0.4rem);
  z-index: 5;
  padding: 0.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in srgb, var(--surface-0) 92%, transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
  max-height: 14rem;
  overflow: auto;
}
.suggest-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-ui);
}
.suggest-menu button .meta {
  color: var(--text-faint);
  font-size: var(--text-2xs);
}
.suggest-menu button:hover,
.suggest-menu button.active {
  background: var(--bg-hover);
}
.suggest-copy { display: flex; min-width: 0; flex: 1; gap: 0.65rem; align-items: baseline; }
.suggest-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; max-width: 60%; }
.suggest-copy .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-badge { font-size: var(--text-2xs); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 0.1rem 0.3rem; max-width: 25%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-empty { color: var(--text-muted); font-size: var(--text-ui); padding: 0.75rem; }
.composer-context-picker { position: absolute; z-index: 8; left: 0; right: 0; bottom: calc(100% + 0.4rem); border: 1px solid var(--border-color); background: var(--surface-0); border-radius: var(--radius-lg); padding: 0.5rem; box-shadow: var(--shadow); }
.composer-context-picker .suggest-menu { position: static; border: 0; box-shadow: none; background: none; backdrop-filter: none; max-height: min(16rem, 30vh); }
.composer-context-picker input { width: 100%; box-sizing: border-box; margin: 0.3rem 0; font-size: var(--text-sm); }
.composer-context-tabs { display: flex; align-items: center; gap: 0.35rem; }
.composer-context-tabs button { background: transparent; border: 0; border-radius: var(--radius-sm); padding: 0.35rem 0.5rem; font-size: var(--text-ui); }
.composer-context-tabs button[aria-pressed="true"] { background: var(--bg-hover); color: var(--text); }
.composer-context-tabs button:last-child { margin-left: auto; }
.composer-context-chips { display: flex; gap: 0.35rem; padding: 0.2rem 0 0.45rem; align-items: center; min-width: 0; }
.composer-skill-chip { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-hover); font-size: var(--text-ui); padding: 0.15rem 0.35rem; }
.composer-skill-chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer-skill-chip button { display: flex; padding: 0.2rem; background: transparent; border: 0; }
.thread-agents { display: flex; flex-direction: column; gap: 0.8rem; font-size: var(--text-sm); }
.thread-agents header, .thread-agent-heading { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.thread-agents h3, .thread-agents h4 { margin: 0; }
.thread-agents header .meta { margin-left: auto; }
.thread-agent-heading > .agent-glyph { flex-shrink: 0; }
.thread-agent-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.thread-agent-card { padding: 0.85rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); min-width: 0; background: var(--surface-0); }
.thread-agent-card p { margin: 0.4rem 0; }
.thread-agents-empty { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem 0.25rem; color: var(--text-muted); }
.thread-agents-empty > svg { flex-shrink: 0; margin-top: 0.15rem; }
.inspector .thread-agents .thread-agents-empty h4 { margin: 0; color: var(--text); font-size: var(--text-sm); font-weight: 500; text-transform: none; letter-spacing: normal; }
.thread-agents-empty p { margin: 0.4rem 0 0; font-size: var(--text-ui); }
.thread-agents-header h3 { font-size: var(--text-sm); font-weight: 500; }
.thread-agents-section-label { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: var(--text-xs); color: var(--text-muted); }
.thread-agent-heading strong { white-space: nowrap; font-size: var(--text-sm); }
.thread-agent-heading > svg { flex-shrink: 0; }
.thread-agent-status { margin: 0.45rem 0; font-size: var(--text-xs); color: var(--text-muted); overflow-wrap: anywhere; }
.thread-agent-status[data-active="true"] { color: var(--text); }
.thread-agents .meta { font-size: var(--text-xs); color: var(--text-muted); overflow-wrap: anywhere; }
.thread-agents footer { border-top: 1px solid var(--border-color); padding-top: 0.7rem; }
.thread-agents footer button { font-size: var(--text-ui); }
.thread-agents-empty p, .thread-agents-details p { line-height: 1.55; }
.thread-agents-details { color: var(--text-muted); font-size: var(--text-ui); }
@media (max-width: 600px) {
  .suggest-copy { flex-direction: column; gap: 0.2rem; align-items: stretch; }
  .suggest-name { max-width: 100%; }
}
.composer-glass::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--surface-0) var(--glass-opacity), transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
}
.composer-glass::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px var(--bg-hover);
}
.composer textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: var(--composer-field-min);
  max-height: 11rem;
  resize: none;
  border: 0;
  transition: min-height var(--motion-standard) var(--motion-ease);
  background: transparent;
  outline: none;
  line-height: 1.45;
  font-size: var(--text-message);
}
.composer textarea::placeholder {
  color: var(--text-faint);
}
.composer-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  margin-top: 0.5rem;
  container-type: inline-size;
  container-name: composer-row;
}
/* Wrap controls rather than turning named features into anonymous chevrons. */
.composer-attachments {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.15rem 0 0.45rem;
}
.composer-attachment {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 16rem;
  gap: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 0.28rem 0.35rem 0.28rem 0.45rem;
  font-size: var(--text-2xs);
}
.composer-attachment > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-attachment button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-faint);
}
.composer-attachment button:hover {
  background: var(--bg-active);
  color: var(--text);
}
.composer-stash {
  position: absolute;
  z-index: 8;
  left: 0.65rem;
  bottom: 3.2rem;
  width: min(24rem, calc(100% - 1.3rem));
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-0) 96%, transparent);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  box-shadow: var(--shadow);
  padding: 0.3rem;
}
.composer-stash > p {
  margin: 0;
  padding: 0.65rem;
  color: var(--text-faint);
  font-size: var(--text-xs);
}
.composer-stash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem 0.45rem;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: 600;
}
.composer-stash-head small { color: var(--text-faint); }
.composer-stash-entry {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-top: 1px solid var(--border-color);
  padding: 0.2rem;
}
.composer-stash-restore {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 0.12rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.45rem;
  text-align: left;
}
.composer-stash-restore:hover { background: var(--bg-hover); }
.composer-stash-restore span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
}
.composer-stash-restore small {
  color: var(--text-faint);
  font-size: var(--text-3xs);
}
.composer-stash-button { position: relative; }
.composer-stash-button > span {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  display: grid;
  place-items: center;
  min-width: 0.9rem;
  height: 0.9rem;
  padding: 0 0.18rem;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-3xs);
  font-weight: 700;
}
/* Named controls remain reachable when the inspector narrows the composer. */
.composer-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  flex-wrap: nowrap;
}
.composer-controls > .menu-select:first-child { flex-shrink: 1; }
.menu-select {
  position: relative;
  flex-shrink: 0;
}
/* Ghost, not a pill. Five filled pills in a row read as five competing
   buttons; the controls are settings you glance at, so they carry no chrome
   until you point at them. */
.menu-select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.75rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-ui);
  font-weight: 500;
  padding: 0 0.4rem;
  border-radius: var(--control-radius);
  max-width: 12rem;
  line-height: 1;
}
/* A label gives way before its control does, so a row that is a few pixels
   short ellipsises a word instead of cutting a chevron in half. */
.composer-controls .menu-select {
  min-width: 0;
}
.composer-controls .menu-select-trigger {
  min-width: 0;
  max-width: 100%;
}
.composer-controls .menu-select-trigger > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-select-trigger svg {
  flex-shrink: 0;
}
.menu-select-trigger--icon { width: 1.75rem; justify-content: center; padding: 0; font-size: 1.125rem; }
.menu-select-trigger--icon > span { display: inline-flex; align-items: center; }
.menu-select-trigger > svg:last-child {
  color: var(--text-faint);
  margin-left: -0.1rem;
}
.menu-select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-select-trigger:hover,
.menu-select-trigger[aria-expanded="true"] {
  color: var(--text);
  background: var(--bg-hover);
}
.menu-select-trigger:hover > svg:last-child,
.menu-select-trigger[aria-expanded="true"] > svg:last-child {
  color: inherit;
}
.menu-select-pop {
  position: fixed;
  z-index: var(--z-menu);
  /* The detail lines are sentences. Without a cap the menu grew to the width
     of the longest one and covered the whole transcript. */
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.3rem;
  max-height: min(16rem, calc(100vh - 6rem));
  overflow: auto;
}
.menu-select-pop button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.42rem 0.6rem;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-ui);
  line-height: 1.3;
}
.menu-select-pop button:hover,
.menu-select-pop button.active {
  background: var(--bg-hover);
}
.menu-option-group { padding: .5rem .6rem .3rem; color: var(--text-faint); font-size: var(--text-2xs); font-weight: 500; }
.menu-select-pop button[aria-disabled="true"] { color: var(--text-muted); cursor: help; }
.menu-select-pop button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }

.steer-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.4rem;
  margin: 0.15rem 0 0.35rem;
}
.steer-row input {
  flex: 1;
  border: 0;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  outline: none;
  font-size: var(--text-xs);
}

.composer-preflight {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0.45rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--yellow) 32%, var(--border-color));
  border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--yellow) 7%, transparent);
  color: var(--text-muted);
  font-size: var(--text-2xs);
}
/* Two lines at most, and the whole sentence on hover: this sits above the
   thread, and a paragraph there pushes the conversation off screen. */
.composer-preflight > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.composer-preflight .ghost { flex-shrink: 0; font-size: var(--text-2xs); }
.workspace-mode-label { color: var(--green); }

.composer-context {
  position: relative;
  width: calc(100% - 2rem);
  max-width: calc(var(--chat-max) - 2rem);
  margin: -.6rem auto 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.875rem 0.5rem;
  font-size: var(--text-xs);
  background: color-mix(in srgb, var(--surface-0) 65%, transparent);
  border: 1px solid var(--border-color);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--text-faint);
  overflow: visible;
  flex-wrap: wrap;
}
.composer-context button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-context > button:first-child { min-width: 0; display: block; text-align: left; }
.composer-context > button:first-child svg { margin-right: .3rem; vertical-align: -.1rem; }
.composer-context button:hover {
  color: var(--text);
}
/*
 * The branch picker is the same control the composer uses above, where a
 * 1.75rem height and its own type are right. In this row they were not: it
 * rendered larger and bolder than the folder and terminal beside it, and its
 * height pushed the whole line off its baseline. Here it is one of the row.
 */
.composer-context .menu-select-trigger {
  height: auto;
  padding: 0;
  gap: 0.3rem;
  font-size: inherit;
  font-weight: inherit;
}
.composer-context button.missing {
  color: var(--yellow);
  font-weight: 600;
}
/* On a narrow composer the approvals chip keeps its shield; the preset name moves to its tooltip. */
@container composer (max-width: 28rem) {
  .composer-controls .menu-select-trigger[aria-label="Approvals"] > span,
  .composer-controls .menu-select-trigger[aria-label="Approvals"] > svg:last-child { display: none; }
}
@container composer (max-width: 28rem) {
  .composer-context .menu-select-trigger > span { display: none; }
  .composer-context .menu-select-trigger { min-height: 1.5rem; }
}
@container composer (max-width: 22rem) {
  .composer-glass { padding: 0.75rem 0.625rem 0.5rem; }
  .composer-row { gap: 0.25rem; }
  .composer-prompt-actions { gap: 0.125rem; }
  .composer-context { width: calc(100% - 1rem); gap: 0.5rem; }
}
.folder-chip-wrap {
  position: relative;
  display: inline-flex;
}
.folder-count {
  color: var(--text-faint);
}
.folder-panel-anchor {
  position: fixed;
  z-index: 80;
  width: min(22rem, calc(100vw - 1.5rem));
}
.folder-panel {
  background: var(--bg-elevated, var(--bg));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgb(0 0 0 / 28%);
  padding: 0.7rem;
  color: var(--text);
}
.folder-panel-head {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}
.folder-panel-title {
  font-size: var(--text-ui);
  font-weight: 600;
}
.folder-panel-path,
.folder-panel-note {
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.folder-panel-note {
  margin-bottom: 0.5rem;
}
.folder-panel-list {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.folder-panel-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.folder-panel-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0.15rem 0;
  min-width: 0;
}
.folder-panel-item .meta {
  color: var(--text-faint);
  font-size: var(--text-3xs);
}
.folder-badge {
  font-size: var(--text-3xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-left: auto;
}
.folder-panel-item-actions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.folder-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.files-roots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}
.files-roots button {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.5rem;
  font-size: var(--text-3xs);
}
.files-roots button.active {
  color: var(--text);
  background: var(--bg-hover);
}
.files-path {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: var(--text-2xs);
  color: var(--text-faint);
  font-family: var(--mono);
  margin-bottom: 0.4rem;
}
.files-empty .actions {
  margin-top: 0.6rem;
}

.chip,
.send,
.ghost,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  height: var(--control-h-sm);
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: var(--text-ui);
  font-weight: var(--weight-medium);
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--motion-instant) var(--ease-in-out),
    color var(--motion-instant) var(--ease-in-out),
    border-color var(--motion-instant) var(--ease-in-out),
    transform var(--motion-instant) var(--ease-in-out);
}
.chip:hover,
.ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
/* One button: a press gives a little, focus shows the shared ring, disabled is one opacity. */
:is(.chip, .send, .ghost, .danger):active:not(:disabled) { transform: scale(var(--press-scale)); }
:is(.chip, .send, .ghost, .danger):focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
:is(.chip, .ghost, .danger):disabled { opacity: var(--disabled-opacity); cursor: default; }
select {
  /* min-height, not height: .field-select adds 0.45rem of vertical padding, and
     with a hard 28px box that left an 11.6px content box for a 13px font — the
     option label was clipped through its baseline. min-height can only grow a
     box that is too small, so it fixes that without shrinking any other select. */
  min-height: 1.75rem;
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  background: var(--base);
  border-radius: var(--control-radius, var(--radius-sm));
  padding: 0 0.55rem;
  font-size: var(--text-xs);
  color: var(--subtext-0);
}
.send {
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent);
  font-weight: 500;
}
.send:hover:not(:disabled) {
  opacity: 0.92;
}
.send:disabled {
  opacity: var(--disabled-opacity);
  cursor: default;
}
.danger {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
}
.danger:hover {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent) 90%, transparent);
  color: var(--accent-fg);
  flex-shrink: 0;
  transition: background var(--motion-instant, 100ms) ease, opacity var(--motion-instant, 100ms) ease;
}
.send-btn:hover:not(:disabled) {
  background: var(--accent);
}
.send-btn:disabled {
  opacity: 0.3;
}
.send-btn.stop {
  background: var(--bg-active);
  color: var(--text);
}
.send-btn.stop:hover:not(:disabled) {
  background: var(--border-strong);
}

.panel {
  overflow: auto;
  background: var(--bg);
  padding: 1.25rem 1.5rem 2.5rem;
}
.panel-inner {
  width: min(var(--chat-max), 100%);
  margin: 0 auto;
}
.panel-header {
  margin: 0 0 1.1rem;
}
.panel-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.panel-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-ui);
}

.card {
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  margin-bottom: 0.65rem;
}
button.card {
  width: 100%;
  text-align: left;
}
button.card:hover {
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
button.card.active {
  border-color: color-mix(in srgb, var(--text) 18%, transparent);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.card h3 {
  margin: 0 0 0.35rem;
  font-size: var(--text-sm);
  letter-spacing: -0.02em;
}
.card pre.mono {
  max-height: 12rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.row > :first-child {
  min-width: 0;
}
.muted {
  color: var(--text-muted);
}
.faint {
  color: var(--text-faint);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
input[type="text"],
input[type="password"],
textarea.field,
.field-select {
  width: 100%;
  border: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  border-radius: var(--control-radius);
  padding: 0.45rem 0.625rem;
  outline: none;
}
input[type="text"]:focus,
input[type="password"]:focus,
textarea.field:focus,
select:focus,
.field-select:focus {
  /* The global focus outline loses to outline:none above; inputs show focus with their border and a soft halo. */
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 24%, transparent);
}
.field-select {
  width: auto;
  min-width: 11rem;
  font-size: var(--text-ui);
  line-height: 1.35;
  color: var(--text);
}
.setting-control .field-select {
  max-width: 14rem;
}
.setting-stacked {
  grid-template-columns: 1fr;
  align-items: start;
}
.setting-stacked .setting-control {
  justify-content: stretch;
  min-width: 0;
}
.setting-stacked .field-select {
  max-width: none;
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}
.git-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.palette-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 64%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: start center;
  padding-top: 16vh;
  z-index: var(--z-palette);
}
.palette-backdrop.center {
  place-items: center;
  padding-top: 0;
}
.palette {
  width: min(34rem, calc(100vw - 2rem));
  overflow: hidden;
  outline: none;
}
.palette-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  height: 3.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  flex-shrink: 0;
}
.palette-search-row svg {
  color: var(--text-muted);
  flex-shrink: 0;
}
.palette-search-row input,
.palette input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  outline: none;
  font-size: 0.9375rem;
  color: var(--text);
}
.palette > input {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}
.palette input::placeholder {
  color: var(--text-faint, #71717a);
}
.palette button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-ui);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 120ms ease, color 120ms ease;
}
.palette button:hover,
.palette button.active {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.conversation-approval {
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  margin: 1rem auto;
  max-width: var(--chat-max);
}
.conversation-approval h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
}
.actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.row > .actions {
  flex-wrap: nowrap;
  flex-shrink: 0;
  align-items: center;
  margin-top: 0;
}
.mono {
  font-family: var(--mono);
  font-size: var(--text-xs);
}

.inspector {
  width: var(--inspector-width);
  flex-shrink: 0;
  border-left: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 0;
}
.inspector.maximized {
  width: min(68rem, 60vw) !important;
}

.inspector-rail {
  touch-action: none;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 12;
}
.inspector-rail:hover,
.inspector-rail:active {
  background: color-mix(in srgb, var(--text) 12%, transparent);
}

/* Heading navigation without changing transcript layout or copied text. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  user-select: none;
}

/* Inspector tool tabs */
.panel-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.5rem;
  padding: 0.2rem 0.4rem 0.2rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  gap: 0.35rem;
}















.panel-chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-left: 0.4rem;
}


.panel-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  overflow: hidden;
}
.panel-breadcrumb-dir,
.panel-breadcrumb-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-breadcrumb-slash {
  color: var(--text-faint);
  font-weight: 600;
}
.panel-breadcrumb-sep {
  color: var(--text-faint);
  margin: 0 0.2rem;
}
.panel-breadcrumb-count {
  color: var(--yellow);
  font-weight: 500;
  margin-left: 0.3rem;
}

/* Main content wrapper */
.panel-inspector-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* State 1: Launcher Cards (matching Screenshot 1) */
.panel-launcher {
  flex: 1;
  display: flex;
  /* Column, not row: this centred a single child before the heading existed,
     and adding one turned it into a sibling sitting beside the cards. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  min-height: 0;
  overflow-y: auto;
  container-type: inline-size;
}
/* Two across where the panel allows it. A single column of full-width cards
   reads as a menu; a grid reads as a choice, and each card is short. */
.panel-launcher-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  max-width: 34rem;
}
@container (max-width: 30rem) {
  .panel-launcher-cards {
    grid-template-columns: minmax(0, 1fr);
    max-width: 21.5rem;
  }
}
.panel-launcher-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.62rem 0.95rem;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 450;
  cursor: pointer;
  text-align: left;
  transition:
    background var(--motion-instant) var(--motion-ease),
    border-color var(--motion-instant) var(--motion-ease),
    transform var(--motion-instant) var(--motion-ease);
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
}
.panel-launcher-card:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.panel-launcher-card:active {
  background: var(--bg-active);
}
.panel-launcher-lead {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.panel-launcher-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.panel-launcher-card:hover .panel-launcher-icon {
  color: var(--text);
}
.panel-launcher-label {
  font-weight: 500;
}
.panel-launcher-kbd {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  color: var(--text-faint);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* Files keep navigation separate from preview content at every panel width. */
.panel-files-surface {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.panel-files-surface > .advanced {
  flex-shrink: 0;
  max-height: 40%;
  overflow: auto;
  overflow-wrap: anywhere;
}
.panel-files-workspace {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.panel-file-preview-pane {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.panel-file-preview-pane .file-preview {
  flex: 1;
  min-height: 0;
  padding: 0.7rem 0.85rem;
}
.panel-file-preview-pane .file-preview-code,
.panel-file-preview-pane .file-editor-area {
  flex: 1;
  max-height: none;
}
.panel-empty-file-state {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.panel-empty-file-icon {
  color: var(--text-faint);
  margin-bottom: 0.85rem;
  opacity: 0.5;
}
.panel-empty-file-state h3 {
  font-size: 1.05rem;
  font-weight: 550;
  color: var(--text);
  margin: 0 0 0.35rem;
}
.panel-empty-file-state p {
  font-size: var(--text-ui);
  color: var(--text-faint);
  margin: 0;
}
.send-btn-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.panel-file-tree-pane {
  width: min(14.5rem, 42%);
  min-width: 10.5rem;
  max-width: 18rem;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
  flex-shrink: 0;
  overflow: hidden;
}
.panel-files-workspace.compact.tree-visible .panel-file-preview-pane {
  display: none;
}
.panel-files-workspace.compact .panel-file-tree-pane {
  flex: 1;
  width: 100%;
  max-width: none;
  min-width: 0;
  border-left: 0;
}
.panel-tree-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 0.65rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  box-sizing: border-box;
}
.panel-tree-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-faint);
  pointer-events: none;
}
.panel-tree-search-icon svg {
  display: block;
}
.panel-tree-search-wrap .panel-tree-search {
  flex: 1;
  min-width: 0;
  height: 1.25rem;
  line-height: 1.25rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-xs);
  outline: none;
  padding: 0;
}
.panel-tree-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-full);
}
.panel-tree-group {
  min-width: 0;
}
.panel-tree-empty {
  padding: 0.45rem 0.5rem;
  font-size: var(--text-2xs);
}
.panel-tree-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem;
  min-height: 0;
}
.panel-tree-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.25rem 0.45rem;
  border-radius: var(--control-radius);
  font-size: var(--text-xs);
  color: var(--subtext-0);
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  transition: background var(--motion-instant) var(--motion-ease);
}
.panel-tree-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.panel-tree-item.active {
  background: var(--bg-active);
  color: var(--text);
  font-weight: 550;
}
.panel-tree-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}
.panel-tree-chevron.open {
  color: var(--text-muted);
}
.panel-tree-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-faint);
  flex-shrink: 0;
}
.panel-tree-name {
  flex: 1;
  min-width: 0;
}
.panel-git-badge {
  font-size: var(--text-3xs);
  font-weight: 700;
  color: var(--green);
  margin-left: auto;
  padding: 0.05rem 0.25rem;
  border-radius: var(--radius-xs);
  background: rgb(143 191 136 / 16%);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

/* Tool Panes (Review, Terminal, Browser, Chat) */
.panel-tool-pane {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  min-height: 0;
}
.panel-review-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.panel-review-header .kv { flex: 1 1 12rem; min-width: 0; }
.panel-review-header .kv .mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-review-header .git-actions { flex-wrap: wrap; }
.panel-review-header .chip, .panel-pr-list-head .chip { min-height: 2rem; gap: .4rem; }
.panel-review-files h4,
.panel-diff-section h4 {
  margin: 0.75rem 0 0.4rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 600;
}
.panel-pr-list {
  margin: 0 0 0.8rem;
}
.pr-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.pr-search-field {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 13rem;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0 .65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--surface-0);
  color: var(--text-faint);
}
.pr-search-field svg { flex-shrink: 0; }
.pr-search-field input[type="search"] {
  appearance: none;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: .45rem 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: var(--text-ui);
  line-height: 1.35;
}
.pr-search-field:focus-within { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.pr-search-field input::placeholder { color: var(--text-faint); }
.pr-list-filters select { min-height: 2.25rem; }
.pr-list-filters select,
.pr-commit-select {
  max-width: 100%;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  font-size: var(--text-ui);
}
.pr-commit-select {
  width: 15rem;
  text-overflow: ellipsis;
}
.pr-pending-note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}
.pr-pending-note label,
.pr-pending-note textarea {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--text-ui);
}
.panel-pr-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.panel-pr-list-head h4 {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 600;
}
.panel-pr-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border-color);
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.15rem;
  text-align: left;
}
.panel-pr-row:hover { background: var(--bg-hover); }
.panel-pr-number,
.panel-pr-checks {
  color: var(--text-faint);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}
.panel-pr-copy {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}
.panel-pr-copy b,
.panel-pr-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-pr-copy b { font-size: var(--text-xs); font-weight: 550; }
.panel-pr-copy small { color: var(--text-faint); font-size: var(--text-3xs); }
.panel-pr-checks.success,
.panel-pr-checks.passing { color: var(--green); }
.panel-pr-checks.failure,
.panel-pr-checks.failing { color: var(--red); }
.panel-pr-checks.pending { color: var(--yellow); }
/* A draft is not ready, whatever its checks came back as. */
.panel-pr-checks.draft { color: var(--text-faint); }
.panel-pr-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.pr-stack-kicker { margin: 0.45rem 0 0; font-size: var(--text-3xs); }
.pr-stack {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.pr-stack-layers {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  overflow: hidden;
}
.pr-stack-layer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border-color);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.55rem;
  text-align: left;
  font-size: var(--text-xs);
}
.pr-stack-layers li:first-child .pr-stack-layer { border-top: 0; }
.pr-stack-layer:hover:not(:disabled) { background: var(--bg-hover); }
.pr-stack-layer.is-current {
  background: var(--bg-hover);
  font-weight: 550;
}
.pr-stack-layer:disabled { color: var(--text); }
.pr-stack-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pr-detail {
  display: grid;
  gap: 0;
  min-width: 0;
}
/* Grid tracks size to their content unless told otherwise, so one wide child —
   a diff, a long branch name — stretched the whole panel and pushed the rest
   of the inspector off screen. */
.pr-detail > * {
  min-width: 0;
}
.pr-detail-actions,
.pr-detail-kicker,
.pr-branch-line,
.pr-tabs,
.pr-file-list > div {
  display: flex;
  align-items: center;
}
.pr-detail-actions {
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.pr-detail-actions > .ghost { border: 0; background: transparent; padding: 0.25rem 0; font-size: var(--text-xs); }
.pr-detail-hero {
  padding: 0 0.2rem 0.85rem;
}
.pr-detail-kicker {
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}
.pr-detail-hero h3 {
  margin: 0.35rem 0 0.3rem;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
  /* Titles carry branch names and identifiers with no break opportunity. */
  overflow-wrap: anywhere;
}
.pr-detail-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-2xs);
}
.pr-branch-line {
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  color: var(--text-faint);
  font-size: var(--text-3xs);
}
/* `feature/some-long-branch-name` is one unbreakable token. Truncate it
   rather than let it run out of the panel. */
.pr-branch-line > span:not(.pr-diff-stat) {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-diff-stat {
  margin-left: auto;
  color: var(--text-faint);
  font-style: normal;
  white-space: nowrap;
}
.pr-diff-stat i { color: var(--green); font-style: normal; }
.pr-diff-stat b { color: var(--red); font-weight: 500; }
.pr-tabs {
  gap: 0.2rem;
  padding: 0.15rem;
  background: var(--surface-1);
  border-radius: var(--radius-md);
  border: 0;
}
.pr-tabs button {
  min-height: 1.75rem;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 0.7rem;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-xs);
}
.pr-tabs button:hover { color: var(--text); background: var(--bg-hover); }
.pr-tabs button.active { color: var(--text); background: var(--bg-active); }
.pr-loading { padding: 1rem 0.2rem; }
.pr-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-color);
}
.pr-meta-grid > div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.7rem 0.4rem;
}
.pr-meta-grid span {
  color: var(--text-faint);
  font-size: var(--text-3xs);
}
.pr-meta-grid b {
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-section { padding: 0.85rem 0.2rem; }
.pr-section h4 {
  margin: 0 0 0.65rem;
  font-size: var(--text-xs);
}
.pr-section .body,
.pr-timeline .body {
  font-size: var(--text-xs);
  line-height: 1.55;
}
.pr-timeline {
  padding: 0.5rem 0.2rem;
}
.pr-timeline-events { padding: 0.6rem 0 0.2rem 0.75rem; }
.pr-timeline-events > article {
  position: relative;
  min-width: 0;
  border-left: 1px solid var(--border-color);
  padding: 0 0 1.25rem 1.5rem;
}
.pr-timeline-events > article:last-child { border-left-color: transparent; }
.pr-timeline-marker {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0.25rem;
  left: -0.75rem;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--text-faint);
  background: var(--base);
}
.pr-timeline-event { min-width: 0; padding: 0.3rem 0; font-size: var(--text-ui); }
.pr-timeline-event > b { font-weight: 550; }
.pr-commit-link { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; padding: 0; background: none; color: var(--text); text-align: left; font-size: inherit; font-weight: 550; cursor: pointer; }
.pr-commit-link:hover { text-decoration: underline; }
.pr-event-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; font-size: var(--text-2xs); color: var(--text-faint); }
.pr-commit-message { margin-top: 0.5rem; }
.pr-commit-message > summary { font-size: var(--text-2xs); color: var(--text-faint); cursor: pointer; }
.pr-code {
  min-width: 0;
  padding-top: 0.55rem;
}
.pr-file-list {
  margin-bottom: 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.pr-file-list > div {
  gap: 0.5rem;
  min-height: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding: 0.35rem 0.55rem;
  font-size: var(--text-3xs);
}
.pr-file-list > div:last-child { border-bottom: 0; }
/* The end of a path is the half that identifies the file. Truncating from the
   right left two rows reading `.../ProviderRuntimeIngesti…`, one the source and
   one its test, with nothing to tell them apart. */
.pr-file-path {
  display: flex;
  min-width: 0;
}
.pr-file-dir {
  overflow: hidden;
  color: var(--text-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-file-name {
  flex-shrink: 0;
  white-space: nowrap;
}



.panel-browser-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  container-type: inline-size;
  background: var(--bg);
}

.browser-controls-trigger { display: flex; align-items: center; gap: .3rem; list-style: none; cursor: pointer; padding: .25rem .4rem; border-radius: var(--radius-sm); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.browser-controls-trigger::-webkit-details-marker { display: none; }
.browser-controls[open] > summary, .browser-controls-trigger:hover { background: var(--bg-hover); color: var(--text); }
.browser-controls-popover { position: absolute; top: calc(100% + .25rem); right: .5rem; width: min(23rem, calc(100cqw - 1rem)); max-height: min(28rem, 60vh); overflow: auto; padding: .85rem; box-sizing: border-box; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--surface-0); box-shadow: 0 .5rem 2rem #0005; font-size: var(--text-ui); }
.browser-controls-heading { display: flex; justify-content: space-between; gap: .5rem; }
.browser-controls-popover p { font-size: var(--text-ui); color: var(--text-muted); line-height: 1.5; }
.browser-controls-capability { margin-top: .8rem; color: var(--text-muted); }
.browser-controls-capability > summary { cursor: pointer; }
.browser-controls-popover .background-browser { margin-top: .8rem; padding: .8rem 0 0; border: 0; border-top: 1px solid var(--border-color); }
.preview-viewport { max-width: 7rem; min-height: 1.75rem; font-size: var(--text-xs); border: 1px solid var(--border-color); border-radius: var(--control-radius); background: var(--surface-0); color: var(--text-muted); }
@container (max-width: 540px) {
  .panel-browser-pane .preview-chrome-row { height: auto; flex-wrap: wrap; padding-block: .35rem; }
  .panel-browser-pane .preview-address-group { order: -1; flex: 1 0 100%; }
  .panel-browser-pane .preview-actions-cluster { margin-left: auto; }
  .browser-controls-trigger > span { display: none; }
  .browser-controls-trigger::after { content: ""; width: .3rem; height: .3rem; border: 1px solid currentColor; border-radius: 50%; }
  .browser-controls[data-allowed="true"] > summary::after { background: currentColor; }
}

.preview-chrome-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.5rem;
  min-height: 2.5rem;
  padding: 0 0.5rem;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 15;
  flex-shrink: 0;
}

.preview-nav-cluster,
.preview-actions-cluster {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.preview-chrome-btn {
  height: 1.75rem;
  width: 1.75rem;
  min-width: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.preview-chrome-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.preview-chrome-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.preview-chrome-btn.active {
  background: var(--bg-active);
  color: var(--text);
}

.preview-spin-icon {
  animation: previewSpin 1s linear infinite;
}

@keyframes previewSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.preview-address-group {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  min-width: 0;
  height: 1.85rem;
}

.preview-address-input {
  width: 100%;
  height: 100%;
  padding: 0 1.85rem 0 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--surface-sunken);
  color: var(--text);
  font-size: var(--text-xs);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.preview-address-input:hover {
  border-color: color-mix(in srgb, var(--text) 18%, transparent);
}

.preview-address-input:focus {
  border-color: color-mix(in srgb, var(--text) 28%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 15%, transparent);
  background: var(--surface-sunken);
}

.preview-address-input::placeholder {
  color: var(--text-faint);
}

.preview-address-inline-btn {
  position: absolute;
  right: 0.3rem;
  height: 1.35rem;
  width: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s ease, background 0.12s ease;
}

.preview-address-inline-btn:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
}

.preview-menu-anchor {
  position: relative;
  display: flex;
  align-items: center;
}

.preview-more-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 13rem;
  padding: 0.3rem;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  backdrop-filter: blur(16px);
  animation: previewMenuFadeIn 0.12s ease-out;
}

@keyframes previewMenuFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.preview-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.4rem 0.65rem;
  font-size: var(--text-xs);
  color: var(--text);
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  display: flex;
  align-items: center;
}

.preview-menu-item:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.preview-menu-item:disabled {
  color: var(--text-faint);
  cursor: default;
}

.preview-menu-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.preview-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0.2rem;
}

.preview-zoom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.65rem;
  font-size: var(--text-xs);
  color: var(--text);
  user-select: none;
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.preview-zoom-btn {
  height: 1.4rem;
  width: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--surface-0);
  color: var(--text);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  padding: 0;
}

.preview-zoom-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  border-color: color-mix(in srgb, var(--text) 20%, transparent);
}

.preview-zoom-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.preview-zoom-value {
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
  text-align: center;
  color: var(--text-muted);
}

/*
 * Moved with a transform rather than a background position.
 *
 * `background-position` is not a compositor property: animating it repaints
 * the bar on every frame for as long as a page is loading, which on a 120Hz
 * display is work the GPU does not need to be given.
 */
.preview-loading-bar {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  z-index: 20;
}
.preview-loading-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
  will-change: transform;
  animation: previewProgressPulse 1.2s infinite ease-in-out;
}

@keyframes previewProgressPulse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.embedded-browser-frame {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.embedded-browser-webview {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.browser-error {
  flex-shrink: 0;
  margin: 0.5rem 0.5rem 0;
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--border-color));
  border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--red);
  padding: 0.45rem 0.55rem;
  font-size: var(--text-2xs);
}
.local-server-list {
  min-height: 0;
  overflow: auto;
}
.panel-browser-links {
  width: min(46rem, 100%);
  margin: 1.75rem auto 0;
  /* The same inset as the other panels' content. */
  padding: 0 0.875rem 2rem;
  box-sizing: border-box;
}
.browser-home-section + .browser-home-section {
  margin-top: 1.5rem;
}
.browser-home-section > h4,
.browser-home-section > .row h4 {
  color: var(--text-muted);
  font-size: var(--text-ui);
  font-weight: 600;
}
.recent-server-grid .local-server-card {
  border-bottom: 0;
}
.local-server-list h4 { margin: 0 0 0.15rem; font-size: var(--text-ui); }
.local-server-list p { margin: 0; font-size: var(--text-2xs); }
.local-server-grid {
  display: grid;
  margin-top: 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.local-server-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  padding: 0.7rem;
  color: var(--text);
  text-align: left;
}
.local-server-card:last-child { border-bottom: 0; }
.local-server-card:hover { background: var(--bg-hover); }
.local-server-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
}
.local-server-status { font-size: var(--text-xs); white-space: nowrap; }
.local-server-copy { display: grid; min-width: 0; gap: 0.15rem; }
.local-server-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-ui); }
.local-server-copy small { color: var(--text-faint); font-size: var(--text-2xs); }

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-bottom: 0.75rem;
  padding: 0.12rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.change-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.change-row .list-item {
  flex: 1;
  min-width: 0;
}
.commit-form {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.commit-form input[type="text"] {
  flex: 1;
  min-width: 0;
  min-height: 2.25rem;
  font-size: var(--text-ui);
  line-height: 1.35;
  background: var(--surface-0);
}
.review-commit-button {
  flex-shrink: 0;
  min-height: 2.25rem;
  padding: .45rem .8rem;
  border: 1px solid var(--accent);
  border-radius: var(--control-radius);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-ui);
  font-weight: 550;
  cursor: pointer;
}
.review-commit-button:hover:not(:disabled) { filter: brightness(.92); }
.review-commit-button:disabled { background: var(--surface-1); border-color: var(--border-color); color: var(--text-faint); cursor: default; }
.review-commit-note { margin: .4rem 0 .65rem; font-size: var(--text-xs); color: var(--text-muted); }
.review-commit-note[role="alert"] { color: var(--red); }
.commit-form input:focus-visible, .review-commit-button:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }



.inspector-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  font-weight: 550;
  padding: 0.28rem 0.2rem;
  border-radius: var(--radius-sm);
}
.inspector-tabs button.active {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}
.tab-count {
  margin-left: 0.2rem;
  color: var(--text-faint);
}
.diff-view {
  margin: 0;
  font: 0.8125rem/1.65 var(--mono);
  color: var(--code-text);
  background: var(--code-bg);
  display: grid;
  grid-template-columns: minmax(max-content, 1fr);
  overflow: auto;
  max-height: 22rem;
}
.diff-line.add {
  color: var(--syntax-added);
  background: var(--diff-added-bg);
}
.diff-line.del {
  color: var(--syntax-removed);
  background: var(--diff-removed-bg);
}
.diff-line.hunk,
.diff-line.file {
  color: var(--code-muted);
  background: var(--code-header);
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  font-size: var(--text-3xs);
  font-weight: 650;
  flex-shrink: 0;
}
.body .md-h {
  margin: 1.15em 0 0.45em;
  font-size: 1.05em;
  line-height: 1.35;
  font-weight: 600;
}
.body h3.md-h { font-size: 1.2em; }
.body h4.md-h { font-size: 1.1em; }
.body > .md-h:first-child { margin-top: 0; }
/* The inspector styles its own h4s as small-caps section labels. A markdown
   heading is an h4 too, so `## Verification` in a pull-request body came out
   looking like one of Capsule's own chrome labels. */
.inspector .md-h {
  letter-spacing: normal;
  text-transform: none;
}
.body .md-list { margin: 0.8em 0; padding-left: 1.6em; }
.body .md-list .md-list { margin: 0.25em 0; }
.md-list > li { margin: 0.3em 0; padding-left: 0.15em; }
.md-list > li::marker { color: inherit; font-variant-numeric: tabular-nums; }
.md-list > .md-task { padding-left: 0; margin-left: -1.15em; }
.md-list .md-p { margin: 0.3em 0; }
.composer-glass.dropping::before {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 28%, transparent);
}
.inspector h4,
.inspector-header h4 {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 600;
}
.inspector-block {
  margin-bottom: 1.1rem;
}
.file-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  flex: 1;
  padding: 0.75rem;
  overflow: auto;
}
.file-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: var(--text-2xs);
  flex-shrink: 0;
}
.file-preview-bar .mono {
  min-width: 0;
  flex: 1;
}
.file-preview-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-height: 8rem;
  flex: 1;
}
.file-preview-image {
  max-width: 100%;
  max-height: 22rem;
  object-fit: contain;
  background:
    linear-gradient(45deg, rgb(127 127 127 / 18%) 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(45deg, transparent 75%, rgb(127 127 127 / 18%) 75%) 0 0 / 12px 12px,
    linear-gradient(45deg, transparent 75%, rgb(127 127 127 / 18%) 75%) 6px 6px / 12px 12px,
    linear-gradient(45deg, rgb(127 127 127 / 18%) 25%, transparent 25%) 6px 6px / 12px 12px;
}
.image-preview-open { cursor: zoom-in; width: 100%; }
.image-inspector {
  width: min(94vw, 90rem); height: 90vh; max-width: 96vw; max-height: 94vh;
  padding: 0; border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  background: var(--bg); color: var(--text); overflow: hidden;
}
.image-inspector[open] { display: flex; flex-direction: column; }
.image-inspector::backdrop { background: rgb(0 0 0 / 72%); }
.image-inspector-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.75rem; border-bottom: 1px solid var(--border-color); }
.image-inspector-toolbar > span { min-width: 0; flex: 1 1 10rem; font-size: var(--text-ui); }
.image-inspector-toolbar button { flex: none; font-size: var(--text-ui); }
.image-inspector-viewport { min-height: 0; flex: 1; overflow: auto; padding: 0.75rem; touch-action: pan-x pan-y; }
.image-inspector-viewport img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; margin: auto; }
.image-inspector-viewport[data-fit="false"] { cursor: grab; touch-action: none; }
.agent-command-control { position: relative; font-size: var(--text-ui); }
.agent-command-control > summary { list-style: none; cursor: pointer; padding: 0.35rem 0.6rem; color: var(--text-muted); }
.agent-command-control > summary::-webkit-details-marker { display: none; }
.agent-command-popover { display: grid; gap: 0.65rem; }
.agent-command-popover p { margin: 0; }
.agent-command-popover > header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.agent-command-popover select, .agent-command-popover input { min-width: 0; width: 100%; font-size: var(--text-ui); }
.file-preview-code {
  margin: 0;
  padding: 0.75rem;
  font-size: var(--text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  flex: 1;
  min-height: 14rem;
  max-height: none;
  overflow: auto;
}
.inspector .kv {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: var(--text-xs);
  padding: 0.18rem 0;
  color: var(--subtext-0);
}
.inspector .icon-btn:hover,
.inspector .icon-btn:active {
  transform: none;
}
.inspector .kv span:last-child {
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9.5rem;
}
.kv-list .kv {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--text-ui);
  padding: 0.28rem 0;
  color: var(--subtext-0);
}
.kv-list .kv span:last-child {
  color: var(--text);
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  border-radius: var(--control-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  overflow: hidden;
  margin-top: 0.4rem;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.75rem;
  font-size: var(--text-ui);
  color: var(--text);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--motion-fast) var(--motion-ease);
}
.shortcut-row:last-child {
  border-bottom: none;
}
.shortcut-row:hover {
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.shortcut-label {
  color: var(--text);
  font-weight: 450;
}
.shortcut-keys {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.35rem;
  font-family: var(--mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  line-height: 1;
  user-select: none;
}

.check {
  display: grid;
  grid-template-columns: 0.9rem 1fr;
  gap: 0.5rem;
  align-items: start;
  font-size: var(--text-ui);
  margin: 0.45rem 0;
}
.check .ok {
  color: var(--green);
}
.check .bad {
  color: var(--red);
}
.check .label {
  font-weight: 600;
}
.check .detail {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.notice {
  margin: 0.65rem auto 0;
  max-width: var(--chat-max);
  width: calc(100% - 2.5rem);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text-muted);
  font-size: var(--text-ui);
}
/* Neutral by default; red only when something failed and needs the user. */
.notice[role="alert"] {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}
/* An error leads with its mark, in its own colour, so it reads as one at a glance. */
.notice[role="alert"]::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.4em;
  vertical-align: -0.12em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='12' cy='12' r='9'/><path d='M12 8v5M12 16h.01'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='12' cy='12' r='9'/><path d='M12 8v5M12 16h.01'/></svg>") center / contain no-repeat;
  flex-shrink: 0;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 auto 0.75rem;
  max-width: var(--chat-max);
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  font-size: var(--text-xs);
  color: var(--subtext-1);
}
.banner.compact {
  padding: 0.35rem 0.55rem;
}
.banner.inline {
  margin: 0.75rem auto 0;
}
.banner p {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.artifact-preview {
  white-space: pre-wrap;
  margin-top: 0.5rem;
  max-height: 16rem;
  overflow: auto;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: var(--bg-sidebar, #0a0a0a);
  transition: opacity 200ms ease;
}
.splash.fading {
  opacity: 0;
  pointer-events: none;
}
.splash-mark {
  width: 5.25rem;
  height: 5.25rem;
  border-radius: 22%;
  object-fit: cover;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.5);
}
.splash p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.readiness {
  font-size: var(--text-xs);
  color: var(--overlay-1);
  white-space: nowrap;
}
.readiness.ready,
.readiness.dedicated {
  color: var(--subtext-1);
}
.readiness.running {
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.readiness.running::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
  transform-origin: center;
  animation: harness-breathe 1.5s ease-in-out infinite;
}
@keyframes harness-breathe {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.62);
  }
}
.session-live {
  margin-left: auto;
  width: 0.5rem;
  height: 0.5rem;
}
.session-class {
  margin-left: auto;
  font-size: var(--text-3xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-faint);
  flex-shrink: 0;
}
.session-class.blocked {
  color: var(--yellow);
}
.session-class.done {
  color: var(--green);
}
.readiness.missing_cli,
.readiness.needs_login,
.readiness.missing_acpx,
.readiness.gateway_offline {
  color: var(--yellow);
}

.action-menu-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  isolation: isolate;
}
.action-menu-scrim {
  position: absolute;
  inset: 0;
}
.action-menu {
  position: absolute;
  z-index: 1;
  min-width: 13.5rem;
  max-width: min(20rem, calc(100vw - 1rem));
  max-height: min(24rem, calc(100vh - 1rem));
  overflow: auto;
  padding: 0.25rem;
  outline: none;
}
.action-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 1.75rem;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-ui);
  line-height: 1.2;
}
.action-menu button:hover,
.action-menu button[data-highlighted="true"] {
  background: var(--bg-hover);
}
.action-menu button:disabled {
  opacity: 0.42;
  pointer-events: none;
}
.action-menu button.danger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 1.75rem;
  padding: 0.28rem 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--red);
  font-size: var(--text-ui);
  font-weight: 400;
  text-align: left;
}
.action-menu button.danger:hover,
.action-menu button.danger[data-highlighted="true"] {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  border: 0;
}
.action-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: var(--text-faint);
  flex-shrink: 0;
}
.action-menu button.danger .action-menu-icon {
  color: inherit;
}
.action-menu-sep {
  height: 1px;
  margin: 0.22rem 0.4rem;
  background: var(--border-color);
}
.action-menu-kbd {
  margin-left: auto;
  font-size: var(--text-2xs);
  color: var(--text-faint);
  letter-spacing: 0.04em;
  font-family: inherit;
}

.dialog {
  width: min(32rem, calc(100vw - 2rem));
  padding: 1.5rem;
  outline: none;
}
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dialog-header h3,
.dialog h3 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
}
.dialog-header p,
.dialog p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-ui);
  line-height: 1.45;
}
.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  flex-shrink: 0;
  margin-top: -0.15rem;
  margin-right: -0.15rem;
}
.dialog-close:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}
.clone-repository-dialog {
  display: grid;
  gap: 1rem;
  width: min(32rem, calc(100vw - 2rem));
}
.clone-repository-dialog h3,
.clone-repository-dialog > p { margin: 0; }
.clone-repository-dialog label {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 500;
}
.clone-repository-dialog label small {
  color: var(--text-faint, #71717a);
  font-weight: 400;
  font-size: var(--text-xs);
}
.clone-repository-dialog input[type="text"] {
  background: var(--surface-sunken);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  height: 2.25rem;
  box-sizing: border-box;
  font-size: var(--text-ui);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.clone-repository-dialog input[type="text"]:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
  background: var(--surface-sunken);
}
.clone-destination-field {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 500;
}
.clone-destination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface-sunken);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.65rem 0.4rem 0.75rem;
  min-width: 0;
  height: 2.25rem;
  box-sizing: border-box;
}
.clone-destination > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: var(--text-ui);
}
.clone-destination > span.placeholder {
  color: var(--text-faint, #71717a);
}
.clone-destination button.ghost {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 0 0.65rem;
  height: 1.625rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms ease;
}
.clone-destination button.ghost:hover {
  background: color-mix(in srgb, var(--text) 14%, transparent);
  border-color: color-mix(in srgb, var(--text) 18%, transparent);
  color: var(--text);
}
.dialog .actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.dialog .actions button.ghost {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 0 0.95rem;
  height: 2rem;
  font-size: var(--text-ui);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.dialog .actions button.ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.dialog .actions button.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.dialog .actions button.send {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius-md);
  padding: 0 1.15rem;
  height: 2rem;
  font-size: var(--text-ui);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.dialog .actions button.send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}
.dialog .actions button.send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.dialog .actions button.danger {
  /* The app's one destructive style: outlined red, as everywhere else. */
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 55%, transparent);
  color: var(--red);
  border-radius: var(--radius-md);
  padding: 0 1.15rem;
  height: 2rem;
  font-size: var(--text-ui);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease;
}
.dialog .actions button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 20%, transparent);
  border-color: var(--red);
}

@media (max-width: 1100px) {
  .inspector {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    box-shadow: var(--shadow);
    width: min(32rem, 100%) !important;
  }
  .inspector.maximized {
    width: 100% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .send-btn,
  .splash,
  .msg-actions,
  .switch span {
    transition: none;
  }
}

.panel-inner.settings-page {
  width: min(56rem, 100%);
}
.settings {
  display: block;
  /* So a wide child scrolls in its own box instead of widening the page. */
  min-width: 0;
}
.settings-body,
.settings-body .card {
  min-width: 0;
}
.settings-body .card h3 {
  margin-bottom: 0.55rem;
}
.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-color);
}
.card > .setting:first-child,
.setting:first-of-type {
  border-top: 0;
  padding-top: 0.15rem;
}
.theme-picker + .setting {
  margin-top: 0.5rem;
}
.setting-copy {
  font-size: var(--text-ui);
}
.setting-copy p {
  margin: 0.2rem 0 0;
  color: var(--text-faint);
  font-size: var(--text-xs);
}
.setting-control {
  min-width: 7.5rem;
  display: flex;
  justify-content: flex-end;
}
.setting-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.45rem;
}
.setting-stack {
  display: grid;
  gap: 0.4rem;
  justify-items: end;
  max-width: 22rem;
}
.setting-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22rem;
}
.worktree-storage .setting { grid-template-columns: minmax(0, 1fr); align-items: start; }
.worktree-storage .setting-control { min-width: 0; justify-content: flex-start; }
.worktree-storage .setting-stack { min-width: 0; max-width: 100%; justify-items: start; }
.worktree-storage .setting-path { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.project-settings-row {
  align-items: center;
}
.project-settings-icon {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 1.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-faint);
  font-size: var(--text-2xs);
  font-weight: 650;
}
.accent-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
  max-width: 16rem;
}
.accent-pick {
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text);
  border-radius: var(--radius-full);
  padding: 0.22rem 0.55rem;
  font-size: var(--text-xs);
}
.accent-pick.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}
.appearance-page {
  display: grid;
  gap: 0.9rem;
}
.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.7rem;
  margin-bottom: 0.5rem;
}
.theme-card {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: var(--radius-lg);
  padding: 0.55rem 0.4rem 0.5rem;
  font-size: var(--text-xs);
}
.theme-card.active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg-elevated);
}
.theme-card-stage {
  display: flex;
  width: 100%;
  height: 3.4rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg);
}
.theme-card-stage[data-kind="split"] .theme-mini {
  width: 50%;
}
.theme-mini {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
}
.theme-mini-sidebar {
  width: 28%;
  flex-shrink: 0;
}
.theme-mini-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  padding: 0.35rem 0.3rem;
}
.theme-mini-line {
  height: 0.28rem;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.28;
}
.theme-mini-line.short {
  width: 62%;
}
.theme-mini-accent {
  width: 0.42rem;
  height: 0.42rem;
  margin-top: auto;
  border-radius: var(--radius-full);
  background: var(--preview-accent);
}
.appearance-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.appearance-aa {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius-md);
  border: 2px solid;
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  flex-shrink: 0;
}
.color-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.color-control input[type="color"] {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
}
.color-hex {
  width: 6.4rem;
  border: 1px solid var(--border-color);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--control-radius);
  padding: 0.28rem 0.4rem;
  font-size: var(--text-xs);
}
.contrast-control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 9.5rem;
}
.contrast-control input[type="range"] {
  width: 7.5rem;
  accent-color: var(--accent);
}
label.field {
  display: grid;
  gap: 0.28rem;
  margin-top: 0.7rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
}
label.field input {
  color: var(--text);
  font-size: var(--text-ui);
}
.card .notice {
  margin: 0.75rem 0 0;
  max-width: none;
  width: auto;
}
.switch {
  position: relative;
  display: inline-flex;
  width: 2.15rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.switch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 18%, transparent);
  border: 1px solid var(--border-color);
  transition: background var(--motion-fast) var(--ease-in-out), border-color var(--motion-fast) var(--ease-in-out);
}
.switch span::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.12rem;
  width: 0.92rem;
  height: 0.92rem;
  border-radius: var(--radius-full);
  background: var(--text);
  transition: transform var(--motion-fast) var(--ease-in-out), background var(--motion-fast) var(--ease-in-out);
}
.switch input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + span::after {
  background: var(--accent-fg);
}
.switch input:checked + span::after {
  transform: translateX(0.88rem);
}
.switch input:focus-visible + span {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.switch input:disabled {
  cursor: not-allowed;
}
.switch input:disabled + span {
  opacity: 0.45;
}


/* Changed-files card: the turn's outcome on disk, summarised. */
.changed-files {
  margin: 0.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  overflow: hidden;
}
.changed-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
}
button.changed-files-head:hover { background: var(--bg-hover); }
div.changed-files-head { cursor: default; }
.changed-files-list { list-style: none; margin: 0; padding: 0 0 0.25rem; }
.changed-files-list .changed-file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.25rem 0.75rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: left;
}
.changed-files-list button:hover { background: var(--bg-hover); color: var(--text); }
.turn-saved-diff { min-width: 0; margin: 0.5rem 0 1rem; }
.turn-saved-diff-heading > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-saved-diff-heading > button { flex-shrink: 0; white-space: nowrap; }
.turn-saved-diff-heading {
  /* One toolbar row: the label takes the slack, the buttons sit together at the end. */
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  padding: 0.5rem 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.change-code {
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  font-family: var(--mono);
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.change-code.added { color: var(--green); }
.change-code.deleted { color: var(--red); }
.change-code.modified { color: var(--yellow); }
/* The filename carries the meaning; the directory is context. Only the
   directory truncates, so the basename is always readable. */
.change-path {
  display: flex;
  align-items: baseline;
  min-width: 0;
  flex: 1;
}
.change-dir {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  /* Truncate the *start* of the path so the deepest directories stay visible.
     `direction: rtl` does that, but on its own it also reorders the trailing
     separator to the front ("/apps/…" instead of "…/lib/"). `plaintext`
     resolves the run by its own content, keeping the characters in order. */
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: left;
}
.change-name {
  flex-shrink: 0;
  color: var(--text);
  font-weight: 500;
}
/* Destructive, so it stays out of the way until the row is hovered. */
.change-undo {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  padding: 0 0.35rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  opacity: 0;
  transition: opacity var(--motion-instant, 120ms) var(--motion-ease, ease);
}
.changed-files-list li { display: flex; align-items: center; }
.changed-files-list li:hover .change-undo,
.changed-files-list li:focus-within .change-undo {
  opacity: 1;
}
.change-undo:hover { color: var(--red); }
.diffstat {
  display: inline-flex;
  gap: 0.4rem;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}
.diffstat .added { color: var(--green); }
.diffstat .removed { color: var(--red); }
.changed-files-more {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border-color);
  background: transparent;
  padding: 0.4rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}
.changed-files-more:hover { color: var(--text); background: var(--bg-hover); }

/* A folded turn: one row standing in for a whole exchange. */
.turn-fold {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  margin: 0 0 1.1rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: transparent;
  padding: 0.4rem 0.65rem;
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-align: left;
}
.turn-fold:hover {
  background: var(--bg-hover);
  color: var(--text-muted);
  border-style: solid;
}
.turn-fold-count {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
/* The prompt is the only flexible column; it truncates rather than wrapping,
   so a folded turn stays exactly one row tall. */
.turn-fold-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Editable file view. Plain textarea rather than a highlighted surface: the
   value here is being able to fix a line without leaving the app, and a
   contentEditable code view is its own build. */
.file-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.file-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-0);
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.save-state { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.save-state.saved { color: var(--green); }
.save-state.error { color: var(--red); }
.file-editor-area {
  min-height: 16rem;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0.5rem;
  font-size: var(--text-xs);
  line-height: 1.5;
  tab-size: 2;
}
.file-editor-note { padding: 0 0 0.35rem; }

/* Shown when the file moved under an open editor. Both choices are explicit:
   nothing is auto-merged and nothing is silently dropped. */
.file-conflict {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--yellow) 10%, transparent);
  color: var(--text);
  font-size: var(--text-2xs);
  line-height: 1.4;
}
.file-conflict .actions { display: flex; gap: 0.4rem; margin: 0; }
.save-state.conflict { color: var(--yellow); }

/* The agent's full reasoning, on demand. The activity row shows only the
   latest fragment; this is every chunk it streamed, in order. */
.thinking {
  margin: 0.15rem 0 0.35rem 1.4rem;
  font-size: var(--text-xs);
}
.thinking > summary {
  cursor: pointer;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}
.thinking > summary:hover { color: var(--text-muted); }
.thinking-body {
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  border-left: 2px solid var(--border-color);
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 22rem;
  overflow: auto;
}

/* Fenced code: labelled, with its own copy control. A reply's code is the part
   people most often lift out, so it should not require selecting by hand. */
.msg-code-wrap {
  margin: 0.8em 0;
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.msg-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem 0.3rem 0.8rem;
  border-bottom: 1px solid var(--code-border);
  background: var(--code-header);
  color: var(--code-muted);
}
.msg-code-lang {
  font-family: var(--mono);
  font-size: max(0.75rem, 0.8em);
  color: var(--code-muted);
}
.msg-code-bar .icon-btn { font-size: var(--text-xs); color: inherit; }
.msg-code-wrap .msg-code {
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* =============================================================================
   Motion and overlay systems
   ============================================================================= */

/* ---------------------------------------------------------------------------
   1. Motion: message entrance animation
   A newly-created conversational turn settling into the timeline. Runs once on
   mount — blur + translate from below, compositor-accelerated.
   --------------------------------------------------------------------------- */
.motion-enter-conversation {
  animation: motion-enter-conversation var(--motion-arrival, 120ms) var(--motion-ease-arrival) both;
}
@keyframes motion-enter-conversation {
  from {
    opacity: 0;
    transform: translateY(var(--motion-distance-arrival, 0.25rem));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------------------------------------------------------------------
   2. Composer dock
   Animated rail that expands when an agent is actively working, plus radial
   corner masks for the smooth transition where composer meets chat area.
   --------------------------------------------------------------------------- */
.composer-dock {
  --composer-dock-active-rail: 2.125rem;
  --composer-dock-quiet-inset: 1.25rem;
  --composer-dock-release: calc(
    var(--composer-dock-active-rail) - var(--composer-dock-quiet-inset)
  );
  padding-bottom: var(--composer-dock-quiet-inset);
  transition: padding-bottom var(--motion-standard) var(--motion-ease);
}
.composer-dock--with-activity {
  padding-bottom: var(--composer-dock-active-rail);
}

/* Corner masks: smooth radius where the elevated composer meets the
   conversation background. Uses radial-gradient masks instead of overflow. */
.composer-overlay-corner-masks { position: relative; }
.composer-overlay-corner-masks::before,
.composer-overlay-corner-masks::after {
  position: absolute;
  bottom: var(--composer-dock-quiet-inset, 1.25rem);
  z-index: 0;
  width: 1rem;
  height: 1rem;
  background: var(--bg);
  content: "";
  transition: bottom var(--motion-standard) var(--motion-ease);
}
.composer-dock--with-activity .composer-overlay-corner-masks::before,
.composer-dock--with-activity .composer-overlay-corner-masks::after {
  bottom: var(--composer-dock-active-rail, 2.125rem);
}
.composer-overlay-corner-masks::before {
  left: 1.25rem;
  mask-image: radial-gradient(circle at top right, transparent 0 1rem, black calc(1rem + 0.5px));
  -webkit-mask-image: radial-gradient(circle at top right, transparent 0 1rem, black calc(1rem + 0.5px));
}
.composer-overlay-corner-masks::after {
  right: 1.25rem;
  mask-image: radial-gradient(circle at top left, transparent 0 1rem, black calc(1rem + 0.5px));
  -webkit-mask-image: radial-gradient(circle at top left, transparent 0 1rem, black calc(1rem + 0.5px));
}

/* Activity indicator rail — sits below the composer when agent is working. */
.composer-dock-activity {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
  opacity: 0;
  transform: translateY(0.25rem);
  transition:
    opacity var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}
.composer-dock--with-activity .composer-dock-activity {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .composer-dock,
  .composer-overlay-corner-masks::before,
  .composer-overlay-corner-masks::after,
  .composer-dock-activity,
  .composer-glass,
  .composer textarea {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   3. Sidebar: optional gradient background and prominent active rows
   Opt-in via `data-sidebar-gradient` attribute on the app container.
   --------------------------------------------------------------------------- */
[data-sidebar-gradient] .sidebar {
  --sidebar-fill: linear-gradient(
    180deg,
    var(--sidebar-gradient-top) 0%,
    var(--sidebar-gradient-bottom) 100%
  );
  background: var(--sidebar-fill);
}

/* Prominent active row when gradient is active */
[data-sidebar-gradient] .nav-item.active,
[data-sidebar-gradient] .list-item.active,
[data-sidebar-gradient] .thread-row.active {
  background: var(--sidebar-row-active-surface);
}
[data-sidebar-gradient] .project-row.active {
  background: var(--sidebar-row-subtle-active-surface);
}

/* ---------------------------------------------------------------------------
   4. Skeleton loading states
   Compositor-accelerated shimmer — animates opacity only, not
   background-position, to avoid main-thread style resolves.
   --------------------------------------------------------------------------- */
.skeleton {
  --skeleton-base: var(--bg-hover);
  --skeleton-shimmer: color-mix(in srgb, var(--surface-1) 60%, transparent);
  background: var(--skeleton-base);
  border-radius: var(--control-radius);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--skeleton-shimmer) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 2s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0%   { transform: translateX(-100%); opacity: 0; }
  30%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

.skeleton-line {
  height: 0.75rem;
  margin-bottom: 0.5rem;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

.skeleton-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-block {
  height: 4rem;
}

/* Inspector slide-in from the right. */
.inspector {
  animation: side-panel-enter var(--motion-standard, 180ms) var(--motion-ease-arrival) both;
  will-change: transform, opacity;
  /* Width changes that are not a drag — the refit after the window resizes —
     move rather than jump. A drag has to stay on the pointer, so the panel
     opts out of the transition while one is in progress. */
  transition: width var(--motion-standard, 180ms) var(--motion-ease-arrival);
}
.inspector[data-resizing="true"] {
  transition: none;
}
/*
 * The panel used to fade in at full width while the conversation reflowed in a
 * single frame. Animating the width itself opens the layout instead: with no
 * `to` block the animation ends at the width the panel was given.
 */
/* Opacity and transform only. `width` in here relayed out the panel — and
   everything beside it — on every frame of the entrance. */
@keyframes side-panel-enter {
  from {
    opacity: 0;
    transform: translateX(0.5rem);
  }
}

/* ---------------------------------------------------------------------------
   6. Micro-animations: clean, rigid interactive feedback (no bouncy scales)
   --------------------------------------------------------------------------- */
.squish-click:active {
  opacity: 0.8;
}

/* Subtle flat hover for icon buttons */
.icon-btn {
  transition:
    background var(--motion-instant, 100ms) var(--motion-ease),
    color var(--motion-instant, 100ms) var(--motion-ease);
}
.icon-btn:hover {
  background: var(--bg-hover);
}
.icon-btn:active {
  background: var(--bg-active);
}
.icon-btn.sidebar-toggle:hover,
.icon-btn.sidebar-toggle:active {
  transform: none;
}

/* Send button fast color transition */
.send-btn {
  transition:
    background var(--motion-instant, 100ms) var(--motion-ease),
    opacity var(--motion-instant, 100ms) var(--motion-ease);
}
.send-btn:hover:not(:disabled) {
  background: var(--accent);
}
.send-btn:active:not(:disabled) {
  opacity: 0.85;
}

/* Sidebar nav-item/thread-row hover transitions */
.nav-item,
.list-item,
.thread-row,
.project-row {
  transition:
    background var(--motion-instant) var(--motion-ease),
    color var(--motion-instant) var(--motion-ease);
}

/* Shimmer text for agent "thinking" / loading labels — compositor-accelerated
   opacity pulse, not background-position animation. */
.shimmer-text {
  color: var(--text-faint);
  display: inline-block;
  position: relative;
}
.shimmer-text > .shimmer-overlay {
  animation: shimmer-text-pulse 2.6s ease-in-out infinite;
  position: absolute;
  inset: 0;
  overflow: inherit;
  padding: inherit;
  white-space: inherit;
  color: var(--text-muted);
}
@keyframes shimmer-text-pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after,
  .shimmer-text > .shimmer-overlay {
    animation: none;
    opacity: 0.5;
  }
  /*
   * Every animation that repeats forever. Someone who asks the system for less
   * motion is usually asking because repetition is the part that hurts, and
   * these ran regardless: the spinners, the live dot, the readiness pulse, the
   * loading bar.
   */
  .icon-btn.is-spinning svg,
  .dot.live::after,
  .readiness.running::before,
  .preview-loading-bar::before,
  .preview-spin-icon {
    animation: none;
  }
  .dot.live::after {
    opacity: 0;
  }
  .inspector {
    animation: none;
    transition: none;
  }
  .icon-btn:hover,
  .icon-btn:active,
  .send-btn:hover,
  .send-btn:active {
    transform: none;
  }
}

/* ==========================================================================
   About Modal & Card
   ========================================================================== */

.about-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 64%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.about-modal-card {
  position: relative;
  width: 26rem;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 2.25rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.about-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.about-modal-close:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.about-embed-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.about-icon-squircle {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-2xl);
  background: linear-gradient(145deg, #2c2c30, #18181b);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.about-app-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.about-app-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.about-app-version {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.about-app-copyright {
  font-size: var(--text-ui);
  color: var(--text-faint, #636366);
  margin-bottom: 1.5rem;
}

.about-modal-actions {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ==========================================================================
   Skills Directory & Packs
   ========================================================================== */

.skills-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.skills-directory {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.5rem 0 2rem;
}

.skills-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.skills-header-text h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.skills-header-text p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.skills-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.skills-link-button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.skills-search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  width: min(26rem, 46%);
  border-radius: var(--radius-md);
  min-height: 2.35rem;
  padding: 0.3rem 0.65rem;
  gap: 0.625rem;
}

.skills-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.skills-search-bar .skills-search-input {
  width: auto;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  color: var(--text);
  font-size: var(--text-sm);
  flex: 1;
}

.skills-search-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skills-notice {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: var(--green);
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.skills-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.skills-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  margin-bottom: -1px;
  padding: 0.55rem 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  font-size: var(--text-ui);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.15s ease;
}

.skills-tab:hover {
  color: var(--text);
  background: transparent;
}

.skills-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  background: transparent;
}

.tab-count {
  font-size: var(--text-xs);
  background: color-mix(in srgb, var(--text) 10%, transparent);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-full);
}

.skills-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.skills-stats-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text);
}

.skills-spark-icon {
  color: var(--yellow, #f1c40f);
}

.skills-tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding-bottom: 0.25rem;
}

.tag-chip {
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-chip:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.tag-chip.active {
  background: color-mix(in srgb, var(--text) 15%, transparent);
  border-color: color-mix(in srgb, var(--text) 25%, transparent);
  color: var(--text);
  font-weight: 600;
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0.65rem;
}

.pack-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.pack-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pack-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-xs);
}

.pack-badge {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  color: var(--text);
}

.pack-author {
  color: var(--text-muted);
}

.pack-skill-count {
  margin-left: auto;
  color: var(--text-faint);
}

.pack-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.pack-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.pack-skills-section {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pack-skills-heading {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.pack-skills-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pack-skill-pill {
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-size: var(--text-xs);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pack-skill-pill:hover {
  background: var(--bg-active);
  border-color: var(--border-strong);
}

.pack-card-cli-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-sunken);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.375rem 0.625rem;
  gap: 0.5rem;
}

.pack-cmd-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.pack-cmd-copy:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.pack-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.875rem;
}

.pack-cmd {
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.65rem;
}

.skill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.15s ease;
}

.skill-card.attached {
  border-color: color-mix(in srgb, var(--text) 35%, transparent);
}

.skill-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skill-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.skill-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.skill-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.skill-version {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.skill-pack-tag {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-xs);
  display: inline-block;
  margin-top: 0.25rem;
}

.skill-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.skill-installs {
  font-size: var(--text-2xs);
  color: var(--text-faint);
}

.skill-status-badge {
  font-size: var(--text-2xs);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.skill-status-badge.installed {
  background: rgba(46, 204, 113, 0.12);
  color: var(--green);
}

.skill-desc {
  font-size: var(--text-ui);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.skill-tag {
  font-size: var(--text-2xs);
  color: var(--text-faint);
}

.skill-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.skill-card-actions .active-attached {
  background: color-mix(in srgb, var(--text) 20%, transparent);
  color: var(--text);
}

.skill-card-actions .installed {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
}

.skills-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: var(--text-sm);
}

.skills-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: var(--text-sm);
}

.installed-skills {
  display: grid;
  gap: 0.7rem;
}

.installed-skills-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.25rem;
}

.installed-skills-toolbar p {
  margin: 0;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}

.installed-skills-toolbar .ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.installed-skill-group {
  min-width: 0;
}

.installed-skill-group > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-color);
}

.installed-skill-group h3 {
  margin: 0;
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 600;
}

.installed-skill-group header p {
  max-width: 46rem;
  margin: 0.2rem 0 0;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  line-height: 1.45;
}

.installed-skill-group header > span {
  min-width: 1.6rem;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  text-align: center;
}

.installed-skills-empty {
  margin: 0;
  padding: 1rem 0;
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.installed-skill-list {
  display: grid;
}

.installed-skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.15rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 64%, transparent);
}

.installed-skill-row:last-child {
  border-bottom: 0;
}

.installed-skill-main {
  display: grid;
  grid-template-columns: minmax(8rem, 0.6fr) minmax(10rem, 1fr);
  align-items: center;
  gap: 0.3rem 0.8rem;
  min-width: 0;
  padding: 0.5rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.installed-skill-row:hover {
  background: var(--bg-hover);
}

.installed-skill-name {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.installed-skill-name b,
.installed-skill-name i,
.installed-skill-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.installed-skill-name b {
  color: var(--text);
  font-size: var(--text-xs);
}

.installed-skill-name i {
  color: var(--text-faint);
  font-size: var(--text-3xs);
  font-style: normal;
}

.installed-skill-description {
  color: var(--text-muted);
  font-size: var(--text-2xs);
}

.installed-skill-attach {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.45rem;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}

.installed-skill-attach:hover,
.installed-skill-attach.attached {
  background: var(--bg-hover);
  color: var(--text);
}

.installed-skills-more {
  width: 100%;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  text-align: left;
}

.installed-skills-more:hover {
  color: var(--text);
}

.skills-compact-section {
  display: grid;
  gap: 0.25rem;
}

.skills-section-intro {
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.skills-section-intro p {
  margin: 0;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}

.skill-pack-list,
.skill-catalog-list {
  display: grid;
  min-width: 0;
}

.skill-pack-row,
.skill-catalog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.15rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 64%, transparent);
}

.skill-pack-row:hover,
.skill-catalog-row:hover {
  background: var(--bg-hover);
}

.skill-pack-main,
.skill-catalog-main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.skill-pack-main {
  display: grid;
  grid-template-columns: minmax(10rem, 0.55fr) minmax(13rem, 1fr) minmax(9rem, 0.7fr);
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0;
}

.skill-pack-name,
.skill-catalog-name {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.skill-pack-name b,
.skill-catalog-name b {
  overflow: hidden;
  color: var(--text);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-pack-name i,
.skill-catalog-name i {
  overflow: hidden;
  color: var(--text-faint);
  font-size: var(--text-3xs);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-pack-description,
.skill-pack-summary,
.skill-catalog-description,
.skill-catalog-metric {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-pack-description,
.skill-catalog-description {
  color: var(--text-muted);
  font-size: var(--text-2xs);
}

.skill-pack-summary,
.skill-catalog-metric {
  color: var(--text-faint);
  font-size: var(--text-3xs);
}

.skill-catalog-main {
  display: grid;
  grid-template-columns: minmax(10rem, 0.55fr) minmax(13rem, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0;
}

.skill-catalog-description.missing {
  color: var(--text-faint);
  font-style: italic;
}

.skills-empty.compact,
.skill-catalog-list > .skills-empty,
.skill-catalog-list > .skills-loading {
  padding: 1.5rem 0;
  text-align: left;
}

.skills-inline-warning {
  padding: 0.45rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--yellow) 24%, transparent);
  color: color-mix(in srgb, var(--yellow) 78%, var(--text));
  font-size: var(--text-2xs);
}

.skills-inline-warning summary {
  cursor: pointer;
}

.skills-inline-warning p {
  margin: 0.4rem 0 0 1rem;
  color: var(--text-faint);
  line-height: 1.45;
}

.installed-skill-attach:disabled {
  cursor: default;
  opacity: 0.72;
}

@media (max-width: 720px) {
  .skills-header {
    align-items: stretch;
    flex-direction: column;
    gap: 0.75rem;
  }
  .skills-search-bar {
    width: 100%;
  }
  .installed-skills-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }
  .installed-skill-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .skill-pack-main,
  .skill-catalog-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }
}

/* ==========================================================================
   Skill & Pack Inspector Modals
   ========================================================================== */

.skill-inspect-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.skill-inspect-modal {
  width: 720px;
  max-width: 92vw;
  max-height: 88vh;
  background: var(--bg-sidebar, #1c1c1f);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.skill-inspect-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.skill-modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-modal-title-row h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.skill-modal-meta {
  font-size: var(--text-ui);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.skill-modal-subnav {
  display: flex;
  gap: 0.25rem;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border-color);
  padding: 0.25rem 1.5rem;
}

.skill-subnav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-ui);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.skill-subnav-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

.skill-subnav-btn.active {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  font-weight: 600;
}

.skill-inspect-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.skill-inspect-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skill-modal-desc {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.skill-markdown-pre {
  font-family: var(--mono);
  font-size: var(--text-ui);
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-sunken);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 0;
}

.skill-markdown-rendered {
  padding: 0.25rem 0;
  color: var(--text);
}

.skill-markdown-rendered .body {
  font-size: var(--text-ui);
  line-height: 1.65;
  white-space: pre-wrap;
}

.skill-markdown-rendered .body > .md-h:first-child {
  margin-top: 0;
}

.skill-markdown-rendered .body code {
  padding: 0.05rem 0.3rem;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
  font-family: var(--mono);
  font-size: 0.85em;
}

.skill-markdown-rendered .body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.skill-folder-explorer {
  display: grid;
  min-height: 24rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  overflow: hidden;
}

.skill-folder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-hover);
}

.skill-folder-heading > div {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.skill-folder-heading b {
  color: var(--text);
  font-size: var(--text-xs);
}

.skill-folder-heading span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: var(--text-3xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-folder-readonly {
  flex-shrink: 0;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
}

.skill-folder-error {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--red) 34%, transparent);
  color: var(--red);
  font-size: var(--text-2xs);
}

.skill-folder-workspace {
  display: grid;
  grid-template-columns: minmax(11rem, 0.38fr) minmax(0, 1fr);
  min-height: 21rem;
}

.skill-file-tree {
  min-width: 0;
  padding: 0.35rem 0;
  border-right: 1px solid var(--border-color);
  overflow: auto;
}

.skill-file-tree > p,
.skill-file-preview > p {
  margin: 0;
  padding: 0.75rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}

.skill-file-tree-row {
  width: 100%;
  min-width: 0;
  min-height: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-right: 0.45rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  text-align: left;
}

.skill-file-tree-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-file-tree-row:hover,
.skill-file-tree-row.active {
  background: var(--bg-hover);
  color: var(--text);
}

.skill-file-tree-row.file > svg {
  flex-shrink: 0;
}

.skill-file-tree-loading {
  min-height: 1.6rem;
  display: flex;
  align-items: center;
  color: var(--text-faint);
  font-size: var(--text-3xs);
}

.skill-file-preview {
  min-width: 0;
  max-height: 30rem;
  overflow: auto;
  background: var(--base);
}

.skill-file-preview-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
  padding: 0 0.65rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--base);
  color: var(--text-faint);
  font-size: var(--text-3xs);
}

.skill-file-note {
  margin: 0;
  padding: 0.35rem 0.75rem;
  color: var(--text-faint);
  font-size: var(--text-3xs);
}

.skill-file-markdown {
  padding: 0.85rem 1rem;
}

.skill-file-code {
  margin: 0;
  padding: 0.85rem 1rem;
  color: var(--text);
  font-size: var(--text-2xs);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.skill-file-image-frame {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.skill-file-image-frame img {
  max-width: 100%;
  max-height: 24rem;
  object-fit: contain;
}

@media (max-width: 640px) {
  .skill-folder-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .skill-file-tree {
    max-height: 11rem;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
}

.skill-cli-view {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.danger-text:hover {
  background: rgba(255, 107, 107, 0.15) !important;
}

.pack-detail-desc {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

.pack-included-skills h4,
.pack-cli-section h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text-muted);
}

.pack-modal-skills-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pack-modal-skill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-sunken);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  gap: 1rem;
}

.pack-modal-skill-main b {
  font-size: var(--text-sm);
  color: var(--text);
}

.pack-modal-skill-main p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0.125rem 0 0;
}

.pack-modal-skill-name {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.skill-inspect-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.skill-inspect-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   Topbar Breadcrumb & Workspace Quick Actions
   ========================================================================== */

.topbar-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-ui);
}

.breadcrumb-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-weight: 500;
}

.breadcrumb-segment.project-segment {
  color: var(--text);
  font-weight: 600;
}

.breadcrumb-segment.session-segment {
  color: var(--text-muted);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-icon {
  color: var(--text-muted);
  opacity: 0.8;
}

.breadcrumb-separator {
  color: var(--border-color);
  font-weight: 300;
  user-select: none;
}

.topbar-project-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: 0.25rem;
  min-width: 0;
}
/*
 * Keep the words, and keep every control reachable.
 *
 * `overflow: hidden` alone deleted whatever fell off the end — Commit sat 72px
 * past the row at an ordinary window size, with no scroll and no menu. Letting
 * the buttons shrink instead only traded that for illegibility: they squeezed
 * uniformly until a branch called "main" read as "m…", which tells a reader
 * less than a clipped button does.
 *
 * So the labels are not squeezed at all, and the row scrolls when it genuinely
 * runs out of room. The scrollbar is hidden because this is a strip of four
 * controls, not a document. A priority-ordered overflow menu would be better
 * still — the low-priority actions folding into a "…" — but nothing here is
 * ever unreachable or unreadable.
 */
.topbar-project-actions {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.topbar-project-actions::-webkit-scrollbar {
  display: none;
}
.topbar-project-actions > * {
  flex-shrink: 0;
}

.topbar-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.625rem;
  padding: 0 0.55rem;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  transition: background var(--motion-instant, 120ms) ease, border-color var(--motion-instant, 120ms) ease;
}
.topbar-chip-btn > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-chip-btn > svg {
  flex-shrink: 0;
}

.topbar-chip-btn:hover {
  background: var(--bg-active);
  border-color: var(--border-strong);
}

.topbar-chip-btn.git-chip {
  color: var(--text-muted);
}

.topbar-chip-btn.git-chip:hover {
  color: var(--text);
}

.git-dirty-indicator {
  color: var(--yellow);
  font-size: var(--text-sm);
  line-height: 0;
  margin-left: -0.1rem;
}

.topbar-menu-anchor {
  position: relative;
}

.topbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  padding: 0.25rem;
  z-index: var(--z-menu);
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.topbar-dropdown-menu button {
  /* A leading icon and its label sit on one line with a steady gap. */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  padding: 0.4rem 0.65rem;
  font-size: var(--text-xs);
  text-align: left;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.header-popover {
  position: fixed;
  right: auto;
  max-width: calc(100vw - 1rem);
  overflow: auto;
  -webkit-app-region: no-drag;
}
/*
 * A dialog opened from a popover covers it. Menus sit above dialogs so a menu
 * opened inside a dialog shows, which also left the popover a dialog came
 * from drawn on top of it. Closing that popover would unmount the dialog it
 * owns, so it is hidden instead and is back, as it was, when the dialog
 * closes. Body-level dialogs come after the popovers they were opened from;
 * the confirm dialog lives in the app root, before every popover, and opens
 * no menus of its own.
 */
body > :is(.header-popover, .action-menu, .menu-select-pop, .agent-model-picker, .composer-tools-popover, .agent-command-popover, .pr-action-menu):has(~ .palette-backdrop),
body:has(> #root .palette-backdrop > [role="alertdialog"]) > :is(.header-popover, .action-menu, .menu-select-pop, .agent-model-picker, .composer-tools-popover, .agent-command-popover, .pr-action-menu) {
  visibility: hidden;
}

.topbar-dropdown-menu button:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

/* Without this a disabled item looked exactly like one that works, and the
   only way to find out was to click it. */
.topbar-dropdown-menu button:disabled {
  color: var(--text-faint);
  cursor: default;
}
.topbar-dropdown-menu button:disabled:hover {
  background: transparent;
}

.commit-menu {
  min-width: 15rem;
  padding: 0.375rem;
}
.commit-menu-message {
  width: 100%;
  margin-bottom: 0.25rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-xs);
}
.commit-menu-message:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border-color));
}
.commit-menu-note {
  padding: 0.4rem 0.65rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
}

.project-actions-menu {
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 5rem));
  overflow: auto;
}
.project-action-form { display: grid; gap: 0.55rem; padding: 0.5rem; }
.project-action-form label { display: grid; gap: 0.25rem; color: var(--text-faint); font-size: var(--text-2xs); }
.project-action-form input { width: 100%; }
.project-action-form .actions { justify-content: flex-end; margin: 0.2rem 0 0; }
.project-actions-empty { margin: 0; padding: 0.5rem 0.65rem; }
.project-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.15rem;
}
.project-action-row .project-action-run {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.project-action-run > span:nth-child(2) { display: grid; min-width: 0; flex: 1; }
.project-action-run b,
.project-action-run small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-action-run small { color: var(--text-faint); font-size: var(--text-3xs); font-family: var(--mono); }
.project-action-state { color: var(--text-faint); font-size: var(--text-3xs); text-transform: capitalize; }
.project-action-state.running { color: var(--green); }
.project-action-state.failed { color: var(--red); }
.project-action-output {
  grid-column: 1 / -1;
  max-height: 8rem;
  margin: 0.1rem 0.4rem 0.45rem;
  padding: 0.45rem;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: var(--text-3xs);
  white-space: pre-wrap;
}

/* Settings use headings and separator rows as their hierarchy. Cards remain
   for the rest of the product, but stacked boxes made this page harder to scan. */
.settings-body .card {
  margin: 0;
  padding: 1.15rem 0;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
}
.settings-body .appearance-page { gap: 0; }
.settings-body .card:last-child { border-bottom: 0; }

/* ==========================================================================
   ContextWindowMeter (Ring + Popover Card)
   ========================================================================== */

.composer-actions-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}
.composer-tools { display: flex; align-items: center; }
.composer-tools .agent-command-control { position: static; }
.composer-tools .agent-command-control[hidden], .agent-command-control > summary[hidden] { display: none; }
.composer-tools-popover, .agent-command-popover {
  z-index: var(--z-menu); overflow-y: auto; box-sizing: border-box;
  padding: 0.875rem;
  font-size: var(--text-ui);
}
.composer-tools-popover > header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.composer-tools-popover .capability-details { margin: 0.5rem 0 0; }
@container composer-row (max-width: 36rem) {
  .composer-controls { flex: 1; }
  .composer-controls:has(.composer-agent-controls) { display: contents; }
  .composer-agent-controls { flex: 1 0 auto; flex-wrap: nowrap; min-width: max-content; }
  .composer-secondary-action { display: none; }
  .composer-actions-right { gap: .15rem; }
}

.context-meter-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.context-meter-ring {
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity 0.15s ease;
}

.context-meter-ring:hover {
  opacity: 0.85;
}

/* Popover card anchored above the ring */
.context-card {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 264px;
  padding: 0.75rem 0.875rem;
  z-index: var(--z-menu);
  animation: contextCardIn 0.12s ease;
}

@keyframes contextCardIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.context-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.context-card-title {
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--text);
}

.context-card-stat {
  font-size: var(--text-2xs);
  color: var(--text-muted);
}

.context-card-track {
  width: 100%;
  height: 4px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.context-card-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.context-card-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem 0.625rem;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.context-card-action:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-color: color-mix(in srgb, var(--text) 18%, transparent);
}

/* ==========================================================================
   RunSummary Accordion
   ========================================================================== */

.run-summary-card {
  margin: 0.25rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.run-summary-header {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: .375rem;
  text-align: left;
  padding: .25rem .125rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-family: inherit;
  line-height: 1.5;
  transition: color 0.15s ease;
}

.run-summary-header:hover {
  color: var(--text);
}

.run-summary-lead {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.run-summary-state { font-size: inherit; color: var(--text-muted); }
.run-summary-state::before { content: "·"; margin-right: .5rem; }
.run-summary-state[data-state="failed"], .run-summary-state[data-state="blocked"] { color: var(--red); }
.run-summary-header:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); border-radius: var(--radius-xs); }

.run-summary-icon {
  color: var(--text-muted);
}

.run-summary-label {
  font-weight: 500;
  color: var(--text-muted);
}

.run-summary-duration {
  color: var(--text-muted);
  font-size: var(--text-2xs);
}

.run-summary-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.run-summary-chevron.open {
  transform: rotate(180deg);
}

.run-summary-body {
  padding: 0 .75rem .5rem;
  margin: .25rem 0 .5rem .375rem;
  border-left: 1px solid var(--border-color);
  min-width: 0;
}

.run-summary-chips-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 .75rem .5rem;
  gap: 0.35rem;
}

.run-summary-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
  font-size: var(--text-2xs);
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
  max-width: 100%;
}
.run-summary-file-chip:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.run-summary-file-chip:disabled { cursor: default; }

.run-summary-file-chip:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  border-color: color-mix(in srgb, var(--text) 20%, transparent);
}

.file-chip-action {
  font-weight: 700;
  font-size: var(--text-2xs);
  line-height: 1;
}

.file-chip-action.created { color: var(--green, #30d158); }
.file-chip-action.modified { color: var(--yellow, #ffd60a); }
.file-chip-action.deleted { color: var(--red, #ff453a); }
.file-chip-action.read { color: var(--text-muted); }

.file-chip-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-stat {
  color: var(--green, #30d158);
  font-size: var(--text-3xs);
  font-family: var(--mono);
}

.file-chip-stat-del {
  color: var(--red, #ff453a);
  font-size: var(--text-3xs);
  font-family: var(--mono);
}

.run-summary-more-chip {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  padding: 0.1rem 0.3rem;
}

/* TurnFilesCard */
.turn-files-card {
  margin: 0.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  overflow: hidden;
}

.turn-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: color-mix(in srgb, var(--text) 2%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 5%, transparent);
  font-size: var(--text-xs);
}

.turn-files-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  color: var(--text-muted);
}

.turn-files-icon {
  color: var(--text-faint);
}

.turn-files-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.turn-files-diff-btn {
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.4rem;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.turn-files-diff-btn:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
}

.turn-files-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.25rem 0;
}

.turn-file-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.3rem 0.75rem;
  text-align: left;
  font-family: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background 0.15s ease;
}

.turn-file-pill:hover {
  background: var(--bg-hover);
}

.turn-file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: var(--text-2xs);
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.turn-file-badge.created {
  background: rgba(48, 209, 88, 0.15);
  color: var(--green, #30d158);
}

.turn-file-badge.modified {
  background: rgba(255, 214, 10, 0.15);
  color: var(--yellow, #ffd60a);
}

.turn-file-badge.deleted {
  background: rgba(255, 69, 58, 0.15);
  color: var(--red, #ff453a);
}

.turn-file-badge.read {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.turn-file-path {
  display: flex;
  align-items: baseline;
  min-width: 0;
  flex: 1;
  font-family: var(--mono);
  font-size: var(--text-2xs);
}

.turn-file-dir {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: left;
}

.turn-file-name {
  color: var(--text);
  font-weight: 500;
  flex-shrink: 0;
}

.turn-file-numstat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: var(--text-3xs);
}

.turn-file-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.turn-file-row:hover .turn-file-undo,
.turn-file-row:focus-within .turn-file-undo {
  opacity: 1;
}

.turn-file-undo {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  padding: 0 0.5rem;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.turn-file-undo:hover {
  color: var(--red, #ff453a);
}

.turn-files-restore-btn {
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.45rem;
  color: var(--text-muted);
  font-size: var(--text-2xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.turn-files-restore-btn:hover {
  background: rgba(255, 69, 58, 0.15);
  color: var(--red, #ff453a);
  border-color: rgba(255, 69, 58, 0.3);
}


/* ==========================================================================
   File Mentions (Clickable Inline Code)
   Identical to regular inline code, with a pointer cursor on hover.
   ========================================================================== */

.file-mention {
  cursor: pointer;
  text-decoration: none;
}

.file-mention:hover {
  text-decoration: underline;
  text-decoration-color: var(--text-muted);
  text-underline-offset: 2px;
}

/* ==========================================================================
   Harness Provider Cards (Settings → Agents)
   ========================================================================== */


@media (min-width: 640px) {
}













/* Landing card pieces reused from the old full-page layout. */
/* Landing: the app mark, and the two plain paragraphs that replaced the
   feature-card grid. Colours come from tokens so the page follows the same
   theme as the app rather than carrying its own hardcoded palette. */


/* ── Web landing ───────────────────────────────────────────────────────────
   A teaser card over the running app, and a modal behind one click. The app
   itself is the pitch, so the persistent overlay stays as small as it can be
   and never covers the composer. */


/* Narrow viewports get the panel as the page: the desktop shell has no
   meaningful phone layout, and showing a broken one sells nothing. */

.skills-notice-warn {
  border-color: color-mix(in srgb, var(--yellow) 40%, transparent);
  color: var(--yellow);
}
.skill-source-link {
  text-decoration: none;
}
.skill-source-link:hover {
  text-decoration: underline;
}
.skill-desc-missing {
  color: var(--text-faint);
  font-style: italic;
}

.settings-snippet {
  margin: 0.4rem 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--base);
  font-size: var(--text-xs);
  color: var(--subtext-0);
  overflow-x: auto;
  white-space: pre;
}

.skills-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0 0.5rem;
  font-size: var(--text-xs);
  color: var(--subtext-1);
}
.skills-source-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.skills-source-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.skills-source-dot.on {
  background: var(--green, #6aa84f);
}
.skills-source-dot.off {
  background: var(--text-faint);
}

/* Landing: the harnesses Capsule drives, with the CLI it spawns. A grid says
   the bring-your-own-subscription premise faster than a paragraph does. */
@media (max-width: 460px) {
}

/* Live typography samples in Appearance. */
.type-preview {
  margin: 0.15rem 0 0.9rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--base);
}
.type-preview-prose {
  margin: 0 0 0.55rem;
  font-size: var(--text-message);
  line-height: 1.55;
  color: var(--text);
}
.type-preview-code {
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-radius: var(--control-radius);
  background: var(--bg-hover);
  font-family: var(--mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--subtext-0);
  overflow-x: auto;
  white-space: pre;
}
.width-preview {
  margin: 0.15rem 0 0.9rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--base);
}
.width-preview-column {
  /* Scaled, not literal. The three widths are 40/48/60rem and the settings
     column is narrower than two of them, so at full size Default and Wide both
     clip to 100% and look identical. One constant factor keeps the options
     distinct and in order; in a very narrow column the widest still clamps. */
  width: calc(var(--chat-max) * 0.6);
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 0.3rem;
}
.width-preview-column span {
  display: block;
  height: 0.4rem;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
}
.width-preview-column span:last-child {
  width: 62%;
}

/* File-type mark in the tree. A short label reads at this size where a
   detailed glyph does not; the colour carries the family. */
.panel-file-mark {
  font-family: var(--mono);
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.palette-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(24rem, 60vh);
  overflow-y: auto;
  padding: 0.5rem;
  gap: 0.15rem;
}
.palette-empty {
  margin: 0;
  padding: 0.85rem 0.75rem;
  font-size: var(--text-ui);
  color: var(--text-faint, #71717a);
  text-align: center;
}
.palette-hints {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  background: color-mix(in srgb, var(--text) 2%, transparent);
  font-size: var(--text-xs);
  color: var(--text-faint, #71717a);
}
.palette-hints span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.palette-hints kbd {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  line-height: 1;
  padding: 0.15rem 0.35rem;
  min-width: 1.15rem;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text-muted);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Discovery uses one bounded surface, with secondary context below each name. */
.palette-backdrop:has(> .search-dialog) { background: color-mix(in srgb, var(--bg) 64%, transparent); }
.search-dialog { display: flex; flex-direction: column; max-height: calc(84dvh - 1rem); }
.search-dialog .palette-list { flex: 1; max-height: 25rem; overscroll-behavior: contain; scrollbar-gutter: stable; }
.search-dialog .palette-search-row { border-color: var(--border-color); }
.search-dialog .palette-search-row input { min-width: 0; font-size: var(--text-sm); }
.search-dialog .search-dialog-close { width: 1.75rem; height: 1.75rem; padding: .35rem; flex-shrink: 0; }
.search-dialog-section { color: var(--text-faint); font-size: var(--text-2xs); font-weight: 500; padding: .6rem .6rem .3rem; }
.search-dialog .search-dialog-item { min-height: 2.35rem; align-items: center; padding: .45rem .6rem; color: var(--text); transition: none; }
.search-dialog .search-dialog-item.active, .search-dialog button:hover { background: var(--bg-hover); color: var(--text); }
.search-dialog .search-dialog-item[aria-disabled="true"] { color: var(--text-muted); }
.search-dialog-icon { display: grid; place-items: center; flex: 0 0 1rem; color: var(--text-muted); }
.search-dialog-copy { display: grid; gap: .12rem; min-width: 0; flex: 1; }
.search-dialog-copy > span, .search-dialog-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dialog-copy > span { font-size: var(--text-ui); font-weight: 450; }
.search-dialog-copy small { color: var(--text-muted); font-size: var(--text-xs); }
.search-dialog-item > kbd { color: var(--text-faint); font: inherit; font-size: var(--text-2xs); flex-shrink: 0; }
.search-dialog .palette-hints { flex-wrap: wrap; gap: .75rem; border-color: var(--border-color); background: var(--bg-hover); flex-shrink: 0; }
.search-dialog .palette-hints kbd { color: var(--text-muted); background: var(--bg); border-color: var(--border-color); box-shadow: none; }
.search-dialog-feedback { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem 1rem; font-size: var(--text-ui); color: var(--red); }
.search-dialog-feedback > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.search-dialog .search-dialog-feedback button { width: auto; padding: .15rem .4rem; flex-shrink: 0; color: var(--text); }
.search-dialog-status { padding: .5rem 1rem 0; margin: 0; font-size: var(--text-xs); color: var(--text-muted); }
@media (pointer: coarse) { .search-dialog .search-dialog-item { min-height: 2.75rem; } }

.changed-files-actions {
  display: flex;
  /* Expanding sits at the reading edge, restoring at the far one: the safe
     move and the destructive one should not be neighbours. */
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem 0.45rem;
  border-top: 1px solid var(--border-color);
}
.changed-files-actions .ghost {
  font-size: var(--text-2xs);
}

/* Settings nav, hosted in the sidebar. */
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.5rem;
}
.settings-nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  padding: 0.34rem 0.45rem;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--subtext-1);
  font-size: var(--text-ui);
  text-align: left;
  cursor: pointer;
}
.settings-nav button:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.settings-nav button.active {
  background: var(--bg-active);
  color: var(--text);
  font-weight: 550;
}
.settings-result-section {
  flex-shrink: 0;
  font-size: var(--text-3xs);
  color: var(--text-faint);
}
.settings-breadcrumb {
  margin: 0 0 0.75rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.settings-breadcrumb span {
  padding: 0 0.3rem;
}
.rotate-180 {
  display: inline-flex;
  transform: rotate(180deg);
}

.settings-crumbbar {
  display: flex;
  align-items: center;
  /* Same height with or without controls, so switching sections does not jump. */
  min-height: var(--control-h-md);
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.settings-crumbbar .settings-breadcrumb {
  margin: 0;
}
.shortcut-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
button.shortcut-keys {
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--control-radius);
  padding: 0.15rem 0.3rem;
  cursor: pointer;
}
button.shortcut-keys:hover:not(:disabled) {
  border-color: var(--border-color);
}
button.shortcut-keys:disabled {
  cursor: default;
  opacity: 0.65;
}
button.shortcut-keys.capturing {
  border-color: var(--accent);
}
.shortcut-capturing {
  font-size: var(--text-2xs);
  color: var(--accent);
}
.settings-keybind-error {
  margin: 0 0 0.5rem;
  font-size: var(--text-xs);
  color: var(--red);
}

/* Context-window meter in the composer footer. The fill is animated with
   transform only: a width transition on a bar that updates every few seconds
   repaints continuously and shows up as GPU load on a high-refresh display. */
.context-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.context-meter-track {
  display: block;
  width: 2.5rem;
  height: 0.25rem;
  border-radius: var(--radius-xs);
  background: var(--bg-active);
  overflow: hidden;
}
.context-meter-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  transform-origin: left center;
  transition: transform 240ms ease;
}
.context-meter--warn {
  color: var(--yellow);
}
.context-meter--critical {
  color: var(--red);
}

/* How long a folded turn took, next to its message count. */
.turn-fold-duration {
  margin-left: auto;
  padding-left: 0.5rem;
  font-size: var(--text-2xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Usage view. */
.usage-controls .chip[aria-pressed="true"] {
  background: var(--bg-active);
  border-color: var(--border-strong, var(--border-color));
  color: var(--text);
}
.usage-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.usage-total {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.usage-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 5rem;
  margin-bottom: 1.25rem;
  padding: 0 0.1rem;
  border-bottom: 1px solid var(--border-color);
}
.usage-bar {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
  display: flex;
  align-items: flex-end;
}
.usage-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 1px 1px 0 0;
  background: var(--accent);
  transform-origin: bottom center;
}

/* A menu option that explains itself. */
/* The tile sits beside the text column, not above it, so the label and its
   detail line stay one block. */
.menu-select-pop button {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.menu-option-text {
  min-width: 0;
  flex: 1;
}
.agent-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.05rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-3xs);
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1;
  /* Neutral unless the provider has a colour people know it by. */
  color: var(--agent-accent, var(--text-muted));
  background: color-mix(in srgb, var(--agent-accent, var(--overlay-0)) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--agent-accent, var(--overlay-0)) 28%, transparent);
}
.menu-select-trigger .agent-glyph {
  margin-top: 0;
}
/* The drawn marks. A brand colour only when it survives this surface;
   otherwise the mark takes the row's own colour. */
.agent-mark {
  flex-shrink: 0;
  color: var(--agent-accent, currentColor);
}
.menu-select-pop .agent-mark {
  margin-top: 0.1rem;
}

.menu-option-label {
  display: block;
}
.menu-option-detail {
  display: block;
  margin-top: 0.1rem;
  font-size: var(--text-2xs);
  line-height: 1.35;
  color: var(--text-faint);
  white-space: normal;
}

/* Scope row above the project tree. */
.sidebar-scope {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem var(--sidebar-content-inset) 0.35rem;
}
/* The actions sit together at the end of the row they belong to. Dimmed
   rather than hidden until hover: with no projects yet, these two are the
   only way forward, and a control nobody can see is not a quiet one. */
.sidebar-scope-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  margin-left: auto;
  opacity: 0.55;
  transition: opacity var(--motion-instant, 120ms) var(--motion-ease, ease);
}
.sidebar-scope:hover .sidebar-scope-actions,
.sidebar-scope:focus-within .sidebar-scope-actions {
  opacity: 1;
}
.sidebar-scope-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  font-size: var(--text-ui);
  color: var(--subtext-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-scope-label svg {
  flex-shrink: 0;
  color: var(--text-faint);
}

/* Usage dashboard. */
.provider-quotas { container-type: inline-size; }
.provider-quotas-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.provider-quotas-heading h3 { margin: 0; }
.provider-quota-card { border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 0.875rem; margin-top: 0.75rem; }
.provider-quota-card header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.375rem 1rem; font-size: var(--text-ui); }
.provider-quota-card header > span, .provider-quota-card strong > span { color: var(--text-muted); font-weight: 400; }
.provider-quota-source, .provider-quota-observed { color: var(--text-muted); font-size: var(--text-xs); margin: 0.375rem 0; overflow-wrap: anywhere; }
.provider-quota-windows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.provider-quota-window-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.375rem; font-size: var(--text-ui); }
.provider-quota-window p { font-size: var(--text-xs); color: var(--text-muted); margin: 0.375rem 0 0; overflow-wrap: anywhere; }
.provider-quota-track { height: 0.375rem; border-radius: var(--radius-xl); overflow: hidden; background: var(--border-color); margin-top: 0.5rem; }
.provider-quota-track > span { display: block; height: 100%; background: var(--text-muted); }
.provider-quota-track > span[data-over-limit="true"] { background: var(--yellow); }
.provider-quota-select { display: grid; gap: 0.375rem; font-size: var(--text-ui); margin-top: 0.75rem; }
.provider-quota-select select { width: 100%; min-width: 0; font-size: inherit; }
.provider-quota-select small { font-size: var(--text-xs); color: var(--text-muted); }
@container (max-width: 28rem) {
  .provider-quota-windows { grid-template-columns: minmax(0, 1fr); }
  .provider-quotas-heading { flex-wrap: wrap; }
}
.usage-top {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  margin: 0.75rem 0 1.5rem;
}
@media (max-width: 900px) {
  .usage-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }
}
.usage-figure-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.usage-providers {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.7rem;
}
.usage-provider-head {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: var(--text-ui);
  color: var(--text);
}
.usage-provider-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.usage-provider-sub {
  display: block;
  margin-top: 0.1rem;
  padding-left: 0.95rem;
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.usage-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-faint);
}
/* One colour per provider, shared by the dot and its bars. */
.usage-dot--claude {
  background: var(--peach, #d4906a);
}
.usage-dot--codex {
  background: var(--subtext-1);
}
.usage-chart-block h4,
.usage-section {
  margin: 0 0 0.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--subtext-1);
}
.usage-section {
  margin-top: 1.5rem;
}
.usage-chart-frame {
  position: relative;
  padding-left: 2.75rem;
}
.usage-axis-max {
  position: absolute;
  left: 0;
  top: -0.35rem;
  font-size: var(--text-3xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.usage-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 7rem;
  border-bottom: 1px solid var(--border-color);
}
.usage-axis-x {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0 0 2.75rem;
  font-size: var(--text-3xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.usage-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 1rem 1.5rem;
}
.usage-figure-cell {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.usage-cell-label {
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.usage-cell-value {
  font-size: 1.0625rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
/*
 * A table that is wider than its column scrolls inside itself.
 *
 * The process table has a first column reserved at 12rem plus five more, and
 * on a narrow window it was wider than the settings page — so instead of
 * scrolling, it pushed the whole page sideways and every card in it went off
 * screen. Wide content scrolls in its own box; the page never does.
 */
.usage-table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
}
.usage-table thead,
.usage-table tbody {
  display: table;
  width: 100%;
}
.usage-table th {
  padding: 0 0 0.4rem;
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--text-faint);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.usage-table td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--subtext-0);
}
.usage-table tr:last-child td {
  border-bottom: 0;
}
.usage-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 1rem;
}

/* Usage is a dashboard, not a settings form: it reads across, so it gets the
   width rather than the 56rem reading column settings uses. */
.panel-inner.usage-page {
  width: min(72rem, 100%);
}

/* Skills tag filters. Ranked and capped, so this is one row rather than six. */
.skills-tag-filters .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.tag-chip .tag-count {
  font-size: var(--text-3xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.tag-chip.active .tag-count {
  color: inherit;
  opacity: 0.7;
}
.tag-chip.tag-more {
  color: var(--text-faint);
}

/* Card actions. Two solid accent buttons per card, repeated down a grid, made
   the page read as a wall of blue; the destination is the skill, not the
   button. The primary action keeps the accent as a text colour and a hairline,
   and only the attached state fills. */
.skill-card-actions .chip.send {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
  font-weight: 550;
}
.skill-card-actions .chip.send:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.skill-card-actions .chip.active-attached {
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid transparent;
}
.skill-card-actions .chip.installed {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-faint);
}

/* The page header was a title, two lines of prose and a full-width field
   before any skill. */
.skills-header h2 {
  font-size: 1.125rem;
  margin: 0;
}
.skills-header p {
  font-size: var(--text-ui);
  max-width: 46rem;
}
.skills-search-bar {
  max-width: 26rem;
}

/* Surface chooser in the inspector. */
.panel-launcher-head {
  text-align: center;
  margin-bottom: 1rem;
}
.panel-launcher-head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}
.panel-launcher-head p {
  margin: 0;
  font-size: var(--text-ui);
  color: var(--text-faint);
}
.panel-launcher-card {
  display: grid;
  gap: 0.25rem;
  align-items: start;
  justify-content: stretch;
  text-align: left;
  padding: 0.7rem 0.85rem;
}
.panel-launcher-lead {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.panel-launcher-card .panel-launcher-kbd {
  margin-left: auto;
}
.panel-launcher-detail {
  font-size: var(--text-2xs);
  line-height: 1.4;
  color: var(--text-faint);
}
.panel-launcher-card:disabled {
  cursor: default;
  opacity: 0.55;
}
.panel-launcher-card:disabled:hover {
  background: inherit;
}

/* Running turn: elapsed time beside the label. */
.run-elapsed {
  margin-left: 0.4rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
/* Kind-of-work icon on an activity row. */
.step-icon {
  display: inline-flex;
  align-items: center;
  margin-right: 0.3rem;
  color: var(--text-faint);
}
.step.error .step-icon {
  color: var(--red);
}

/* Hover preview on a folded turn. */
.turn-fold-preview {
  position: absolute;
  left: 0;
  top: calc(100% + 0.3rem);
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  width: min(24rem, 80vw);
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  background: var(--base);
  box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
  text-align: left;
  white-space: normal;
  pointer-events: none;
}
.turn-fold:hover .turn-fold-preview,
.turn-fold:focus-visible .turn-fold-preview {
  display: flex;
}
.turn-fold-preview-prompt {
  font-size: var(--text-xs);
  color: var(--text);
}
.turn-fold-preview-reply {
  font-size: var(--text-2xs);
  line-height: 1.45;
  color: var(--text-faint);
}

/* Markdown tables in a reply. Wide ones scroll inside the message rather than
   widening the transcript column. */
.md-table-wrap {
  overflow-x: auto;
  margin: 0.6rem 0;
}
.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375em;
}
.md-table th {
  padding: 0.35rem 0.7rem 0.35rem 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--subtext-1);
  font-weight: 550;
  white-space: nowrap;
}
.md-table td {
  padding: 0.4rem 0.7rem 0.4rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 55%, transparent);
  vertical-align: top;
}
.md-table tr:last-child td {
  border-bottom: 0;
}
.md-table code {
  white-space: nowrap;
}

/* Enough for a process name, and the table scrolls when the window is not. */
.process-table td:first-child {
  min-width: 12rem;
}
.process-table {
  min-width: 0;
}
.process-sampled {
  margin-top: 0.6rem;
  font-size: var(--text-2xs);
}

/* Host conditions above the process table: they explain it. */
.host-state {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.75rem 0 1rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  font-size: var(--text-xs);
  color: var(--subtext-0);
}
.host-state .usage-cell-label {
  margin-right: 0.2rem;
}
.host-state--notice {
  border-color: color-mix(in srgb, var(--yellow) 35%, var(--border-color));
}
.host-state--warn {
  border-color: color-mix(in srgb, var(--red) 45%, var(--border-color));
  color: var(--red);
}

.showcase-preview { width: 100%; height: 100vh; overflow: hidden; }

/* Detected source-control tooling. */
.tool-row {
  display: flex;
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-color);
}
.tool-row:last-child {
  border-bottom: 0;
}
.tool-dot {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.42rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-faint);
}
.tool-dot.on {
  background: var(--green);
}
.tool-body {
  min-width: 0;
}
.tool-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.tool-name {
  font-size: var(--text-sm);
  color: var(--text);
}
.tool-version {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.tool-account {
  font-size: var(--text-xs);
  color: var(--text-faint);
}
.tool-guidance {
  margin: 0.2rem 0 0;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--text-faint);
}
.tool-guidance code,
.tool-row code {
  font-family: var(--mono);
}

/* Harnesses screen: a stable catalog and one selected detail surface. */
.harness-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.harness-context-folder {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
}
.harness-context-folder > span {
  color: var(--text-faint);
  font-size: var(--text-2xs);
}
.harness-context-folder strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}
.harness-context-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.harness-workspace {
  display: grid;
  grid-template-columns: minmax(12.5rem, 0.75fr) minmax(0, 1.5fr);
  min-height: 24rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-0) 48%, transparent);
}
.harness-catalog {
  min-width: 0;
  padding: 0.35rem;
  border-right: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--surface-0) 58%, transparent);
}
.harness-catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem 0.5rem;
  color: var(--text-faint);
  font-size: var(--text-xs);
  font-weight: 600;
}
.harness-catalog-row {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) 1.75rem;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  padding: 0.6rem 0.55rem;
  margin-bottom: .2rem;
  text-align: left;
}
.harness-catalog-row:hover { background: var(--bg-hover); color: var(--text); }
.harness-catalog-row.active { background: var(--surface-1); border-color: var(--border-strong); color: var(--text); }
.harness-catalog-row:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.harness-catalog-copy {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}
.harness-catalog-row b,
.harness-catalog-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.harness-catalog-row b { font-size: var(--text-ui); font-weight: 550; }
.harness-catalog-row small { color: var(--text-muted); font-size: var(--text-2xs); }
.harness-catalog-indicators { display: flex; justify-content: flex-end; align-items: center; gap: .3rem; }
.harness-catalog-row i { width: 0.375rem; height: 0.375rem; }
.harness-show-all {
  width: 100%;
  margin-top: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  padding: 0.45rem 0.5rem;
  font-size: var(--text-2xs);
  text-align: left;
}
.harness-show-all:hover { color: var(--text); }
.harness-detail {
  min-width: 0;
  padding: 1rem;
}
.harness-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.harness-identity {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-width: 0;
}
.harness-identity > div { min-width: 0; }
.harness-identity b { font-size: var(--text-sm); }
.harness-identity .muted { margin-top: 0.2rem; font-size: var(--text-xs); line-height: 1.45; }
.harness-identity .mono,
.harness-identity .faint {
  margin-top: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-3xs);
}
.harness-dedication { margin-top: 1rem; }
.harness-doctor {
  margin-top: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem;
  background: var(--surface-0);
}
.harness-doctor pre {
  max-height: 8rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: var(--text-3xs);
}
.harness-primary-actions { margin-top: 0.85rem; }
.harness-live-sessions {
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
}
.harness-live-sessions .nav-label { padding-left: 0; }
.harness-session-diagnostics {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.65rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.harness-session-diagnostics summary { cursor: pointer; }
.harness-session-diagnostics pre {
  max-height: 20rem;
  margin: 0.65rem 0 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-2xs);
}
.harness-session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.harness-session-row .actions { margin-top: 0; }
.harness-session-row .ghost,
.harness-session-row .danger { min-width: auto; padding: 0 0.5rem; }
.harness-empty {
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: var(--text-xs);
}
.harness-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.harness-options label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.harness-options label > span {
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.harness-options input,
.harness-options select {
  min-width: 0;
  width: 100%;
}
.harness-options label > small {
  min-height: 2.1em;
  font-size: var(--text-3xs);
  line-height: 1.35;
}
.harness-workspace + details.card { margin-top: 0; }
@media (max-width: 820px) {
  .harness-context-bar,
  .harness-context-actions { align-items: stretch; }
  .harness-context-bar { flex-direction: column; }
  .harness-workspace { grid-template-columns: minmax(0, 1fr); }
  .harness-catalog { border-right: 0; border-bottom: 1px solid var(--border-color); }
  .harness-session-row { grid-template-columns: minmax(0, 1fr); }
}
details.card > summary {
  cursor: default;
  font-weight: 600;
  font-size: var(--text-ui);
}

/* Terminal panel. Docked under the composer so the shell and the conversation
   share the same folder and the same column. */
.terminal-dock {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
  border-top: 1px solid var(--border-color);
  background: var(--base);
}
.terminal-dock-rail {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 7px;
  cursor: ns-resize;
  z-index: 2;
}
.terminal-tabs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}
.terminal-tab {
  display: inline-flex;
  align-items: center;
  border-radius: var(--control-radius);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.terminal-tab:hover {
  background: var(--bg-hover);
}
.terminal-tab.active {
  background: var(--bg-active);
  color: var(--text);
}
.terminal-tab.exited {
  color: var(--text-faint);
}
.terminal-tab > button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  padding: 0.3rem 0.15rem 0.3rem 0.5rem;
  max-width: 12rem;
}
.terminal-tab > button > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.terminal-tab small {
  color: var(--text-faint);
  font-size: var(--text-3xs);
}
.terminal-tab-close {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  padding: 0.3rem 0.4rem 0.3rem 0.25rem;
  opacity: 0;
}
.terminal-tab:hover .terminal-tab-close,
.terminal-tab.active .terminal-tab-close {
  opacity: 1;
}
.terminal-tab-close:hover {
  color: var(--text);
}
.terminal-panes {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0.35rem 0.5rem 0.5rem;
  background: var(--base);
}
.terminal-pane {
  position: absolute;
  inset: 0.35rem 0.5rem 0.5rem;
  /* Hidden rather than unmounted: disposing an xterm loses the scrollback and
     kills whatever is running in it. */
  visibility: hidden;
  background: transparent;
}
.terminal-pane.active {
  visibility: visible;
}
.terminal-pane .xterm,
.terminal-pane .xterm-screen,
.terminal-pane .xterm-viewport {
  background: transparent !important;
  scrollbar-width: thin;
}

/* The action editor. Wider than the app's other dialogs because a command and
   a URL both want a full line to themselves. */
.project-action-dialog {
  width: min(32rem, calc(100vw - 2.5rem));
  display: grid;
  gap: 1rem;
}

.project-action-fields {
  display: grid;
  gap: 1rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.project-action-error {
  margin: 0;
  color: var(--red);
  font-size: var(--text-ui);
  overflow-wrap: anywhere;
}
.project-action-dialog label {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-size: var(--text-ui);
  font-weight: 500;
}
.project-action-dialog label small {
  color: var(--text-faint, #71717a);
  font-weight: 400;
  font-size: var(--text-xs);
}
.project-action-dialog .field-hint {
  color: var(--text-faint, #71717a);
  font-size: var(--text-xs);
  margin-top: 0.1rem;
}
.project-action-dialog input[type="text"] {
  background: var(--surface-sunken);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  height: 2.25rem;
  box-sizing: border-box;
  font-size: var(--text-ui);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.project-action-dialog input[type="text"]:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
  background: var(--surface-sunken);
}
.project-action-dialog textarea {
  resize: vertical;
  min-height: 4rem;
  background: var(--surface-sunken);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  box-sizing: border-box;
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--text-ui);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.project-action-dialog textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
  background: var(--surface-sunken);
}
.project-action-dialog .setting {
  padding: 0.65rem 0;
  border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}
.project-action-dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* What sending will do when the thread is live on another agent. A footnote
   under the control it is about — bordered and stacked over the prompt, it
   read as an error the thread had already hit. */
.composer-switch-note {
  position: relative;
  z-index: 1;
  margin: 0.35rem 0 0;
  padding-left: 0.4rem;
  font-size: var(--text-2xs);
  line-height: 1.35;
  color: var(--text-faint);
}

/* A failure the reader can put away. The banner used to sit there until the
   next one replaced it, over whatever they did next. */
.notice-dismissable {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.notice-dismissable > span {
  flex: 1;
  min-width: 0;
}
.notice-dismissable > .icon-btn {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.65;
}
.notice-dismissable > .icon-btn:hover {
  opacity: 1;
}

/* Resource history. Two lines, no axes: the shape is the point — whether the
   agents or the app were busy, and when. */
.resource-history {
  margin: 0.75rem 0 0.25rem;
}
.resource-history svg {
  width: 100%;
  height: 44px;
  display: block;
}
.resource-history path {
  fill: none;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.resource-history-agent {
  stroke: var(--green);
}
.resource-history-app {
  stroke: var(--overlay-0);
}
.resource-history figcaption {
  margin-top: 0.3rem;
  font-size: var(--text-2xs);
  color: var(--text-faint);
}
.resource-key-agent {
  color: var(--green);
}
.resource-key-app {
  color: var(--text-muted);
}
.process-section {
  margin-top: 1rem;
  /* A caption over a table starts at the table's edge, not at a sidebar row's inset. */
  padding-left: 0;
  padding-right: 0;
}
/* One table, not a header table over a body table: the columns line up. */
.process-table thead { display: table-header-group; }
.process-table tbody { display: table-row-group; }
.process-table { display: table; width: 100%; border-collapse: collapse; }

/* Project screen. The rows are settings, so they read like the ones in
   Settings rather than like a file listing. */
.project-folder-row,
.project-action-listing {
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
}
.project-folder-row:last-of-type,
.project-action-listing:last-of-type {
  border-bottom: 0;
}
.project-folder-row .inline-icon,
.project-action-listing .inline-icon {
  min-width: 0;
  gap: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-action-listing code {
  color: var(--text-faint);
  font-size: var(--text-xs);
}
/* A state, not a control: it says how a row is used, and clicking it does
   nothing. */
.chip-static {
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 0.05rem 0.3rem;
  font-size: var(--text-2xs);
  color: var(--text-faint);
}

/* Holds the thread's place while the first load lands, so the composer does
   not start centred and then jump to the bottom. */
.thread-hydrating {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 2rem 0;
}
.history-skeleton { display: block; width: 86%; height: 0.65rem; border-radius: var(--radius-sm); background: var(--bg-hover); }
.history-skeleton-prompt { align-self: flex-end; width: 38%; height: 2.75rem; margin-bottom: 2.5rem; border-radius: var(--radius-lg); }
.history-skeleton-short { width: 62%; }
.history-loading-label { margin-top: 0.4rem; font-size: var(--text-xs); color: var(--text-faint); }
.thread-history-error { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; margin-bottom: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); font-size: var(--text-ui); }
.thread-history-error p { margin: 0.3rem 0 0; color: var(--text-muted); overflow-wrap: anywhere; }
.thread-history-error .chip { flex: none; }

/* An empty sidebar asks for the one thing it needs, in the middle of the space
   it would otherwise leave blank. */
.sidebar-onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  text-align: center;
}
.sidebar-onboarding p {
  margin: 0;
  color: var(--text-faint);
  font-size: var(--text-ui);
}
.sidebar-loading {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem var(--sidebar-content-inset);
}
.sidebar-loading .skeleton-line {
  height: 0.9rem;
}

/* Source picker. A row is an icon, a name and what it does — the same shape
   the command palette uses, so the two read as one surface. */
.palette-section {
  margin: 0;
  padding: 0.45rem 0.65rem 0.25rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-faint, #71717a);
}
.palette-source {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.palette-source-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 120ms ease;
}
.palette-source-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.palette-source b {
  font-size: var(--text-ui);
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
}
.palette-source small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.35;
}
.palette-source.active {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.palette-source.active .palette-source-icon {
  background: color-mix(in srgb, var(--text) 12%, transparent);
  border-color: color-mix(in srgb, var(--text) 16%, transparent);
  color: var(--text);
}
.palette-source.active b {
  color: var(--text);
}
.palette-source.active small {
  color: var(--text-muted);
}

/* A finished turn's work log. No "Working" line above it and no shimmer —
   just the card, collapsed, saying what the turn did. */
.active-run-msg.settled .run-summary-card {
  margin-top: 0;
}
.active-run-msg.settled {
  padding-top: 0;
}

/* Why the last turn failed. Sized to its text and capped at three lines, with
   the whole message on hover: a wall of red the width of the thread reads as
   the app breaking rather than one turn going wrong. */
/* Aligned with the messages and cards it sits under, not floated in the
   middle of them: it is one more block in the thread's single column. */
.thread-error {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0.4375rem 0.4375rem 0.4375rem 0.625rem;
  border: 1px solid color-mix(in srgb, var(--red) 32%, transparent);
  border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--text);
  font-size: var(--text-ui);
  line-height: 1.45;
}
.thread-error > svg:first-child {
  flex-shrink: 0;
  margin-top: 0.1875rem;
  color: var(--red);
}
.thread-error-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.thread-error .icon-btn {
  flex-shrink: 0;
  margin: -0.125rem -0.125rem 0 0;
  color: var(--text-muted);
}
.thread-error .icon-btn:hover {
  color: var(--text);
}

/* Runtime route picker: one row per option, the whole row is the target. */
.runtime-modes {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.runtime-mode {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  cursor: pointer;
}
.runtime-mode:hover {
  background: var(--bg-hover);
}
.runtime-mode.selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border-color));
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.runtime-mode input {
  margin-top: 0.15rem;
}
.runtime-mode-body {
  display: grid;
  gap: 0.15rem;
  font-size: var(--text-ui);
}
.runtime-mode-body .muted {
  font-size: var(--text-xs);
  line-height: 1.45;
}
.runtime-mode-note {
  margin-top: 0.6rem;
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* A turn in flight, said in one line: how long, how much, what it is doing. */
.turn-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding-bottom: 0.75rem;
  margin: 0.75rem 0 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-faint);
  font-size: var(--text-ui);
}
.turn-status > svg,
.turn-status .agent-glyph {
  flex-shrink: 0;
}
.turn-status .run-elapsed {
  margin-left: 0;
}
.turn-status-dot {
  flex-shrink: 0;
  opacity: 0.6;
}
.turn-status-tokens {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
/* The state is the part that changes; it gives way first when the column is
   narrow, because the clock and the count are fixed width and it is not. */
.turn-status-state {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Work belongs between updates; diagnostic text is mounted only on request. */
.workspace-startup { display: grid; place-items: center; min-height: 100dvh; padding: 2rem; background: var(--bg); }
.workspace-startup-card { width: min(100%, 30rem); text-align: center; overflow-wrap: anywhere; }
.workspace-startup-card .empty-thread-mark { margin: 0 auto 1.25rem; }
.workspace-startup-card h1 { font-size: 1.5rem; line-height: 1.3; }
.workspace-startup-card p { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.6; margin: 1rem 0; }
.workspace-startup-card [role="alert"] { color: var(--text); }
.inline-activity { margin: 0.05rem 0 0.35rem; min-width: 0; }
.inline-activity-toggle {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; max-width: 100%;
  border: 0; background: transparent; padding: 0.15rem 0;
  color: var(--text-muted); font-size: var(--text-ui); text-align: left;
}
.inline-activity-toggle:hover { color: var(--text); }
.inline-activity-toggle > svg { flex: none; }
.inline-activity-toggle > svg.open { transform: rotate(90deg); }
.inline-activity-kinds {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex: none;
}
.inline-activity-kinds svg {
  display: block;
  flex: none;
}
.inline-activity-state { color: var(--text-faint); font-size: var(--text-xs); }
.inline-activity-overflow { color: var(--text-faint); font-size: var(--text-xs); }
.inline-activity-failures { color: var(--red); font-size: var(--text-xs); }
.inline-activity-current { margin-top: 0.25rem; border-left: 2px solid var(--border-strong); padding-left: 0.4rem; }
.inline-activity[data-state="Failed"] > button > .inline-activity-state { color: var(--red); }
.inline-activity-tools { list-style: none; padding: 0; margin: 0.35rem 0; max-height: 24rem; overflow: auto; overscroll-behavior: contain; }
.inline-activity-tools > li { min-width: 0; padding: 0.15rem 0; font-size: var(--text-ui); }
.inline-activity-tools .inline-activity-state { flex: 0 0 auto; }
.activity-step-toggle { display: grid; grid-template-columns: 1rem minmax(0, 1fr) auto 0.75rem; gap: 0.5rem; align-items: center; width: 100%; padding: 0.45rem 0.35rem; background: transparent; border: 0; border-radius: var(--radius-sm); text-align: left; color: var(--text-muted); font-size: var(--text-ui); }
.activity-step-toggle:not(.activity-step-static):hover { color: var(--text); background: var(--bg-hover); }
.activity-step-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-step-toggle .open { transform: rotate(90deg); }
.activity-step[data-state="Failed"] .inline-activity-state { color: var(--red); }
.activity-step-body { margin: 0.2rem 0.25rem 0.65rem; min-width: 0; }
.activity-step-body > p { font-size: var(--text-xs); line-height: 1.5; margin: 0.5rem 0; }
.activity-tool-text { min-width: 0; margin: 0.35rem 0; overflow: hidden; }
.activity-tool-text-heading { display: flex; align-items: center; justify-content: space-between; min-height: 2rem; gap: 0.5rem; padding: 0.25rem 0.65rem; color: var(--text-muted); font-size: var(--text-xs); }
.activity-tool-text pre { margin: 0; padding: 0.35rem 0.65rem; max-height: 12rem; overflow: auto; overscroll-behavior: contain; font-family: var(--mono); font-size: var(--text-ui); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-muted); }
.activity-step-files { display: flex; flex-direction: column; gap: 0.25rem; }
.activity-file { display: flex; align-items: start; gap: 0.35rem; max-width: 100%; width: fit-content; border: 0; background: none; padding: 0.25rem 0; color: var(--text-muted); font-size: var(--text-ui); text-align: left; overflow-wrap: anywhere; }
.activity-file svg { flex: none; margin-top: 0.15rem; }
.activity-file:hover { color: var(--text); text-decoration: underline; }
.run-summary-card.expanded { border-color: var(--border-color); }
.turn-work { margin: 1rem 0; }
.turn-work-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0; border: 0; background: none; color: var(--text-muted); font-size: var(--text-ui); cursor: pointer; }
.turn-work-toggle:hover { color: var(--text); }
.turn-work-toggle .open { transform: rotate(90deg); }
.turn-work-failure { color: var(--red); font-size: var(--text-xs); }
.turn-work-body { padding-top: 0.75rem; border-top: 1px solid var(--border-color); }

/* Public policy pages: one readable column, the site's own type. */
.policy-page {
  min-height: 100vh;
  padding: 2rem 1.5rem 4rem;
}
.policy-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 46rem;
  margin: 0 auto 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.policy-home {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.policy-nav {
  display: flex;
  gap: 1rem;
  margin-left: auto;
  font-size: var(--text-sm);
}
.policy-nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.policy-nav a:hover,
.policy-nav a.current {
  color: var(--text);
}
.policy-body {
  max-width: 46rem;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}
.policy-body h1,
.policy-body h2 {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}
.policy-body h3 {
  margin: 2.25rem 0 0.5rem;
  color: var(--text);
  font-size: 1.125rem;
}
.policy-body h4 {
  margin: 1.5rem 0 0.4rem;
  color: var(--text);
  font-size: 1rem;
}
.policy-body p {
  margin: 0 0 1rem;
}
.policy-body strong {
  color: var(--text);
}
.policy-body a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.policy-body ul,
.policy-body ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}
.policy-body li {
  margin-bottom: 0.35rem;
}
.policy-body code {
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
  font-family: var(--mono);
  font-size: 0.85em;
}
.policy-body pre {
  overflow-x: auto;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-hover);
}
.policy-body pre code {
  padding: 0;
  background: none;
}
.policy-body table {
  display: block;
  overflow-x: auto;
  width: 100%;
  margin: 0 0 1.25rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.policy-body th,
.policy-body td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
}
.policy-body th {
  color: var(--text);
  font-weight: 600;
}
.policy-body hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border-color);
}
.policy-body em {
  color: var(--text-faint);
}

/* ── Pull request: files, checks and the controls above them ─────────────
 *
 * The patch used to be one <pre> coloured by first character. These style a
 * real diff: a section per file that can be closed, a gutter of line numbers
 * on each side, and a split view that puts the two sides next to each other.
 */
.pr-tabrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0.4rem 0;
}
.pr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.2rem 0.75rem;
}
.pr-toolbar .pr-add { color: var(--green); font-style: normal; }
.pr-toolbar .pr-del { color: var(--red); font-weight: 500; }

.pr-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-weight: 400;
}
.pr-pill {
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-active);
  font-size: var(--text-xs);
  /* A long label shortens rather than widening the row it sits in. */
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checks-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  color: var(--text-faint);
  white-space: nowrap;
}
.checks-badge--success { color: var(--text-muted); }
.checks-badge--success svg { color: var(--green); }
.checks-badge--failure { color: var(--red); }
.checks-badge--pending { color: var(--text-faint); }

.pr-collapsible-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.pr-collapsible-head h4 { margin: 0; }
.pr-collapsible-caret { color: var(--text-faint); font-size: var(--text-2xs); }
.pr-collapsible-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: var(--text-ui);
}

.pr-checks { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.pr-checks li { min-width: 0; }
.pr-check {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.2rem;
  color: inherit;
  text-decoration: none;
  font-size: var(--text-ui);
}
a.pr-check:hover { background: var(--bg-hover); }
.pr-check-name { min-width: 0; overflow-wrap: anywhere; }
.pr-check-copy { display: grid; min-width: 0; gap: 0.15rem; }
.pr-check-glyph { display: flex; align-items: center; }
.pr-check-workflow {
  color: var(--text-faint);
  font-size: var(--text-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-check-state { color: var(--text-faint); font-size: var(--text-xs); text-transform: capitalize; }
.pr-check-glyph--success { color: var(--green); }
.pr-check-glyph--failure, .pr-check-state--failure { color: var(--red); }
.pr-check-glyph--pending, .pr-check-state--pending { color: var(--text-faint); }
.pr-check-glyph--skipped, .pr-check-glyph--neutral, .pr-check-glyph--cancelled { color: var(--text-faint); }

.pr-file-diffs { display: flex; flex-direction: column; gap: 0; }
.file-diff {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}
.file-diff-head {
  /* Stays in view while its file's hunks scroll under it. */
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: var(--control-h-md);
  padding: 0 0.5rem;
  border: 0;
  background: var(--code-header);
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-size: var(--text-xs);
}
.file-diff-head:hover { background: var(--bg-hover); }
.file-diff-caret { color: var(--text-faint); font-size: var(--text-2xs); }
.file-diff-path {
  display: flex;
  min-width: 0;
  /* The directory gives way first; the file name is what identifies the row. */
  flex: 1 1 auto;
}
.file-diff-dir {
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
}
.file-diff-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-diff-from { max-width: 25%; overflow: hidden; text-overflow: ellipsis; color: var(--text-faint); font-size: var(--text-xs); white-space: nowrap; }
.file-diff-status {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  white-space: nowrap;
}
.file-diff-status--added { color: var(--green); }
.file-diff-status--deleted { color: var(--red); }
.file-diff-binary { padding: 0.7rem; margin: 0; }

/*
 * One grid for the whole file, not one per line.
 *
 * With a grid per row every row sized its own columns, so the two sides of a
 * split view never lined up and each half clipped its own text instead of the
 * file scrolling as one piece. The rows are `display: contents` so their cells
 * join the file's grid, which is what makes a column the same width from the
 * first line to the last.
 *
 * `minmax(max-content, 1fr)` on the text columns is what allows scrolling: the
 * column never shrinks below its longest line, so a long line widens the grid
 * and the body scrolls, rather than the line being cut off in place.
 */
.file-diff-body {
  min-width: 0;
  overflow-x: auto;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: var(--text-ui);
  color: var(--code-text);
  background: var(--code-bg);
  line-height: 1.65;
  display: grid;
  padding-bottom: 0.75rem;
  tab-size: 2;
}
.file-diff-body.is-unified {
  grid-template-columns: min-content min-content minmax(max-content, 1fr);
}
.file-diff-body.is-split {
  grid-template-columns:
    min-content minmax(max-content, 1fr)
    min-content minmax(max-content, 1fr);
}
/* Wrapped mode uses equal text tracks across the whole file. Each pair shares
   one grid row, so a wrap on either side stretches its counterpart too. */
.file-diff-body.is-wrapped.is-unified {
  grid-template-columns: min-content min-content minmax(0, 1fr);
}
.file-diff-body.is-wrapped.is-split {
  grid-template-columns: min-content minmax(0, 1fr) min-content minmax(0, 1fr);
}
.file-diff-body.is-wrapped .diff-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.diff-row,
.diff-split-row {
  display: contents;
}
.diff-gutter {
  padding: 0 0.45rem;
  text-align: right;
  color: var(--code-muted);
  background: transparent;
  user-select: none;
  white-space: nowrap;
}
.diff-text { white-space: pre; padding: 0 0.6rem; font: inherit; }
.diff-marker { display: inline-block; width: 1ch; color: var(--code-muted); }
.diff-row--add .diff-marker { color: var(--syntax-added); }
.diff-row--del .diff-marker { color: var(--syntax-removed); }

/* The tint goes on the cells, since the row itself no longer draws a box. */
.diff-row--add > *,
.diff-half--add { background: var(--diff-added-bg); }
.diff-row--del > *,
.diff-half--del { background: var(--diff-removed-bg); }
.diff-cell--edge { border-right: 1px solid var(--border-color); }

/* A hunk heading is one line across every column. */
.diff-row--hunk > .diff-text,
.diff-split-row--hunk > .diff-text {
  grid-column: 1 / -1;
  background: var(--code-header);
  color: var(--code-muted);
  padding: 0.35rem 0.6rem;
  font-size: var(--text-xs);
}
.diff-row--hunk > .diff-gutter,
.diff-split-row--hunk > .diff-gutter { display: none; }


.pr-nodiff { display: flex; flex-direction: column; gap: 0.6rem; }

/* --- Modern Diff & Review Inspector Enhancements --- */

/* Diagonal hatched background for empty split counterpart */
.diff-half--empty {
  background: repeating-linear-gradient(
    -45deg,
    var(--code-bg),
    var(--code-bg) 4px,
    var(--code-header) 4px,
    var(--code-header) 8px
  );
}

/* File badge icon */
.file-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 0.25rem;
}

/* Diff chips on file headers */
.file-diff-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.15rem;
  font-size: var(--text-2xs);
  font-weight: 500;
  line-height: 1;
}
.file-diff-chip--add {
  color: var(--green);
}
.file-diff-chip--del {
  color: var(--red);
}

/* Gutter comment trigger */
.diff-gutter {
  position: relative;
}
.diff-gutter-add-btn {
  display: inline-flex;
  opacity: 0;
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  font-size: var(--text-2xs);
  font-weight: 700;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.diff-row:hover .diff-gutter-add-btn,
.diff-split-row:hover .diff-gutter-add-btn,
.diff-gutter-add-btn:focus-visible {
  opacity: 1;
}

/* Header & action button group */
.pr-action-button-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.pr-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  border: 0;
  background: transparent;
  cursor: pointer;
}
.pr-icon-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.pr-menu-wrapper {
  position: relative;
}
.pr-action-menu {
  position: fixed;
  min-width: min(15rem, calc(100vw - 1rem));
  padding: 0.3rem;
  z-index: var(--z-menu);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.pr-action-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--text-ui);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.pr-action-item svg { flex: 0 0 1rem; width: 1rem; height: 1rem; color: var(--text-muted); }
.pr-action-item:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.pr-action-item:hover {
  background: var(--bg-hover);
}
.pr-menu-divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 0.25rem 0;
}

/* Header pill & checks count */
.pr-kicker-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pr-checks-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-2xs);
  color: var(--green);
  background: rgba(74, 222, 128, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Code toolbar */
.pr-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.pr-code-toolbar-left,
.pr-code-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  min-width: 0;
}
.pr-view-toggle { display: flex; padding: 0.15rem; border-radius: var(--radius-sm); background: var(--surface-1); }
.pr-view-toggle button, .pr-wrap-toggle {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  background: transparent;
  color: var(--text-faint);
  font-size: var(--text-2xs);
  cursor: pointer;
}
.pr-view-toggle button[aria-pressed="true"], .pr-wrap-toggle[aria-pressed="true"] { color: var(--text); background: var(--bg-active); }
.pr-view-toggle button:hover, .pr-wrap-toggle:hover { color: var(--text); }

/* Accordions in Summary Tab */
.pr-accordion-section {
  border-bottom: 1px solid var(--border-color);
}
.pr-accordion-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 0.4rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-xs);
  cursor: pointer;
  text-align: left;
}
.pr-accordion-header:hover {
  background: var(--bg-hover);
}
.pr-accordion-header h4 {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
}
.pr-accordion-badge {
  margin-left: auto;
  font-size: var(--text-2xs);
}
.pr-accordion-content {
  padding: 0 0.4rem 0.85rem;
}
.pr-detail .body {
  min-width: 0;
  font-size: var(--text-ui);
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}
.pr-detail .body .md-h {
  color: var(--text);
  margin: 0.75rem 0 0.35rem;
  font-size: var(--text-sm);
}
.pr-detail .body > .md-h:first-child { margin-top: 0; }
.pr-detail .body .md-li { margin: 0.2rem 0; }
.pr-detail .md-table { white-space: normal; }
.pr-detail .md-table th, .pr-detail .md-table td { padding: 0.5rem 0.7rem; }
.pr-detail .md-table th:first-child, .pr-detail .md-table td:first-child { padding-left: 0; }
.md-details { margin: 0.65rem 0; border-top: 1px solid var(--border-color); white-space: normal; }
.md-details > summary { padding: 0.6rem 0; font-weight: 500; cursor: pointer; color: var(--text); }
.md-details-body { min-width: 0; padding: 0.1rem 0 0.4rem 0.75rem; white-space: pre-wrap; }
.pr-section-heading { display: flex; align-items: center; gap: 0.5rem; }
.pr-section-heading .pr-accordion-header { width: auto; flex: 1; }
.pr-sort-button { border: 0; background: none; padding: 0.35rem; color: var(--text-faint); font-size: var(--text-2xs); white-space: nowrap; cursor: pointer; }
.pr-sort-button:hover { color: var(--text); }
.pr-comments-list { display: grid; gap: 0.65rem; min-width: 0; }
.pr-comment-card { min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.pr-comment-card > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; list-style: none; padding: 0.6rem 0.7rem; cursor: pointer; font-size: var(--text-2xs); }
.pr-comment-card > summary:hover { background: var(--bg-hover); border-radius: var(--radius-md); }
.pr-comment-card > summary::-webkit-details-marker, .pr-conversation-group > summary::-webkit-details-marker { display: none; }
.pr-comment-card > summary > b { overflow-wrap: anywhere; font-weight: 550; }
.pr-comment-card time, .pr-activity-state { color: var(--text-faint); }
.pr-disclosure-caret { margin-left: auto; flex-shrink: 0; color: var(--text-faint); transform: rotate(-90deg); }
details[open] > summary > .pr-disclosure-caret { transform: none; }
.pr-comment-content { min-width: 0; padding: 0.15rem 0.7rem 0.85rem; }
.pr-conversation-group > summary { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; list-style: none; cursor: pointer; color: var(--text-muted); font-size: var(--text-ui); }
.pr-conversation-group > summary b { font-weight: 500; }
.pr-conversation-group > summary small { display: block; margin-top: 0.2rem; font-size: var(--text-2xs); color: var(--text-faint); }
.pr-conversation-group .pr-comments-list { margin-top: 0.6rem; }

/* Quick comment in Summary Tab */
.pr-quick-comment-box {
  padding: 0.85rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.pr-quick-comment-box textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text);
  padding: 0.5rem;
  font-family: inherit;
  font-size: var(--text-xs);
  resize: vertical;
}
.pr-quick-comment-actions {
  display: flex;
  justify-content: flex-end;
}

/* Floating Review Button */
.pr-floating-review-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: all 0.15s ease;
}
.pr-floating-review-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-faint);
  transform: translateY(-1px);
}
.pr-staged-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-3xs);
  font-weight: 700;
}

/* Floating Review Drawer */
.pr-review-drawer {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 440px;
  max-width: calc(100vw - 2.5rem);
  background: var(--base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(24px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pr-review-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-ui);
}
.pr-review-drawer-body {
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pr-review-empty {
  margin: 0;
  font-size: var(--text-xs);
}
.pr-staged-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 120px;
  overflow-y: auto;
}
.pr-staged-comment-item {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  font-size: var(--text-2xs);
}
.pr-staged-comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-faint);
  margin-bottom: 0.15rem;
}
.pr-review-textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text);
  padding: 0.5rem;
  font-family: inherit;
  font-size: var(--text-xs);
  resize: vertical;
  min-height: 4rem;
}
.pr-review-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border-color);
  background: var(--surface-1);
}
.pr-btn-approve {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}
.pr-btn-approve:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}
.pr-btn-request-changes {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
}
.pr-btn-request-changes:hover {
  background: color-mix(in srgb, var(--red) 20%, transparent);
}

/* ── Pull request: people and labels ─────────────────────────────────────
 *
 * Avatars arrive from the main process as data URIs, because the renderer's
 * CSP allows images only from itself and `data:`. When one is missing the
 * initials stand in, so a row is never a blank circle.
 */
.pr-avatar {
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-active);
}
.pr-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}
.pr-actor {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.pr-actor-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pr-byline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pr-pill--actor { padding-left: 0.25rem; }

/* The dot carries the repository's colour; the pill stays legible in either
   theme, whatever colour that turns out to be. */
.pr-label { display: inline-flex; align-items: center; gap: 0.35rem; }
.pr-label-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
  /* A pale label on a pale ground still reads as a dot with this. */
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.25);
}

/* ── Markdown: quotes, alerts and rules ──────────────────────────────────
 *
 * A GitHub body leans on all three. Without them a quoted paragraph arrived
 * with a literal ">" on every line and "[!NOTE]" read as prose.
 */
.md-quote {
  margin: 0.4rem 0;
  padding: 0.1rem 0 0.1rem 0.75rem;
  border-left: 3px solid var(--border-color);
  color: var(--text-muted);
}
.md-alert {
  margin: 0.5rem 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: var(--control-radius, var(--radius-sm));
  background: var(--inline-code-bg);
}
.md-alert-title {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.95em;
}
.md-alert--note { --alert-tone: var(--markdown-note); }
.md-alert--tip { --alert-tone: var(--markdown-tip); }
.md-alert--important { --alert-tone: var(--markdown-important); }
.md-alert--warning { --alert-tone: var(--markdown-warning); }
.md-alert--caution { --alert-tone: var(--markdown-caution); }
.md-alert { border-left-color: var(--alert-tone); }
.md-alert-title { color: var(--alert-tone); }
.md-hr {
  margin: 0.7rem 0;
  border: 0;
  border-top: 1px solid var(--border-color);
}

/* An image attachment previews itself; the remove button sits over it, as it
   does in the file chips beside it. */
.composer-attachment--image {
  padding: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}
.composer-attachment-thumb {
  display: block;
  height: 4.5rem;
  width: auto;
  max-width: 9rem;
  object-fit: cover;
}
.composer-attachment--image > button {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 0;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  cursor: pointer;
}
.composer-attachment--image > button:hover { background: rgb(0 0 0 / 0.75); }

/* The qualifier is secondary to the count it corrects. */
.changed-files-scope { color: var(--text-faint); font-weight: 400; }
.conversation-host { display: flex; flex: 1; min-width: 0; min-height: 0; }
.conversation-host[hidden] { display: none; }
.diff-pager, .diff-list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  font-size: var(--text-ui);
}
.diff-list-controls { justify-content: space-between; }
.diff-pager input { width: 4rem; padding: 0.25rem; font: inherit; }

/* Secondary detail stays one disclosure away from the task. */
.capability-details { color: var(--text-muted); font-size: var(--text-xs); margin: .55rem 0; min-width: 0; }
.capability-details summary { cursor: pointer; padding: .35rem .25rem; }
.capability-details dl { margin: .4rem 0; padding: .5rem .75rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.capability-details dl > div + div { border-top: 1px solid var(--border-color); margin-top: .5rem; padding-top: .5rem; }
.capability-details dt { display: flex; justify-content: space-between; gap: .75rem; color: var(--text); font-weight: 500; }
.capability-details dt span { font-weight: 400; color: var(--text-muted); }
.capability-details dd { margin: .3rem 0 0; line-height: 1.5; }
.capability-hint { font-size: var(--text-xs); color: var(--text-muted); margin: .25rem .5rem .6rem; }
.menu-select-trigger[aria-disabled="true"] { color: var(--text-faint); cursor: help; }
fieldset.harness-options { padding: 0; margin: 0; border: 0; min-width: 0; }
fieldset.harness-options:disabled { opacity: .7; }
.run-activity-state { font-size: var(--text-xs); color: var(--text-muted); padding: .15rem .5rem; border: 1px solid var(--border-color); border-radius: var(--radius-xl); white-space: nowrap; }
.run-activity-state[data-state="failed"], .run-activity-state[data-state="blocked"] { color: var(--red); }
.run-summary-lead { flex-wrap: wrap; }
.performance-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.performance-diagnostics { overflow-x: auto; }
.performance-diagnostics table { width: 100%; font-size: var(--text-ui); border-collapse: collapse; }
.performance-diagnostics th, .performance-diagnostics td { text-align: right; padding: .5rem; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.performance-diagnostics th:first-child, .performance-diagnostics td:first-child { text-align: left; }
.performance-diagnostics details { margin-top: .75rem; font-size: var(--text-ui); color: var(--text-muted); }
.pet-setting-control .actions { margin: 0; }
.composer-control-divider { width: 1px; height: 1rem; background: var(--border-color); margin: 0 .3rem; }
.composer-branch { margin-left: auto; }
.composer-controls .menu-select-trigger[aria-label="Agent and model"] { color: var(--text); }
.composer-controls .menu-select-trigger[aria-label="Agent and model"] .agent-glyph { opacity: 1; }
.composer-glass::after { box-shadow: none; }
.composer-glass:focus-within::after { border-color: var(--border-strong); }
.capability-details--compact { position: relative; margin: 0; flex-shrink: 0; }
.capability-details--compact > summary { display: flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; padding: 0; font-size: .9375rem; list-style: none; border-radius: var(--radius-sm); }
.capability-details--compact > summary::-webkit-details-marker { display: none; }
.capability-details--compact > summary:hover, .capability-details--compact[open] > summary { color: var(--text); background: var(--bg-hover); }
.capability-details--compact > .capability-details-body { position: absolute; z-index: 20; bottom: calc(100% + .5rem); right: 0; width: min(25rem, calc(100vw - 4rem)); max-height: min(26rem, 60vh); overflow-y: auto; background: var(--surface-0); box-shadow: var(--shadow); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: .5rem .75rem; }
.capability-details--compact > .capability-details-body > dl { border: 0; padding: 0; }
.browser-capability { margin: 0; padding: .15rem .5rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.browser-capability p { margin: .25rem; line-height: 1.5; }

/* Saved-file previews float above the thread without resizing it. */
.saved-diff-preview {
  position: fixed;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  background: var(--code-bg);
  color: var(--code-text);
  box-shadow: var(--shadow);
  font-size: var(--text-ui);
}
.saved-diff-preview-head,
.saved-diff-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .625rem .875rem;
  flex-shrink: 0;
}
.saved-diff-preview-head {
  border-bottom: 1px solid var(--code-border);
  background: var(--code-header);
}
.saved-diff-preview-path { display: flex; flex: 1; min-width: 0; direction: ltr; }
.saved-diff-preview-dir,
.saved-diff-preview-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Give up directory space first without using RTL, which moves the slash. */
.saved-diff-preview-dir { flex-shrink: 10000; color: var(--code-muted); }
.saved-diff-preview-head .diffstat { flex-shrink: 0; }
.saved-diff-preview-code {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  font-family: var(--mono);
  font-size: var(--text-ui);
  line-height: 1.65;
  tab-size: 2;
}
.saved-diff-preview-code > p {
  padding: .75rem;
  margin: 0;
  font-family: var(--font);
  color: var(--code-muted);
}
/* A shared intrinsic grid paints short lines to the longest line's edge.
   Independent max-content rows leave ragged tint bands when scrolled. */
.saved-diff-preview-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: max-content;
  min-width: 100%;
}
.saved-diff-preview-hunk {
  grid-column: 1 / -1;
  padding: .25rem .75rem;
  color: var(--code-muted);
  background: var(--code-header);
  white-space: pre;
  font-size: var(--text-xs);
}
.saved-diff-preview-hunk > span { display: inline-block; position: sticky; left: .75rem; }
.saved-diff-preview-line { display: contents; }
.saved-diff-preview-line > * { background: var(--code-bg); }
.saved-diff-preview-line.add > * { background: var(--diff-added-bg); }
.saved-diff-preview-line.del > * { background: var(--diff-removed-bg); }
.saved-diff-preview-line code {
  font: inherit;
  white-space: pre;
  padding: 0 .75rem 0 .5rem;
  border: 0;
  border-radius: 0;
}
.preview-line-gutter {
  position: sticky;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: 0 .5rem;
  border-right: 1px solid var(--code-border);
  user-select: none;
}
.preview-line-number {
  flex: 0 0 var(--preview-line-digits);
  width: var(--preview-line-digits);
  text-align: right;
  color: var(--code-muted);
}
.preview-line-sign { flex: 0 0 1ch; color: var(--code-muted); }
.saved-diff-preview-line.add .preview-line-sign { color: var(--syntax-added); }
.saved-diff-preview-line.del .preview-line-sign { color: var(--syntax-removed); }
.saved-diff-preview-footer {
  flex-wrap: wrap;
  border-top: 1px solid var(--code-border);
  color: var(--code-muted);
  font-size: var(--text-xs);
}
.saved-diff-preview-footer .ghost {
  margin-left: auto;
  padding: .25rem .5rem;
  color: var(--code-text);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.saved-diff-preview-code::-webkit-scrollbar-corner,
.file-diff-body::-webkit-scrollbar-corner,
.diff-view::-webkit-scrollbar-corner { background: var(--code-bg); }
.saved-diff-preview-code::-webkit-scrollbar-thumb,
.file-diff-body::-webkit-scrollbar-thumb,
.diff-view::-webkit-scrollbar-thumb { background: var(--code-border); }
.saved-diff-preview :focus-visible, .changed-file-row:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.changed-file-row[aria-expanded="true"] { background: var(--bg-hover); }
.run-summary-body[hidden] { display: none; }
.run-summary-body > .turn-verification, .run-summary-body > .run-event-log { border: 0; border-top: 1px solid var(--border-color); border-radius: 0; margin: .5rem 0 0; background: transparent; }
.run-summary-body > .turn-verification > summary, .run-summary-body > .run-event-log > summary { padding: .625rem 0; }
.run-summary-body > .run-event-log:first-child { border-top: 0; margin-top: 0; }
.run-event-log .event-log { max-height: 18rem; overflow: auto; overscroll-behavior: contain; padding: .25rem 0; }
.run-event-log .event-log > div { display: grid; grid-template-columns: 5rem 6.5rem minmax(0, 1fr); }
.run-event-log .event-kind { min-width: 0; overflow-wrap: anywhere; }
.run-event-log .run-log-pages { padding: .5rem 0 0; }
.run-event-log .run-log-pages button { background: transparent; color: var(--text-muted); border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: var(--text-xs); padding: .25rem .5rem; }
.reported-usage { margin: 0 0 .5rem; font-size: var(--text-xs); color: var(--text-muted); }
.reported-usage > summary { cursor: pointer; padding: .25rem 0; }
.reported-usage-preview { margin-left: .75rem; font-variant-numeric: tabular-nums; color: var(--text-faint); }
.reported-usage dl { display: grid; gap: .375rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); margin: .5rem 0; }
.reported-usage dt { font-size: var(--text-2xs); color: var(--text-faint); }
.reported-usage dd { margin: .125rem 0 0; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.reported-usage .faint { font-size: var(--text-2xs); margin: .375rem 0 .5rem; }
@media (max-width: 600px) {
  .run-event-log .event-log > div { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .run-event-log .event-text { grid-column: 1 / -1; }
  .reported-usage-preview { display: block; margin-left: 1rem; }
}
.composer-glass .gateway-recovery { padding: .375rem .5rem; margin: .25rem 0 .5rem; border: 0; border-radius: var(--radius-sm); font-size: var(--text-xs); background: var(--surface-1); }
.gateway-recovery > span { min-width: 0; }
.gateway-recovery-error { display: block; color: var(--red); overflow-wrap: anywhere; }
.gateway-recovery button { flex-shrink: 0; }
.agent-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-color);
}
.agent-config-row > span { min-width: 0; overflow-wrap: anywhere; }
.agent-config-row small { display: block; color: var(--text-muted); font-size: var(--text-xs); }
.agent-config-row select { min-width: 0; max-width: 52%; font-size: var(--text-ui); }
.background-browser { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border-color); font-size: var(--text-ui); flex-shrink: 0; max-height: 65%; overflow-y: auto; }
.background-browser > summary { cursor: pointer; color: var(--text-muted); }
.background-browser p { margin: 0.65rem 0; line-height: 1.5; }
.background-browser-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.background-browser-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.background-browser-image { display: block; width: 100%; max-height: 22rem; object-fit: contain; background: #111; border-radius: var(--radius-sm); }
/* Browser access belongs to the workspace, not to a chat message. */
.remote-session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-ui);
  flex-shrink: 0;
}
.remote-session-banner span { min-width: 0; overflow-wrap: anywhere; }
.archived-conversations { margin-bottom: 1.5rem; }
.archived-conversations summary { cursor: pointer; padding-block: .5rem; }
.archived-conversations .row { padding-block: .375rem; gap: 1rem; }

/* ───────────── Simulator surface ───────────── */
.simulator-pane { background: var(--bg); }
.simulator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.simulator-picker { position: relative; min-width: 0; }
.simulator-picker-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.simulator-picker-trigger:hover:not(:disabled) { background: var(--bg-hover); }
.simulator-picker-trigger:disabled { cursor: default; }
.simulator-picker-copy { display: grid; min-width: 0; line-height: 1.2; }
.simulator-picker-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9375rem; font-weight: 500; }
.simulator-picker-copy small { color: var(--text-muted); font-size: var(--text-xs); }
.simulator-picker-menu { left: 0; right: auto; min-width: 17rem; max-width: min(24rem, calc(100cqw - 1rem)); max-height: 20rem; overflow: auto; }
.simulator-device-row { gap: 0.35rem; }
.simulator-device-row .preview-menu-item { display: grid; gap: 0.1rem; }
.simulator-device-row .preview-menu-item.active { background: var(--bg-active); }
.simulator-device-name { font-size: var(--text-ui); }
.simulator-device-row small { font-size: var(--text-2xs); }

/*
 * The stage scrolls when the device is zoomed past the pane, and centers it
 * when it fits (auto margins center without clipping an overflowing side).
 * The frame and screen sizes come from the device's own shape, set inline.
 */
.simulator-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--text) 4%, transparent), transparent 70%), var(--bg);
}
.simulator-stage[data-zoom="fit"] { overflow: hidden; }
.simulator-stage-inner { display: flex; box-sizing: border-box; min-width: 100%; min-height: 100%; width: max-content; }
.simulator-bezel {
  position: relative;
  flex: none;
  margin: auto;
  box-sizing: border-box;
  /* A physical device frame: the same in light and dark themes. */
  background: #0b0b0c;
  box-shadow:
    0 0 0 1.5px #a5a7ad,
    0 0 0 2.5px #1b1c1e,
    inset 0 0 0 1px #2a2b2e,
    0 1.75rem 3.5rem rgba(0, 0, 0, 0.45);
}
.simulator-keys { position: absolute; inset: 0; pointer-events: none; }
.simulator-key {
  position: absolute;
  display: block;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c7e85, #4a4b50);
}
.simulator-key.action { left: -6.5px; top: 17%; height: 4.5%; }
.simulator-key.up { left: -6.5px; top: 25%; height: 7.5%; }
.simulator-key.down { left: -6.5px; top: 34.5%; height: 7.5%; }
.simulator-key.side { right: -6.5px; top: 28%; height: 12%; background: linear-gradient(90deg, #4a4b50, #7c7e85); }
.simulator-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.simulator-screen:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.simulator-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}
.simulator-screen img.touchable { cursor: pointer; touch-action: none; }
.simulator-waiting { position: absolute; inset: 0; display: grid; place-items: center; }
.simulator-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.8);
  animation: previewSpin 0.9s linear infinite;
}
.simulator-annotate-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

/* Floats over the stage, like the device's own controls rather than a pane footer. */
.simulator-toolbar {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-raised, var(--shadow));
  max-width: calc(100% - 1.5rem);
}
.simulator-toolbar .preview-chrome-btn { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-full); }
.simulator-toolbar .preview-chrome-btn.recording { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.simulator-toolbar-sep { width: 1px; height: 1.25rem; margin: 0 0.15rem; background: var(--border-color); flex-shrink: 0; }
.simulator-annotate-add {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2rem;
  padding: 0 0.8rem;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: var(--text-ui);
  font-weight: 600;
  cursor: pointer;
}
.simulator-annotate-add:disabled { opacity: 0.6; cursor: default; }
/* Notices and tool rows sit at the top of the stage, clear of the device and its controls. */
.simulator-dock {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 5;
  display: grid;
  gap: 0.4rem;
  pointer-events: none;
}
.simulator-dock > * { pointer-events: auto; }
.simulator-dock .simulator-banner, .simulator-dock .simulator-tool-row, .simulator-dock .simulator-apps { margin: 0; box-shadow: var(--shadow); }
.simulator-menubar { display: flex; align-items: center; gap: 0.1rem; margin-left: auto; min-width: 0; }
.simulator-menu { position: relative; }
.simulator-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-ui);
  cursor: pointer;
}
.simulator-menu-trigger:hover:not(:disabled), .simulator-menu-trigger.active { background: var(--bg-hover); color: var(--text); }
.simulator-menu-trigger:disabled { opacity: 0.5; cursor: default; }
.simulator-menu-list { left: 0; right: auto; min-width: 14rem; }
.simulator-menu-list .preview-menu-sep { height: 1px; margin: 0.2rem 0.3rem; background: var(--border-color); }
.simulator-zoom { display: flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }
.simulator-zoom .preview-chrome-btn { width: 2rem; height: 2rem; border-radius: var(--control-radius); }

.simulator-banner {
  margin: 0.4rem 0.75rem 0;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-md);
  background: var(--surface-0);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
  flex-shrink: 0;
  overflow-wrap: anywhere;
}
.simulator-banner.error { color: var(--red); }
.simulator-banner.agent { color: var(--text); background: color-mix(in srgb, var(--accent) 14%, var(--bg-elevated, var(--bg))); }
.simulator-tool-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0.4rem 0.75rem 0;
  flex-shrink: 0;
}
.simulator-tool-row .preview-address-input { height: 1.85rem; }
.simulator-apps { margin: 0.4rem 0.75rem 0; max-height: 14rem; overflow: auto; flex-shrink: 0; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.3rem; background: var(--surface-0); }
.simulator-app-list .preview-menu-item { display: grid; gap: 0.1rem; }
.simulator-apps p { margin: 0.4rem 0.5rem; font-size: var(--text-xs); }

.simulator-empty,
.simulator-offline {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.45rem;
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1.5rem;
}
.simulator-empty h3, .simulator-offline h3 { margin: 0.4rem 0 0; font-size: 0.9375rem; color: var(--text); }
.simulator-empty p, .simulator-offline p { margin: 0; max-width: 28rem; font-size: var(--text-ui); line-height: 1.5; }
.simulator-offline .send { margin-top: 0.5rem; }

/* Attach card inside the phone screen, and the Tools drawer. */
.simulator-attach {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 12% 1.2rem 1.2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  overflow: auto;
}
.simulator-attach h3 { margin: 0; font-size: 1.1rem; line-height: 1.3; color: #fff; }
.simulator-attach p { margin: 0; font-size: var(--text-ui); line-height: 1.45; max-width: 26rem; }
.simulator-attach-checks { list-style: none; margin: 0.4rem 0 0; padding: 0; width: 100%; max-width: 26rem; display: grid; gap: 0.35rem; }
.simulator-attach-checks li { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.07); font-size: var(--text-ui); text-align: left; }
.simulator-attach-checks li[data-ok="true"] svg { color: #34c759; }
.simulator-attach-checks li[data-ok="false"] svg { color: #ff453a; }
.simulator-attach-foot { margin-top: auto; width: 100%; max-width: 26rem; display: grid; gap: 0.8rem; }
.simulator-attach-foot small { font-size: var(--text-2xs); color: rgba(255, 255, 255, 0.4); line-height: 1.4; }
.simulator-attach-actions { position: relative; display: flex; }
.simulator-attach-button, .simulator-attach-more {
  height: 2.6rem;
  border: 0;
  background: #fff;
  color: #111;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.simulator-attach-button { flex: 1; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.simulator-attach-more { width: 2.6rem; border-left: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0 var(--radius-md) var(--radius-md) 0; display: grid; place-items: center; }
.simulator-attach-button:disabled, .simulator-attach-more:disabled { opacity: 0.55; cursor: default; }
.simulator-stage { position: relative; }
.simulator-attach-menu {
  position: absolute;
  top: 1rem;
  right: 1rem;
  bottom: auto;
  left: auto;
  width: min(18rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  z-index: 30;
}
.simulator-attach-menu .preview-menu-item { display: grid; gap: 0.1rem; }
.simulator-attach-menu-head { padding: 0.45rem 0.65rem 0.2rem; font-size: var(--text-2xs); color: var(--text-faint); }
.simulator-attach-menu-head + .simulator-attach-menu-head { display: none; }

.simulator-tools {
  margin: 0.4rem 0.75rem 0;
  max-height: 20rem;
  overflow: auto;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  font-size: var(--text-ui);
  display: grid;
  gap: 0.75rem;
  flex-shrink: 0;
}
.simulator-tools section { display: grid; gap: 0.4rem; }
.simulator-tools h5 { margin: 0; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--text-faint); }
.simulator-tools p { margin: 0; font-size: var(--text-xs); line-height: 1.4; }
.simulator-tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.simulator-tools-row .preview-address-input { flex: 1 1 7rem; height: 1.75rem; }
.simulator-tools-stack { display: grid; gap: 0.35rem; }
.simulator-tools-stack .preview-address-input { height: 1.75rem; }
.simulator-tools-stack .preview-viewport, .simulator-tools select.preview-viewport { max-width: none; }
.simulator-tools-value { min-width: 6rem; text-align: center; font-size: var(--text-xs); color: var(--text-muted); }
.simulator-tools-check { display: flex; align-items: center; gap: 0.4rem; font-size: var(--text-xs); }
.simulator-tools .chip[aria-pressed="true"] { background: var(--bg-hover); color: var(--text); border-color: var(--text-muted); }

/* Sidebar: history buttons beside the wordmark, a per-project new-conversation control, worktree glyph. */
.sidebar-history { margin-left: auto; display: flex; gap: 0.1rem; }
.sidebar-history .icon-btn:disabled { opacity: 0.35; }
.project-row .project-new { margin-right: 0.1rem; }
.thread-worktree { display: inline-flex; color: var(--text-faint); }

/* Transcript detail: live clock on a tool group, shell prompt, titlebar diff counts. */
.inline-activity-elapsed { font-variant-numeric: tabular-nums; color: var(--text-faint); font-size: var(--text-2xs); }
.activity-tool-text pre[data-shell] .shell-prompt { color: var(--text-faint); user-select: none; }
.git-diffstat { margin-left: 0.3rem; font-variant-numeric: tabular-nums; font-size: var(--text-2xs); }
.git-diffstat .added { color: var(--green); }
.git-diffstat .removed { color: var(--red); }

/* Queued follow-ups above the composer controls. */
.queued-prompts { margin: 0 0.35rem 0.5rem; padding: 0.5rem 0.65rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-0); font-size: var(--text-ui); }
.queued-prompts-head { display: flex; gap: 0.5rem; align-items: baseline; margin-bottom: 0.35rem; }
.queued-prompts-head strong { font-size: var(--text-xs); }
.queued-prompts-head .faint { font-size: var(--text-2xs); }
.queued-prompts-blocked { margin: 0 0 0.35rem; color: var(--text-muted); font-size: var(--text-2xs); }
.queued-prompts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.queued-prompt { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.queued-prompt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queued-prompt-meta { color: var(--text-faint); font-size: var(--text-2xs); }
.queued-prompt-actions { display: flex; gap: 0.1rem; align-items: center; flex-shrink: 0; }
.queued-prompt-actions .icon-btn:disabled { opacity: 0.35; }

/* Find in conversation. */
.thread-find { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border-bottom: 1px solid var(--border-color); background: var(--surface-0); font-size: var(--text-ui); flex-shrink: 0; }
.thread-find input { flex: 1; min-width: 0; height: 1.75rem; padding: 0 0.5rem; border: 1px solid var(--border-color); border-radius: var(--control-radius); background: var(--bg); color: var(--text); font-size: var(--text-ui); }
.thread-find-count { color: var(--text-muted); font-size: var(--text-xs); min-width: 5rem; }
.turn-focus { outline: 2px solid color-mix(in srgb, var(--text) 25%, transparent); outline-offset: 2px; border-radius: var(--radius-md); }

/* Usage limits and compaction. */
.thread-resume { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; padding: 0.45rem 0.7rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-0); font-size: var(--text-ui); color: var(--text-muted); }
.thread-resume span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-limit .chip { flex-shrink: 0; }
.context-card-hint { margin: 0.5rem 0 0; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }
.context-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.6rem; font-size: var(--text-xs); }

/* Titlebar icon bar: one icon per panel surface, the showing one pressed. */
.surface-bar { display: flex; align-items: center; gap: 0.25rem; }
.surface-bar .icon-btn { width: var(--workspace-titlebar-control-size); height: var(--workspace-titlebar-control-size); }
.surface-bar .icon-btn.active { background: var(--bg-active); color: var(--text); }
.surface-bar-details { position: relative; display: flex; }

/* The panel's one header row: what the surface is, then the panel's own controls. */
.inspector-head { padding-left: 0.9rem; }
.inspector-title { font-size: var(--text-ui); color: var(--text-muted); }
.inspector-title > span:first-child { color: var(--text); font-weight: 500; }
.inspector-head .panel-chrome-actions { margin-left: auto; }

/* Conversation details, from the icon bar's list icon. */
.session-details { width: min(22rem, calc(100vw - 2rem)); padding: 0.25rem 0; }
.session-details-body { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.session-details-body section { padding: 0.65rem 0.9rem; border-top: 1px solid var(--border-color); }
.session-details-body section:first-child { border-top: 0; }
.session-details-body h4 { margin: 0 0 0.45rem; font-size: var(--text-ui); font-weight: 500; color: var(--text); }
.session-details-line { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.session-details-line h4 { margin: 0; }
.session-details-row { display: flex; align-items: center; gap: 0.55rem; margin: 0.3rem 0 0; min-width: 0; font-size: var(--text-ui); color: var(--text); }
.session-details-row svg { flex-shrink: 0; color: var(--text-muted); }
.session-details-row.faint { color: var(--text-muted); }
/* A long folder path shrinks to an ellipsis instead of widening the popover. */
.session-details-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-details { overflow-x: hidden; }
.session-details-meter { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--text-ui); color: var(--text-muted); }
.session-details-bar { position: relative; display: inline-block; width: 2.5rem; height: 0.375rem; border-radius: var(--radius-full); background: var(--bg-active); overflow: hidden; }
.session-details-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--text-muted); }
.session-details-changes { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--text-ui); }
.session-details-changes svg { color: var(--text-muted); }
.session-details-changes .added { color: var(--green); }
.session-details-changes .removed { color: var(--red); }
.session-details-changes .chip { margin-left: 0.25rem; padding: 0.2rem 0.6rem; }
/* A surface's own controls in the panel header: left-aligned, and their menus may drop below the row. */
.inspector-head-slot { display: flex; align-items: center; min-width: 0; flex: 1; }
.inspector-head-slot[hidden], .inspector-title[hidden] { display: none; }
.inspector-head-slot .simulator-menubar { margin-left: -0.55rem; }
/* Before the simulator has its menus (still loading, or not available here), the row still names the surface. */
.inspector-head-slot:empty::before { content: "Simulator"; color: var(--text); font-weight: 500; }


/*
 * Overlays enter the same way everywhere: a short fade up from slightly
 * smaller, and their backdrops fade. The global reduced-motion rule in the
 * tokens shortens both to nothing for people who ask for less motion.
 */
@keyframes overlay-in {
  from { opacity: 0; transform: scale(var(--enter-scale)); }
}
@keyframes fadeIn {
  from { opacity: 0; }
}
.dialog,
.palette,
.menu-select-pop,
.action-menu,
.topbar-dropdown-menu,
.agent-model-picker,
.composer-tools-popover,
.agent-command-popover,
.about-modal-card {
  animation: overlay-in var(--motion-overlay) var(--ease-in-out);
}
.palette-backdrop,
.about-modal-overlay {
  animation: fadeIn var(--motion-overlay) var(--ease-in-out);
}


/*
 * Menus: one row and one panel, whichever component opens them. Rows are a
 * small control's height with a small corner; panels share the popover
 * corner, border and shadow through the shared surface rule at the top of
 * this file. These row rules sit last so they win at equal specificity.
 */
.menu-select-pop button,
.action-menu button,
.preview-menu-item,
.pr-action-item,
.topbar-dropdown-menu button,
.simulator-menu-list [role="menuitem"] {
  min-height: var(--control-h-sm);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-ui);
}

/* Dialogs end on a footer band, so the actions read as a separate step from the question. */
.dialog .actions {
  margin: 1.25rem -1.5rem -1.5rem;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--surface-sunken);
  border-radius: 0 0 var(--dialog-radius) var(--dialog-radius);
}

/* The app's one tooltip (TooltipLayer). */
.app-tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 20rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: var(--text-xs);
  line-height: 1.35;
  box-shadow: var(--shadow-raised);
  pointer-events: none;
  animation: overlay-in var(--motion-fast) var(--ease-in-out);
}
.app-tooltip[data-placement="above"] { transform: translateY(-100%); animation-name: fadeIn; }
.app-tooltip kbd {
  font: inherit;
  font-size: var(--text-2xs);
  color: var(--text-muted);
  padding: 0 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
}

.error-details { margin: 0.5rem 0; }
.error-details summary { cursor: pointer; color: var(--text-muted); font-size: var(--text-ui); }
.error-details pre { max-height: 12rem; overflow: auto; margin-top: 0.5rem; padding: 0.5rem; background: var(--surface-sunken); border-radius: var(--radius-sm); font-size: var(--text-2xs); }

/* Row actions in the changed-files list wait for the row: shown on hover or
   when focus is inside, so a long list reads as files, not as buttons. */
.change-row-actions { display: inline-flex; gap: 0.15rem; flex-shrink: 0; opacity: 0; transition: opacity var(--motion-fast) var(--ease-in-out); }
.change-row:hover .change-row-actions,
.change-row:focus-within .change-row-actions { opacity: 1; }
.change-row-discard:hover { color: var(--red); }
@media (hover: none) { .change-row-actions { opacity: 1; } }

/* The conversation name in the titlebar opens its actions. */
.thread-title-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  height: var(--control-h-sm);
  padding: 0 0.4rem;
  margin-left: -0.4rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: default;
  -webkit-app-region: no-drag;
}
.thread-title-trigger svg { flex-shrink: 0; color: var(--text-faint); }
.thread-title-trigger:hover,
.thread-title-trigger[aria-expanded="true"] { background: var(--bg-hover); }
.thread-title-trigger:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.thread-title-edit {
  min-width: 12rem;
  height: var(--control-h-sm);
  padding: 0 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg, transparent);
  color: var(--text);
  font: inherit;
  -webkit-app-region: no-drag;
}
.thread-title-edit:focus { outline: var(--focus-ring); outline-offset: 0; }

/* Background tasks in the conversation details: one row per running thing. */
.background-task { border-radius: var(--radius-md); }
.background-task[data-open] { background: color-mix(in srgb, var(--text) 4%, transparent); }
.background-task-row { display: flex; align-items: center; gap: 0.25rem; }
.background-task-toggle {
  display: flex; align-items: center; gap: 0.45rem; flex: 1; min-width: 0;
  height: var(--control-h-md); padding: 0 0.4rem; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--text); font: inherit; font-size: var(--text-ui); text-align: left;
}
.background-task-toggle:hover { background: var(--bg-hover); }
.background-task-toggle:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.background-task-toggle > svg:first-child { flex-shrink: 0; color: var(--text-faint); transition: transform var(--motion-fast) var(--ease-in-out); }
.background-task-toggle[aria-expanded="true"] > svg:first-child { transform: rotate(90deg); }
.background-task-toggle > svg { flex-shrink: 0; color: var(--text-muted); }
.background-task-toggle .truncate { flex: 1; min-width: 0; }
.background-task-time { flex-shrink: 0; color: var(--text-faint); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.background-task-output {
  margin: 0; padding: 0.35rem 0.6rem 0.6rem 1.9rem; max-height: 12rem; overflow: auto;
  font-family: var(--mono); font-size: var(--text-xs); line-height: 1.5; color: var(--text-muted);
  white-space: pre-wrap; word-break: break-word;
}

/* A popover that takes focus itself (nothing focusable inside) is not a control; no ring around the whole panel. */
.header-popover:focus,
.header-popover:focus-visible { outline: none; }

/* ⌘/ — every shortcut on one sheet. */
.shortcuts-sheet { width: min(34rem, calc(100vw - 2rem)); max-height: min(40rem, calc(100vh - 6rem)); display: flex; flex-direction: column; }
.shortcuts-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.shortcuts-sheet-head h3 { margin: 0; }
.shortcuts-list:focus { outline: none; }
.shortcuts-list { margin: 0.75rem 0 0; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.5rem; }
.shortcuts-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: var(--control-h-md); border-bottom: 1px solid var(--border-color); }
.shortcuts-row dt { font-size: var(--text-ui); color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shortcuts-row dd { margin: 0; display: inline-flex; gap: 0.2rem; flex-shrink: 0; }
.shortcuts-row kbd { min-width: 1.35rem; padding: 0 0.3rem; border: 1px solid var(--border-color); border-radius: var(--radius-xs); background: color-mix(in srgb, var(--text) 5%, transparent); font: inherit; font-size: var(--text-xs); text-align: center; color: var(--text-muted); }
.shortcuts-sheet-foot { display: flex; justify-content: flex-end; margin-top: 0.75rem; }
@media (max-width: 40rem) { .shortcuts-list { grid-template-columns: 1fr; } }

/* Simulator setup: numbered steps that become ticks as the device list catches up. */
.simulator-setup-steps { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.6rem; width: min(26rem, 100%); text-align: left; }
.simulator-setup-steps li { display: flex; gap: 0.6rem; align-items: flex-start; }
.simulator-setup-steps li > div { min-width: 0; display: grid; gap: 0.3rem; }
.simulator-setup-steps b { font-size: var(--text-ui); font-weight: var(--weight-medium); color: var(--text); }
.simulator-setup-steps li[data-state="done"] b { color: var(--text-muted); }
.simulator-setup-steps li[data-state="todo"] b { color: var(--text-faint); }
.simulator-setup-steps p { margin: 0; text-align: left; }
.simulator-setup-mark { display: grid; place-items: center; flex-shrink: 0; width: 1.25rem; height: 1.25rem; border-radius: var(--radius-full); border: 1px solid var(--border-color); font-size: var(--text-2xs); color: var(--text-muted); }
.simulator-setup-steps li[data-state="current"] .simulator-setup-mark { border-color: var(--text-muted); color: var(--text); }
.simulator-setup-steps li[data-state="done"] .simulator-setup-mark { background: var(--green); border-color: var(--green); color: var(--bg); }
.simulator-setup-command { display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; padding: 0.15rem 0.2rem 0.15rem 0.5rem; border-radius: var(--radius-sm); background: var(--surface-sunken); }
.simulator-setup-command code { font-family: var(--mono); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Project › Instructions: one row per file, its length beside it. */
.project-instruction-row { display: flex; align-items: center; gap: 0.75rem; min-height: var(--control-h-lg); }
.project-instruction-row .inline-icon { flex: 1; min-width: 0; }
.project-instruction-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-instruction-lines { flex-shrink: 0; font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.project-instruction-lines.over { color: var(--yellow); }

.settings-title { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold, 600); letter-spacing: -0.01em; color: var(--text); }

.panel-launcher-hint { margin: 0 0 0.75rem; color: var(--text-muted); font-size: var(--text-ui); }
.thread-agents-route { margin: 0 0 0.5rem; }

/* Changed-file rows: the status letter sits in its own fixed column, so it lines up row to row. */
.change-row .list-item > .truncate { flex: 1; min-width: 0; }
.change-row .list-item > .meta { flex: 0 0 1.25rem; margin-left: 0; text-align: center; font-family: var(--mono); }

/* The conversation's agent, as its mark, after the time. */
.thread-agent { display: inline-grid; place-items: center; flex-shrink: 0; width: 0.875rem; height: 0.875rem; color: var(--text-faint); }
.thread-row.active .thread-agent { color: var(--text-muted); }

/* Narrow screens (a paired phone, a tiny window): the sidebar is a drawer over
   the conversation, not a column that squeezes it to a few characters. */
.sidebar-scrim { display: none; }
@media (max-width: 640px) {
  .app .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: var(--z-dialog);
    width: min(85vw, 20rem);
    min-width: 0;
    max-width: none;
    box-shadow: var(--shadow);
  }
  .app.sidebar-collapsed .sidebar { width: 0; box-shadow: none; }
  .sidebar-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: calc(var(--z-dialog) - 1);
    border: 0;
    padding: 0;
    background: color-mix(in srgb, var(--bg) 64%, transparent);
  }
}

/* In a read-only viewer the reason is the whole notice: let it wrap instead of clamping. */
.composer-preflight.read-only > span { display: block; -webkit-line-clamp: unset; overflow: visible; }

/* Settings sections: icon then label, under small group headings. */
.settings-nav > button:not(.settings-result) { justify-content: flex-start; gap: 0.55rem; }
.settings-nav > button:not(.settings-result) svg { flex-shrink: 0; color: var(--text-faint); }
.settings-nav > button.active svg { color: var(--text-muted); }
.settings-nav-group { margin: 0.75rem 0.45rem 0.2rem; font-size: var(--text-2xs); font-weight: var(--weight-medium); color: var(--text-faint); }

/* Conversation details rows that act: run an action, commit and push, start Git. */
.session-details-actions { display: grid; gap: 0.1rem; }
.session-details-anchor { position: relative; }
.session-details-action {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  min-height: var(--control-h-md); padding: 0 0.4rem; margin: 0 -0.4rem; box-sizing: content-box;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font: inherit; font-size: var(--text-ui); text-align: left; cursor: default;
}
.session-details-action > svg:first-child { flex-shrink: 0; color: var(--text-muted); }
.session-details-action > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-details-action > svg:last-child:not(:first-child) { flex-shrink: 0; color: var(--text-faint); }
.session-details-action:hover, .session-details-action[aria-expanded="true"] { background: var(--bg-hover); }
.session-details-action:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); }
.session-details-row-actions { display: inline-flex; gap: 0.1rem; margin-left: auto; flex-shrink: 0; }
/* The label clips; the buttons beside it must not, or their focus ring is cut off. */
.session-details-row > .session-details-row-actions { overflow: visible; padding: 2px; margin-right: -2px; }
.session-details-row-actions .icon-btn { width: 1.6rem; height: 1.6rem; }

/* The panel is a full-height column beside the workspace. Its header shares the
   titlebar's row: same height, a window drag region, controls exempt. */
.app > .inspector { height: 100%; }
.app > .inspector > .inspector-head {
  min-height: var(--workspace-topbar-height);
  height: var(--workspace-topbar-height);
  box-sizing: border-box;
  -webkit-app-region: drag;
}
.app > .inspector > .inspector-head :is(button, input, select, a, [role="menu"], .inspector-head-slot > *) { -webkit-app-region: no-drag; }

/* Browser: the page and its actions in the panel header; back, forward, reload and the address on one row below. */
.browser-head { display: flex; align-items: center; gap: 0.35rem; min-width: 0; flex: 1; }
/* Tabs share the header's width: each shrinks to its title, the active one is filled. */
.browser-tabs { display: flex; align-items: center; gap: 0.2rem; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.browser-head-tab {
  display: inline-flex; align-items: center; min-width: 3.5rem; flex: 0 1 12rem;
  height: var(--control-h-sm); border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.browser-head-tab[data-active] { background: var(--bg-active); color: var(--text); }
.browser-head-tab:not([data-active]):hover { background: var(--bg-hover); }
.browser-tab-select {
  display: flex; align-items: center; gap: 0.4rem; flex: 1; min-width: 0; height: 100%;
  padding: 0 0.15rem 0 0.5rem; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: var(--text-ui); text-align: left; cursor: default;
}
.browser-tab-select > svg { flex-shrink: 0; color: var(--text-muted); }
.browser-tab-select > .truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-tab-select:focus-visible, .browser-tab-close:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset-inset); border-radius: var(--radius-sm); }
.browser-tab-close {
  display: grid; place-items: center; flex-shrink: 0; width: 1.25rem; height: 1.25rem; margin-right: 0.2rem;
  padding: 0; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--text-faint);
  opacity: 0;
}
.browser-head-tab[data-active] .browser-tab-close, .browser-head-tab:hover .browser-tab-close, .browser-tab-close:focus-visible { opacity: 1; }
.browser-tab-close:hover { background: var(--bg-hover); color: var(--text); }
.browser-tab-new { flex-shrink: 0; }
.browser-head .preview-actions-cluster { margin-left: auto; flex-shrink: 0; }
.panel-browser-pane .panel-browser-nav { flex-wrap: nowrap; height: 2.5rem; padding-block: 0; }
/* Back, forward and reload come first, as in any browser; the address takes the rest. */
.panel-browser-pane .panel-browser-nav .preview-address-group { order: 0; flex: 1 1 auto; min-width: 0; }
/* In the header the page-control button is its shield alone; its state is in the tooltip. */
.browser-head .browser-controls-trigger > span { display: none; }

/* Back and forward beside the sidebar toggle when the sidebar is collapsed. */
.titlebar-history {
  position: absolute;
  left: var(--workspace-titlebar-content-left);
  top: calc((var(--workspace-topbar-height) - var(--workspace-titlebar-control-size)) / 2);
  display: inline-flex;
  gap: 0.1rem;
  z-index: 3;
}
.titlebar-history .icon-btn { width: var(--workspace-titlebar-control-size); height: var(--workspace-titlebar-control-size); }
.page-header.with-history { padding-left: calc(var(--workspace-titlebar-content-left) + 2 * var(--workspace-titlebar-control-size) + 0.6rem); }

/* The icon bar sizes itself to the room it has (overflow goes to More), so it
   never shrinks; the conversation's name is what gives way, down to its floor. */
.page-header .header-actions:has(> .surface-bar) { flex-shrink: 0; }
.page-header .header-lead { min-width: 6rem; }

/* The breadcrumb shrinks with the titlebar: the project name holds, the conversation name ends in an ellipsis. */
.page-header .topbar-breadcrumb { display: flex; min-width: 0; max-width: 100%; }
.page-header .breadcrumb-segment.project-segment { flex-shrink: 0; }
.page-header .thread-title-trigger { flex: 0 1 auto; min-width: 0; }
.page-header .thread-title-trigger > .truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview-viewport-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.35rem 0.65rem; font-size: var(--text-xs); color: var(--text); white-space: nowrap; }
.preview-viewport-row .preview-viewport { color: var(--text); max-width: 9rem; }

/* Over a live page a backdrop blur composites wrongly with the webview's own
   layer and lets the page show through; menus there are plain and solid. */
.panel-browser-pane :is(.preview-more-menu, .browser-controls-popover),
.preview-more-menu { backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Phone pairing code. A fixed light tile so scanners read it in either theme. */
.remote-phone-pairing { display: grid; gap: 0.5rem; justify-items: start; }
.remote-qr {
  width: 11rem;
  height: 11rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}
