    /* Chat panel docked on the right. `--chat-width` is a CSS
     * var the React layer drives from `state.chatWidth`, so the
     * drag-resize handle updates the layout directly without re-rendering
     * the heavy panes. A thin splitter sits in its own grid column so
     * users have a discrete drag target. */
    .app.chat-open {
      grid-template-columns: calc(44px + var(--sidebar-width, 280px)) 1fr 6px var(--chat-width, 480px);
    }
    .app.sidebar-collapsed.chat-open {
      grid-template-columns: 44px 1fr 6px var(--chat-width, 480px);
    }

    /* Match the sidebar's drag handle (globals.css `.sidebar-splitter`):
     * a 6px transparent hit area whose only visible cue is a crisp 2px
     * line drawn by `::after` on hover/active — not a fat colored band. */
    .chat-splitter {
      grid-column: 3;
      grid-row: 1;
      position: relative;
      cursor: col-resize;
      background: transparent;
    }
    /* This line is the panel's only left divider: a 1px `--border` seam at
     * rest (the panel itself has no border-left), brightening to a 2px accent
     * on hover/active. Pinned flush to the panel edge (right: 0) so there's
     * a single line, not a splitter line + a separate panel border. */
    .chat-splitter::after {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      right: 0;
      width: 1px;
      background: var(--border);
      transition: background .12s, width .12s;
    }
    .chat-splitter:hover::after,
    .chat-splitter:active::after {
      width: 2px;
      background: var(--accent);
    }

    /* Outer container — fills the 4th grid track. Holds the chat-tab
     * strip + a body that overlays one agent panel per tab. */
    .chat-pane-shell {
      grid-column: 4;
      grid-row: 1;
      min-width: 0;
      overflow: hidden;
      background: var(--pane);
      display: flex;
      flex-direction: column;
    }

    /* Cursor-style tab strip at the top of the chat panel. Scrolls
     * horizontally when many tabs are open. New tabs come from the
     * chrome-row agent launchers, so the strip is tabs-only. */
    .chat-tabs {
      display: flex;
      align-items: stretch;
      gap: 4px;
      padding: 6px 6px 4px 6px;
      min-height: 32px;
    }
    .chat-tabs-list {
      display: flex;
      flex: 1;
      gap: 2px;
      overflow-x: auto;
      overflow-y: hidden;
      scrollbar-width: thin;
    }
    .chat-tabs-list::-webkit-scrollbar { height: 4px; }
    .chat-tabs-list::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 2px;
    }

    .chat-tab {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 6px 4px 10px;
      max-width: 180px;
      min-width: 0;
      font-size: 12px;
      color: var(--muted);
      border-radius: 6px 6px 0 0;
      cursor: pointer;
      border: 1px solid transparent;
      border-bottom: 0;
      background: transparent;
      user-select: none;
      white-space: nowrap;
    }
    .chat-tab:hover {
      background: var(--hover);
      color: var(--fg);
    }
    .chat-tab.active {
      background: var(--bg);
      color: var(--fg);
      border-color: var(--border);
      font-weight: 500;
      padding-bottom: 5px;
    }
    .chat-tab-icon {
      width: 13px;
      height: 13px;
      flex-shrink: 0;
    }
    .chat-tab-label {
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .chat-tab-close {
      width: 18px;
      height: 18px;
      border: 0;
      background: transparent;
      color: var(--muted);
      font-size: 14px;
      line-height: 1;
      border-radius: 4px;
      cursor: pointer;
      flex-shrink: 0;
      /* Hidden by default — only surfaces on tab hover or for the
       * active tab. Avoids visual clutter when many tabs are open. */
      opacity: 0;
    }
    .chat-tab:hover .chat-tab-close,
    .chat-tab.active .chat-tab-close {
      opacity: 1;
    }
    .chat-tab-close:hover {
      background: var(--hover);
      color: var(--fg);
    }

    /* Body — relative anchor for the absolutely-positioned tab panes
     * below. Inactive panes stay mounted (preserving each session's
     * state) but render off-screen via `visibility: hidden`. */
    .chat-tabs-body {
      position: relative;
      flex: 1;
      min-height: 0;
    }
    .chat-tab-pane {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      visibility: hidden;
      pointer-events: none;
    }
    .chat-tab-pane.active {
      visibility: visible;
      pointer-events: auto;
    }

    /* `.chat-pane` is the inside of one tab body (not the grid
     * container); `.status` is the empty-state "no active chat" notice. */
    .chat-pane {
      flex: 1;
      min-height: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }
    .chat-pane.status {
      padding: 16px 18px;
      color: var(--muted);
      font-size: 12px;
    }

    /* Chrome-row chat launchers — one brand-icon button per agent
     * (Claude, Codex), VSCode-style. Each inherits `.icon-btn`; `.active`
     * tints it when its agent's chat is the one currently showing.
     * Spawning / agent selection logic lives in ChatLaunchButtons. */
    .chat-launchers {
      display: flex;
      align-items: center;
      gap: 2px;
    }
    .icon-btn.chat-launch.active {
      background: rgba(8, 145, 178, 0.08);
    }



    /* ===================================================================
     * Structured agent panel (AgentView) — Phase 1 of the VSCode-style
     * Claude chat. The Codex placeholder (CodexView) reuses these styles.
     * See design-docs/chat-panel.md.
     * =================================================================== */
    .agent-view {
      position: relative;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      background: var(--pane);
    }
    /* Drag-files-here overlay — shown while a file drag hovers the panel.
     * `pointer-events: none` so it never steals the drop or flickers the
     * dragenter/leave tracking; the panel's own handlers take the drop. */
    .agent-drop-overlay {
      position: absolute;
      inset: 6px;
      z-index: 20;
      display: grid;
      place-items: center;
      pointer-events: none;
      border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
      border-radius: 12px;
      background: color-mix(in srgb, var(--accent) 7%, transparent);
      backdrop-filter: blur(1.5px);
      -webkit-backdrop-filter: blur(1.5px);
    }
    .agent-drop-card {
      padding: 8px 14px;
      border-radius: 8px;
      background: var(--card);
      border: 1px solid var(--border);
      box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
      font-size: 12.5px;
      font-weight: 500;
      color: var(--fg);
    }
    /* Header row — session title + history / new-chat actions */
    .agent-head {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 8px 6px 12px;
    }
    .agent-head-title {
      flex: 1;
      min-width: 0;
      font-size: 12.5px;
      color: var(--muted);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .agent-head-actions { display: flex; gap: 2px; flex-shrink: 0; }
    .agent-head-btn {
      width: 26px;
      height: 26px;
      border: 0;
      padding: 0; /* see .agent-bar-btn — kill UA button padding so the icon centres */
      background: transparent;
      color: var(--muted);
      border-radius: 6px;
      cursor: pointer;
      display: grid;
      place-items: center;
    }
    .agent-head-btn svg { width: 16px; height: 16px; }
    .agent-head-btn:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
    .agent-head-btn:disabled { opacity: 0.4; cursor: default; }

    /* History dropdown — anchored to the head button, opening downward
     * (mirrors .agent-mode-menu, which opens upward from the composer). */
    .agent-history-wrap { position: relative; display: inline-flex; }
    .agent-history-menu {
      position: absolute;
      right: 0;
      top: calc(100% + 6px);
      z-index: 20;
      width: 320px;
      max-width: calc(100vw - 24px);
      padding: 6px;
      background: var(--pane);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    }
    .agent-history-search { padding: 2px 2px 6px; }
    .agent-history-search input {
      width: 100%;
      box-sizing: border-box;
      padding: 6px 9px;
      font-size: 13px;
      color: var(--fg);
      background: var(--hover);
      border: 1px solid var(--border);
      border-radius: 7px;
      outline: none;
    }
    .agent-history-search input::placeholder { color: var(--muted); }
    .agent-history-list { max-height: 320px; overflow-y: auto; }
    .agent-history-empty { padding: 14px 8px; text-align: center; color: var(--muted); font-size: 12.5px; }
    /* Row = the open button (fills width) + hover-revealed actions. */
    .agent-history-row {
      position: relative;
      display: flex;
      align-items: center;
      border-radius: 7px;
    }
    .agent-history-row:hover { background: var(--hover); }
    .agent-history-row.active { background: var(--active); }
    .agent-history-open {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: baseline;
      gap: 8px;
      padding: 7px 9px;
      border: 0;
      background: transparent;
      cursor: pointer;
      text-align: left;
      color: var(--fg);
    }
    .agent-history-title {
      flex: 1;
      min-width: 0;
      font-size: 13px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .agent-history-time { flex-shrink: 0; font-size: 11.5px; color: var(--muted); }
    .agent-history-rename {
      flex: 1;
      min-width: 0;
      margin: 4px 6px;
      padding: 4px 7px;
      font-size: 13px;
      color: var(--fg);
      background: var(--bg);
      border: 1px solid var(--accent, var(--border));
      border-radius: 6px;
      outline: none;
    }
    /* Time and actions share the one right-hand slot: time shows at rest,
     * hover swaps it for edit/delete (toggling `display` so neither
     * reserves the other's space — time stays flush-right at rest). */
    .agent-history-row-actions {
      display: none;
      gap: 1px;
      flex-shrink: 0;
      padding-right: 5px;
    }
    .agent-history-row:hover .agent-history-time { display: none; }
    .agent-history-row:hover .agent-history-row-actions { display: flex; }
    .agent-history-act {
      width: 24px;
      height: 24px;
      border: 0;
      padding: 0;
      background: transparent;
      color: var(--muted);
      border-radius: 5px;
      cursor: pointer;
      display: grid;
      place-items: center;
    }
    .agent-history-act svg { width: 15px; height: 15px; }
    .agent-history-act:hover { background: var(--border); color: var(--fg); }

    .agent-messages {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      /* No top padding: sticky turn headers pin to the very top with no
       * gap for reply content to peek through. First child gets the top
       * breathing room instead (scrolls away). */
      padding: 0 12px 8px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      scrollbar-width: thin;
    }
    .agent-messages > :first-child { margin-top: 12px; }

    /* Empty-state hero */
    .agent-hero {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 22px;
      padding: 24px;
      text-align: center;
    }
    .agent-hero-wordmark {
      display: flex;
      align-items: center;
      gap: 9px;
      color: var(--fg);
    }
    .agent-hero-mark { width: 22px; height: 22px; }
    .agent-hero-name {
      font-family: Georgia, 'Times New Roman', ui-serif, serif;
      font-size: 21px;
      letter-spacing: 0.01em;
    }
    .agent-hero-sprite {
      width: 64px;
      height: 50px;
      image-rendering: pixelated;
    }
    /* "Coming soon" placeholder (Codex panel stub) */
    .agent-coming-soon {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      max-width: 280px;
    }
    .agent-coming-soon-pill {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: var(--muted);
      background: var(--hover);
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 3px 10px;
    }
    .agent-coming-soon-note {
      margin: 0;
      font-size: 12px;
      line-height: 1.5;
      color: var(--muted);
    }
    .agent-empty,
    .agent-ended {
      color: var(--muted);
      font-size: 12.5px;
      padding: 8px 2px;
      line-height: 1.5;
    }
    .agent-ended {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-top: 1px solid var(--border);
      padding: 8px 12px;
    }
    .agent-fatal {
      display: flex;
      align-items: center;
      gap: 10px;
      border-top: 1px solid var(--border);
      padding: 9px 12px;
      font-size: 12.5px;
      color: var(--muted);
    }
    .agent-fatal-msg { flex: 1; line-height: 1.5; }

    /* A turn = one user message (sticky header) + its reply blocks. */
    .agent-turn {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    /* 1px sentinel at the turn's flow-top — when it scrolls above the
     * scroll container's top edge, the header is pinned (see UserTurnHead's
     * IntersectionObserver). Out of flow so it adds no gap. */
    .agent-turn-sentinel {
      position: absolute;
      top: 0;
      left: 0;
      width: 1px;
      height: 1px;
      pointer-events: none;
    }
    /* The user message renders as a full-width header pinned to the top
     * of the scroll area while its reply scrolls past (VSCode-style).
     * Sticky release is bounded by `.agent-turn`, so the next turn's
     * header pushes this one up.
     *
     * At rest it sits flat and quiet, embedded in the chat. Only once
     * pinned (`.stuck`) does it lift into a frosted-glass card — a
     * translucent fill + backdrop blur let the reply blur softly
     * underneath, and the shadow separates it from the scrolling chat. */
    .agent-turn-head {
      position: sticky;
      top: 0;
      z-index: 2;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 11px;
      padding: 9px 12px;
      font-size: 13px;
      line-height: 1.5;
      color: var(--fg);
      white-space: pre-wrap;
      word-break: break-word;
      transition: box-shadow .18s ease;
    }
    /* When pinned: the box body stays opaque; only the bottom EDGE gets a
     * soft, semi-transparent gradient shadow so the reply scrolling
     * beneath fades out gently under the box rather than hitting a hard
     * line (VSCode sticky-scroll style). The negative spread keeps the
     * shadow at the bottom edge only; kept small per "阴影不用太大". */
    .agent-turn-head.stuck {
      box-shadow: 0 7px 8px -6px rgba(15, 23, 42, 0.13);
    }
    .agent-turn-attach {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-bottom: 6px;
    }
    .agent-turn-text { display: block; }

    /* Assistant messages */
    .agent-msg { display: flex; }
    .agent-msg.assistant { display: block; }
    .agent-prose {
      font-size: 13px;
      line-height: 1.6;
      color: var(--fg);
      word-break: break-word;
    }
    .agent-prose > :first-child { margin-top: 0; }
    .agent-prose > :last-child { margin-bottom: 0; }
    .agent-prose p { margin: 0.4em 0; }
    .agent-prose pre {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 8px 10px;
      overflow-x: auto;
      font-size: 12px;
      line-height: 1.45;
    }
    .agent-prose code {
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 0.88em;
    }
    .agent-prose :not(pre) > code {
      background: var(--hover);
      padding: 1px 5px;
      border-radius: 3px;
    }
    .agent-prose ul, .agent-prose ol { padding-left: 1.4em; margin: 0.4em 0; }
    .agent-prose a { color: var(--accent); }

    /* Thinking block */
    .agent-thinking {
      border-left: 2px solid var(--border);
      padding-left: 8px;
    }
    .agent-thinking-head {
      display: flex;
      align-items: center;
      gap: 4px;
      border: 0;
      background: transparent;
      color: var(--muted);
      font-size: 12px;
      cursor: pointer;
      padding: 2px 0;
    }
    .agent-thinking-chev {
      width: 12px;
      height: 12px;
      transition: transform 0.12s;
      transform: rotate(-90deg);
    }
    .agent-thinking.open .agent-thinking-chev { transform: none; }
    .agent-thinking-body {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.55;
      white-space: pre-wrap;
      padding: 4px 0 6px;
    }

    /* Tool cards */
    .agent-tool {
      border: 1px solid var(--border);
      border-radius: 8px;
      overflow: hidden;
      background: var(--bg);
    }
    .agent-tool.status-awaiting { border-color: var(--accent); }
    .agent-tool-head {
      display: flex;
      align-items: center;
      gap: 7px;
      width: 100%;
      border: 0;
      background: transparent;
      cursor: pointer;
      padding: 7px 10px;
      font-size: 12.5px;
      text-align: left;
    }
    .agent-tool-chev {
      width: 12px;
      height: 12px;
      flex-shrink: 0;
      color: var(--muted);
    }
    .agent-tool-name { font-weight: 600; color: var(--fg); flex-shrink: 0; }
    .agent-tool-summary {
      color: var(--muted);
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 11.5px;
    }
    .agent-tool-status {
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      color: var(--muted);
    }
    .agent-tool-status.s-done { color: #50a14f; }
    .agent-tool-status.s-error { color: #e45649; }
    .agent-tool-status.s-denied { color: #e45649; }
    .agent-tool-status.s-awaiting { color: var(--accent); }
    .agent-tool-body { padding: 0 10px 10px; }
    .agent-tool-input,
    .agent-tool-result,
    .agent-bash {
      margin: 6px 0 0;
      background: var(--pane);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 7px 9px;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 11.5px;
      line-height: 1.45;
      overflow-x: auto;
      white-space: pre-wrap;
      word-break: break-word;
      max-height: 280px;
      overflow-y: auto;
    }
    .agent-tool-result.err { color: #e45649; }

    /* Permission prompt (inside an awaiting tool card) */
    .agent-perm { padding: 0 10px 10px; }
    .agent-perm-title {
      font-size: 12.5px;
      color: var(--fg);
      margin-bottom: 7px;
    }
    .agent-perm-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 9px;
    }
    .agent-btn {
      border: 1px solid var(--border);
      background: var(--bg);
      color: var(--fg);
      font: inherit;
      font-size: 12.5px;
      padding: 5px 14px;
      border-radius: 6px;
      cursor: pointer;
    }
    .agent-btn:hover { background: var(--hover); }
    .agent-btn.primary {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    .agent-btn.primary:hover { filter: brightness(1.05); }

    /* Inline diff */
    .agent-diff {
      border: 1px solid var(--border);
      border-radius: 6px;
      overflow: hidden;
      margin-top: 4px;
    }
    .agent-diff-file {
      background: var(--pane);
      border-bottom: 1px solid var(--border);
      padding: 4px 9px;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 11.5px;
      color: var(--muted);
    }
    .agent-diff-body {
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 11.5px;
      line-height: 1.5;
      overflow-x: auto;
      max-height: 320px;
      overflow-y: auto;
    }
    .agent-diff-row { display: flex; white-space: pre; }
    .agent-diff-row.add { background: rgba(80, 161, 79, 0.13); }
    .agent-diff-row.del { background: rgba(228, 86, 73, 0.12); }
    .agent-diff-gutter {
      width: 18px;
      flex-shrink: 0;
      text-align: center;
      color: var(--muted);
      user-select: none;
    }
    .agent-diff-row.add .agent-diff-gutter { color: #50a14f; }
    .agent-diff-row.del .agent-diff-gutter { color: #e45649; }
    .agent-diff-text { flex: 1; padding-right: 8px; }

    /* Error notice */
    .agent-error {
      background: rgba(228, 86, 73, 0.1);
      border: 1px solid rgba(228, 86, 73, 0.3);
      color: #c0392b;
      border-radius: 6px;
      padding: 8px 11px;
      font-size: 12.5px;
      line-height: 1.5;
      white-space: pre-wrap;
    }

    /* Working indicator */
    .agent-working {
      display: flex;
      align-items: center;
      gap: 7px;
      color: var(--muted);
      font-size: 12px;
      padding: 2px;
    }
    .agent-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent);
      animation: agent-pulse 1s ease-in-out infinite;
    }
    @keyframes agent-pulse {
      0%, 100% { opacity: 0.3; }
      50% { opacity: 1; }
    }

    /* Composer */
    .agent-composer {
      position: relative;
      padding: 8px;
      background: var(--pane);
    }
    .agent-composer-box {
      display: flex;
      flex-direction: column;
      gap: 6px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 8px 8px 6px;
    }
    .agent-composer-box:focus-within { border-color: var(--accent); }

    /* Attachment chips row (VSCode-style) above the textarea */
    .agent-attachments {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 5px;
    }
    .agent-attach-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      max-width: 220px;
      padding: 3px 4px 3px 7px;
      background: var(--hover);
      border: 1px solid var(--border);
      border-radius: 6px;
      font-size: 11.5px;
      color: var(--fg);
    }
    .agent-attach-icon { width: 13px; height: 13px; flex-shrink: 0; color: var(--muted); }
    .agent-attach-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .agent-attach-dims { color: var(--muted); flex-shrink: 0; }
    .agent-attach-x {
      display: grid;
      place-items: center;
      width: 16px;
      height: 16px;
      border: 0;
      background: transparent;
      color: var(--muted);
      font-size: 14px;
      line-height: 1;
      border-radius: 4px;
      cursor: pointer;
      flex-shrink: 0;
    }
    .agent-attach-x:hover { background: var(--border); color: var(--fg); }
    .agent-attach-loading { font-size: 11.5px; color: var(--muted); }

    .agent-input {
      border: 0;
      background: transparent;
      resize: none;
      outline: none;
      font: inherit;
      font-size: 13px;
      line-height: 1.5;
      color: var(--fg);
      /* Grow with content natively (Chromium 123+, Electron 30+): taller
       * only when the text wraps, up to the max. `rows={1}` is the fallback
       * height if field-sizing is ever unavailable. The min-height floors
       * the empty input a touch taller than the button row below it (the
       * 28px send button) so the composer isn't top-light. */
      field-sizing: content;
      min-height: 36px;
      max-height: 160px;
      padding: 6px 2px 0;
    }
    /* Action bar under the textarea: + / slash / context chip … mode / send.
     * A full-width rule separates it from the input — the negative side
     * margins bleed past the box's 8px padding so the line spans edge to
     * edge, then the matching padding restores the content inset. */
    .agent-composer-bar {
      display: flex;
      align-items: center;
      gap: 5px;
      margin: 0 -8px;
      padding: 6px 8px 0;
      border-top: 1px solid var(--border);
    }
    .agent-bar-spacer { flex: 1; }
    .agent-bar-btn {
      width: 26px;
      height: 26px;
      border: 0;
      /* padding:0 is load-bearing: a <button>'s UA default padding (1px 6px)
       * shrinks the grid content box below the icon width, and the overflow
       * aligns right instead of centring — the glyph then sits ~1-2px right of
       * centre. Zeroing padding lets `place-items: center` actually centre. */
      padding: 0;
      border-radius: 6px;
      background: transparent;
      /* Match the header action buttons (.agent-head-btn): muted at rest,
       * solid --fg on hover. Keeps +, /, and "new chat" one visual set. */
      color: var(--muted);
      cursor: pointer;
      display: grid;
      place-items: center;
      font-size: 15px;
      line-height: 1;
    }
    .agent-bar-btn svg { width: 16px; height: 16px; }
    .agent-bar-btn:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
    .agent-bar-btn:disabled { opacity: 0.5; cursor: default; }
    /* Slash is a "coming soon" placeholder but should read identically to
     * the + at rest (same muted colour, no dim); only the cursor + no-op
     * click signal it's inert. Its hover still fills the framing box. */
    .agent-bar-btn.slash:disabled { opacity: 1; }
    .agent-bar-btn.slash:hover { opacity: 1; background: var(--hover); color: var(--fg); }
    /* Thin vertical rule separating the action cluster from the context chip. */
    .agent-bar-divider {
      width: 1px;
      align-self: stretch;
      margin: 3px 3px;
      background: var(--border);
    }
    /* Borderless context chip — just a file glyph + name, VSCode-style. */
    .agent-ctx-chip {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      max-width: 180px;
      color: var(--muted);
      font-size: 11.5px;
    }
    .agent-ctx-icon { width: 13px; height: 13px; flex-shrink: 0; }
    .agent-ctx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .agent-mode-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      border: 0;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 11.5px;
      padding: 3px 6px;
      border-radius: 6px;
      cursor: pointer;
      white-space: nowrap;
    }
    .agent-mode-icon { width: 14px; height: 14px; flex-shrink: 0; }
    .agent-mode-btn:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
    .agent-mode-btn:disabled { cursor: default; }

    /* "Modes" dropdown — opens upward from the mode button. */
    .agent-mode-wrap { position: relative; display: inline-flex; }
    .agent-mode-menu {
      position: absolute;
      right: 0;
      bottom: calc(100% + 6px);
      z-index: 20;
      width: 320px;
      max-width: calc(100vw - 24px);
      padding: 6px;
      background: var(--pane);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    }
    .agent-mode-menu-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 4px 8px 8px;
      color: var(--muted);
      font-size: 12px;
    }
    .agent-mode-opt {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      width: 100%;
      padding: 8px;
      border: 0;
      border-radius: 8px;
      background: transparent;
      text-align: left;
      cursor: pointer;
      color: var(--fg);
    }
    .agent-mode-opt:hover { background: var(--hover); }
    .agent-mode-opt.active { background: var(--active); }
    .agent-mode-opt-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--muted); }
    .agent-mode-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
    .agent-mode-opt-title { font-size: 13px; font-weight: 500; }
    .agent-mode-opt-desc { font-size: 11.5px; line-height: 1.4; color: var(--muted); }
    .agent-mode-opt-check { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }

    /* Effort footer — icon + label on the left, a 5-notch slider on the
     * right. Separated from the mode list by a hairline. */
    .agent-effort {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 4px;
      padding: 10px 8px 4px;
      border-top: 1px solid var(--border);
    }
    .agent-effort-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
    .agent-effort-label { flex: 1; font-size: 12.5px; color: var(--fg); }
    .agent-effort-level { color: var(--muted); }
    .agent-effort-track { display: flex; align-items: center; gap: 7px; padding: 4px 2px; }
    .agent-effort-notch {
      width: 8px;
      height: 8px;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: var(--border);
      cursor: pointer;
      flex-shrink: 0;
      transition: background .12s;
    }
    .agent-effort-notch.on { background: var(--accent); }
    .agent-effort-notch.max.on { background: #a855f7; }
    /* The current level is a larger knob with a ring, like a slider handle. */
    .agent-effort-notch.cur {
      width: 14px;
      height: 14px;
      background: var(--bg);
      border: 2px solid var(--accent);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    .agent-effort-notch.max.cur { border-color: #a855f7; }
    /* Neutral send button — subtle surface + border, not a filled accent
     * (matches the VSCode composer). Goes accent only on hover-when-ready. */
    .agent-send {
      flex-shrink: 0;
      width: 28px;
      height: 28px;
      border: 1px solid var(--border);
      padding: 0; /* see .agent-bar-btn — kill UA button padding so the arrow centres */
      border-radius: 8px;
      background: var(--active);
      color: var(--fg);
      font-size: 15px;
      cursor: pointer;
      display: grid;
      place-items: center;
    }
    .agent-send svg { width: 18px; height: 18px; }
    .agent-send:not(:disabled):hover { background: var(--accent); border-color: var(--accent); color: #fff; }
    .agent-send:disabled { opacity: 0.4; cursor: default; }
    .agent-send.stop { background: #e45649; border-color: #e45649; color: #fff; font-size: 11px; }

    /* @-mention popup */
    .agent-mention {
      position: absolute;
      left: 8px;
      right: 8px;
      bottom: calc(100% - 4px);
      max-height: 220px;
      overflow-y: auto;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
      padding: 4px;
      z-index: 30;
    }
    .agent-mention-item {
      display: flex;
      flex-direction: column;
      width: 100%;
      border: 0;
      background: transparent;
      text-align: left;
      padding: 5px 8px;
      border-radius: 5px;
      cursor: pointer;
    }
    .agent-mention-item:hover { background: var(--hover); }
    .agent-mention-name { font-size: 12.5px; color: var(--fg); }
    .agent-mention-path { font-size: 11px; color: var(--muted); }
