/* Agent Manager layout */

.am-layout {
  display: flex;
  height: 100vh;
  font-size: var(--font-size-base);
  overflow: hidden;
}

/* Virtua already removes off-screen transcript rows. Avoid a second layer of
   layout skipping, which can leave Chromium accessibility traversing fragments
   whose layout items were discarded while Agent Manager scrolls. */
.am-layout
  :is(
    [data-component="assistant-message"],
    [data-component="tool-trigger"],
    [data-component="file"],
    [data-component="code"],
    [data-component="diff"]
  ) {
  content-visibility: visible;
}

/* Generated separators become accessibility text nodes. Keep them out of
   concurrently updating Agent Manager tool rows while preserving sidebar UI. */
html[data-theme="kilo-vscode"]
  .am-layout
  [data-component="tool-part-wrapper"][data-part-type="tool"]
  [data-component="collapsible"]
  [data-slot="basic-tool-tool-title"]
  + :is(
    [data-slot="basic-tool-tool-subtitle"],
    [data-slot="basic-tool-tool-arg"],
    [data-slot="message-part-meta-line"],
    [data-slot="webfetch-meta"],
    [data-component="shell-submessage"]
  )::before,
html[data-theme="kilo-vscode"]
  .am-layout
  [data-component="tool-part-wrapper"][data-part-type="tool"]
  [data-component="collapsible"]
  [data-slot="message-part-title-text"]
  + :is([data-slot="message-part-meta-line"], [data-slot="basic-tool-tool-subtitle"])::before,
html[data-theme="kilo-vscode"]
  .am-layout
  [data-component="tool-part-wrapper"][data-part-type="tool"]
  [data-slot="context-tool-group-summary"]::before {
  content: none;
}

.am-sidebar {
  position: relative;
  min-width: 200px;
  border-right: 1px solid var(--border-weak-base);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--surface-base);
  padding: 8px;
  gap: 4px;
}

.am-sidebar > [data-component="resize-handle"]::after {
  background: var(--surface-interactive-base);
}

/* Collapsed sidebar: width animates closed; the layout-hydrated class delays
   the transition until after the first state push so we don't see a flash on
   initial render when the persisted state is "collapsed". */
.am-layout-hydrated .am-sidebar {
  transition:
    width 180ms ease,
    min-width 180ms ease,
    padding 180ms ease,
    border-right-width 180ms ease;
}

.am-sidebar-collapsed {
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-width: 0;
  overflow: hidden;
  /* Pointer events, focus, and a11y tree exclusion are all handled by the
     inert attribute on the element. No need for pointer-events: none. */
}

.am-sidebar-collapsed > [data-component="resize-handle"] {
  display: none;
}

/* Empty tab bar — rendered when no session is selected so the sidebar
   toggle button sits in the same pixel position regardless of state.
   Drops the leading slot's border-right because there's nothing after it. */
.am-tab-bar-empty .am-tab-leading {
  border-right: none;
}

/* Fixed local repo item */

.am-local-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 40px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-base);
  font-family: inherit;
  font-size: var(--font-size-base);
  flex-shrink: 0;
}

.am-local-item:hover {
  background: var(--surface-inset-base-hover);
}

.am-local-item:active {
  opacity: 0.8;
}

.am-local-item-active {
  background: var(--surface-interactive-base);
  color: var(--text-on-interactive-base);
}

.am-local-item-active .am-local-icon {
  color: var(--text-on-interactive-base);
}

.am-local-item-active .am-local-branch {
  color: color-mix(in srgb, var(--text-on-interactive-base) 70%, transparent);
}

.am-local-item-active .am-stat-files {
  color: rgba(255, 255, 255, 0.7);
}

.am-local-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-weak);
}

.am-local-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0;
  flex: 1;
}

.am-local-label {
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.4;
}

.am-local-branch {
  font-size: var(--kilo-font-size-10);
  color: var(--text-weaker);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sections */

.am-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.am-section-grow {
  flex: 1;
  min-height: 0;
}

.am-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 2px;
}

.am-section-label {
  font-size: var(--font-size-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-weak);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Collapsible section toggle */

button.am-section-toggle {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 2px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

button.am-section-toggle:hover .am-section-label {
  color: var(--text-base);
}

.am-section-chevron {
  flex-shrink: 0;
}

.am-section-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Worktree list */

.am-worktree-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 50vh;
}

.am-section-grow .am-worktree-list {
  max-height: none;
  flex: 1;
}

/* Worktree item — larger card style */

.am-worktree-list [data-slot="hover-card-trigger"] {
  min-width: 0;
}

.am-worktree-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  min-height: 36px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--text-base);
  min-width: 0;
  width: 100%;
  transition: background 200ms ease;
}

/* Left icon column — shrink-0, vertically centered with first row */
.am-wt-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 20px;
}

/* Right content column — flex-1 with two rows */
.am-wt-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Row 1: label + stats/hover-actions */
.am-wt-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Grid overlay cell: stats visible by default, hover actions stacked on top */
.am-wt-actions-cell {
  position: relative;
  flex-shrink: 0;
  display: grid;
  align-items: center;
  margin-left: auto;
}
.am-wt-actions-cell > * {
  grid-column: 1;
  grid-row: 1;
}

/* Hover actions (shortcut badge + close button) — hidden by default, shown on hover */
.am-wt-hover-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
}
.am-worktree-item:hover .am-wt-hover-actions {
  opacity: 1;
  visibility: visible;
}
/* Stats fade out on hover (replaced by hover actions in same grid cell) */
.am-worktree-item:hover .am-wt-actions-cell > .am-worktree-stats,
.am-worktree-item:hover .am-wt-actions-cell > .am-worktree-stats-skeleton {
  opacity: 0;
  visibility: hidden;
}

/* Row 2: always present for consistent height; PR badge right-aligned */
.am-wt-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 14px;
}

.am-worktree-subtitle {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--kilo-font-size-10);
  color: var(--text-weaker);
  line-height: 1.2;
  min-width: 0;
}

.am-worktree-item-active .am-worktree-subtitle {
  color: color-mix(in srgb, var(--text-on-interactive-base) 70%, transparent);
}

.am-worktree-item:hover {
  background: var(--surface-inset-base-hover);
}

.am-worktree-item:active {
  opacity: 0.8;
}

.am-worktree-item-active {
  background: var(--surface-interactive-base);
  color: var(--text-on-interactive-base);
}

.am-worktree-item-active [data-component="icon"] {
  color: var(--text-on-interactive-base);
}

.am-worktree-branch {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  min-width: 0;
}

.am-worktree-rename-input {
  flex: 1;
  min-width: 0;
  height: 22px;
  padding: 0 4px;
  border: 1px solid var(--border-focus, #007fd4);
  border-radius: 3px;
  background: var(--surface-base);
  color: var(--text-base);
  font-size: inherit;
  font-weight: 500;
  font-family: inherit;
  outline: none;
}

/* Shortcut badge — hover-reveal index badge (⌘1, ⌘2, etc.) */

.am-shortcut-badge {
  font-size: var(--kilo-font-size-10);
  font-variant-numeric: tabular-nums;
  color: var(--text-weaker);
  pointer-events: none;
  white-space: nowrap;
}

.am-local-item .am-shortcut-badge {
  right: 8px;
}

.am-local-item:hover .am-shortcut-badge {
  opacity: 1;
}

.am-local-item:hover .am-local-branch {
  mask-image: linear-gradient(to right, black calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 40px), transparent 100%);
}

.am-worktree-item-active .am-shortcut-badge {
  color: color-mix(in srgb, var(--text-on-interactive-base) 60%, transparent);
}

.am-worktree-item-active:hover .am-shortcut-badge {
  opacity: 0.8;
}

.am-local-item-active .am-shortcut-badge {
  color: var(--text-weak);
}

.am-worktree-item:has(.am-worktree-rename-input) .am-wt-row2 {
  display: none;
}

.am-worktree-close {
  flex-shrink: 0;
}
/* Compact close button inside worktree items */
.am-worktree-close [data-component="icon-button"] {
  width: 18px;
  height: 18px;
  padding: 2px;
}
.am-worktree-close [data-component="icon"] {
  width: 14px;
  height: 14px;
}

.am-worktree-item:has(.am-worktree-rename-input) .am-wt-hover-actions {
  opacity: 0;
  visibility: hidden;
}

/* Inline delete confirmation */

.am-worktree-item.am-worktree-pending-delete,
.am-worktree-item.am-worktree-pending-delete.am-worktree-item-active {
  background: color-mix(in srgb, var(--surface-critical-strong) 18%, transparent);
}

.am-worktree-item.am-worktree-pending-delete:hover,
.am-worktree-item.am-worktree-pending-delete.am-worktree-item-active:hover {
  background: color-mix(in srgb, var(--surface-critical-strong) 25%, transparent);
}

.am-worktree-pending-delete .am-worktree-branch,
.am-worktree-pending-delete .am-worktree-subtitle {
  opacity: 0.5;
  transition: opacity 200ms ease;
}

.am-worktree-pending-delete .am-worktree-stats,
.am-worktree-pending-delete .am-worktree-stats-skeleton {
  display: none;
}

.am-worktree-pending-delete .am-wt-row2 {
  visibility: hidden;
}

.am-worktree-pending-delete .am-wt-hover-actions {
  opacity: 0 !important;
  visibility: hidden !important;
}

.am-worktree-delete-hint {
  position: absolute;
  right: 0;
  font-size: var(--font-size-small);
  color: var(--text-on-brand-base);
  background: var(--surface-critical-strong);
  white-space: nowrap;
  padding: 1px 8px;
  border-radius: 4px;
  cursor: pointer;
  animation: am-hint-slide-in 200ms ease;
}

.am-worktree-delete-hint:hover {
  opacity: 0.9;
}

@keyframes am-hint-slide-in {
  from {
    opacity: 0;
    transform: translateX(4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.am-worktree-stale-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 2px;
  color: var(--text-warning, #f59e0b);
  flex-shrink: 0;
}

.am-worktree-item-active .am-worktree-stale-badge {
  color: color-mix(in oklab, var(--text-warning, #f59e0b) 90%, var(--text-base));
}

.am-worktree-stale-badge [data-component="icon"] {
  color: currentColor;
}

.am-tooltip-wrap {
  max-width: 240px;
  white-space: normal;
}

.am-worktree-spinner {
  width: 16px;
  height: 16px;
}

/* Per-worktree git stats (diff lines + commits missing from origin) */

.am-worktree-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-family: var(--font-mono, monospace);
  font-size: var(--kilo-font-size-10);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.am-worktree-stats-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.am-worktree-stats-skeleton {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.am-worktree-stats-skeleton-row {
  width: 48px;
  height: 8px;
  border-radius: 3px;
  background: var(--text-base);
  animation: am-skeleton-pulse 1.5s ease-in-out infinite;
}

.am-pr-badge-skeleton {
  width: 52px;
  height: 14px;
  border-radius: 6px;
  background: var(--text-base);
  animation: am-skeleton-pulse 1.5s ease-in-out infinite;
  animation-delay: 0.3s;
  opacity: 0;
  margin-left: auto;
}

.am-run-badge {
  --am-run-accent: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px 1px 3px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--am-run-accent) 12%, transparent);
  color: var(--am-run-accent);
  font-size: var(--kilo-font-size-10);
  line-height: 1;
  margin-left: auto;
}

.am-run-badge [data-component="icon"] {
  width: 11px;
  height: 11px;
  color: currentColor;
}

.am-run-badge-label {
  color: currentColor;
}

.am-run-badge[data-run-state="running"] {
  --am-run-accent: var(--vscode-testing-iconPassed, #34d399);
  animation: am-run-pulse 1.5s ease-in-out infinite;
}

.am-run-badge[data-run-state="stopping"] {
  --am-run-accent: #fbbf24;
}

.am-run-badge[data-run-state="success"] {
  --am-run-accent: var(--vscode-testing-iconPassed, #34d399);
}

.am-run-badge[data-run-state="error"] {
  --am-run-accent: #f87171;
}

@keyframes am-run-pulse {
  0%,
  100% {
    opacity: 0.95;
  }
  50% {
    opacity: 0.45;
  }
}

/* Toolbar Run button group */
.am-run-group {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.am-run-group-chevron {
  padding: 0 2px !important;
  min-width: 0 !important;
  width: auto !important;
}

.am-run-group-chevron [data-component="icon"] {
  width: 12px;
  height: 12px;
}

/* Unconfigured — muted until hover */
.am-run-unconfigured {
  opacity: 0.5;
}
.am-run-unconfigured:hover {
  opacity: 0.85;
}

/* Green accent when running — uses VS Code's standard green token */
.am-run-active,
.am-run-active [data-component="icon"] {
  color: var(--vscode-testing-iconPassed, #34d399) !important;
}

.am-stat-files {
  color: var(--text-muted);
}

.am-stat-additions {
  color: #34d399;
}

.am-stat-deletions {
  color: #f87171;
}

/* PR pill badge — second row inside am-wt-row2.
   Uses --pr-accent custom property (set inline) to derive all colors. */
.am-pr-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px 2px 4px;
  border-radius: 6px;
  border: none;
  background: color-mix(in srgb, var(--pr-accent) 12%, transparent);
  color: var(--pr-accent);
  cursor: pointer;
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: background 150ms ease;
  margin-left: auto;
}
.am-pr-badge:hover {
  background: color-mix(in srgb, var(--pr-accent) 25%, transparent);
}
.am-pr-badge [data-component="icon"] {
  width: 12px;
  height: 12px;
  color: var(--pr-accent);
}
.am-pr-badge-number {
  line-height: 1;
  color: var(--text-muted);
}
.am-pr-badge:hover .am-pr-badge-number {
  color: var(--pr-accent);
}
.am-pr-badge[data-pending] {
  animation: am-pr-pulse 1.5s ease-in-out infinite;
}
@keyframes am-pr-pulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.4;
  }
}

.am-worktree-item-active .am-pr-badge {
  background: color-mix(in srgb, var(--pr-accent) 18%, transparent);
}
.am-worktree-item-active .am-pr-badge:hover {
  background: color-mix(in srgb, var(--pr-accent) 30%, transparent);
}

/* Clickable link icon in hover card to open PR on GitHub */
.am-pr-link {
  display: inline-flex;
  align-items: center;
  margin-right: 3px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 100ms ease;
}
.am-pr-link:hover {
  opacity: 1;
}
.am-pr-link [data-component="icon"] {
  width: 11px;
  height: 11px;
}

.am-worktree-item-active .am-stat-files {
  color: rgba(255, 255, 255, 0.7);
}

.am-worktree-item-active .am-stat-additions {
  color: #6ee7b7;
}

.am-worktree-item-active .am-stat-deletions {
  color: #fca5a5;
}

.am-worktree-commits {
  color: #34d399;
}

.am-worktree-behind {
  color: #f87171;
}

.am-worktree-item-active .am-worktree-commits {
  color: #6ee7b7;
}

.am-worktree-item-active .am-worktree-behind {
  color: #fca5a5;
}

.am-local-item-active .am-worktree-behind {
  color: #fca5a5;
}

.am-local-item:hover .am-worktree-stats,
.am-local-item:hover .am-worktree-stats-skeleton {
  opacity: 0;
}

/* User-defined sections — collapsible, color-coded groups */

.am-section-group {
  margin-top: 2px;
  border-left: 2px solid var(--section-color, var(--vscode-panel-border));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: border-color 120ms;
}

.am-section-group-drop {
  background: color-mix(in srgb, var(--section-color) 10%, transparent);
  border-color: var(--section-color);
  border-style: solid;
}

.am-section-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px 5px 6px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-weak);
}

.am-section-group-header:hover {
  background: var(--surface-interactive-hover, var(--vscode-list-hoverBackground));
}

.am-section-group-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.am-section-group-chevron {
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 120ms ease;
}

.am-section-group-chevron-collapsed {
  transform: rotate(-90deg);
}

.am-section-group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-section-group-count {
  flex-shrink: 0;
  font-size: var(--kilo-font-size-10);
  color: var(--text-weaker);
  min-width: 14px;
  text-align: center;
}

.am-section-group-body {
  padding-left: 4px;
}

.am-section-group-rename {
  background: var(--input-base, var(--vscode-input-background, #3c3c3c));
  color: var(--vscode-input-foreground);
  border: 1px solid var(--border-focus, var(--vscode-focusBorder, #007fd4));
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  outline: none;
  width: 100%;
  min-width: 0;
}

/* Color picker grid in section context menu */

.am-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 8px;
}

.am-color-grid-item {
  padding: 3px !important;
  border-radius: 4px !important;
  min-height: unset !important;
}

.am-color-swatch {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid transparent;
}

.am-color-swatch-active {
  border-color: var(--vscode-foreground);
  box-shadow: 0 0 0 1px var(--vscode-editor-background);
}

.am-color-swatch-default {
  background: var(--vscode-panel-border);
  position: relative;
}

.am-color-swatch-default::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 1.5px;
  background: var(--text-weaker);
  transform: translate(-50%, -50%) rotate(-45deg);
}

.am-color-swatch-sm {
  width: 10px;
  height: 10px;
}

.am-icon-flip {
  transform: rotate(180deg);
}

/* Context menu danger item (delete section) */

.am-ctx-menu-danger {
  color: var(--text-error, var(--vscode-errorForeground, #f44));
}

/* Grouped worktrees — visual grouping with header and left accent */

.am-wt-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 2px;
  margin-top: 6px;
  color: var(--text-weaker);
}

.am-wt-group-header [data-component="icon"] {
  color: var(--border-focus, #007fd4);
  opacity: 0.7;
}

.am-wt-group-label {
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  letter-spacing: 0.2px;
  color: color-mix(in srgb, var(--border-focus, #007fd4) 80%, var(--text-weak));
}

.am-wt-grouped {
  margin-left: 8px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--border-focus, #007fd4) 35%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.am-wt-group-end {
  margin-bottom: 6px;
}

.am-wt-grouped:hover {
  border-left-color: color-mix(in srgb, var(--border-focus, #007fd4) 60%, transparent);
}

.am-wt-grouped.am-worktree-item-active {
  border-left-color: var(--border-focus, #007fd4);
}

/* Session list */

.am-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Session items */

.am-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-base);
  font-family: inherit;
  font-size: var(--font-size-base);
}

.am-item:hover {
  background: var(--surface-inset-base-hover);
}

.am-item:active {
  opacity: 0.8;
}

.am-item-active {
  background: var(--surface-interactive-base);
  color: var(--text-on-interactive-base);
}

.am-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  min-width: 0;
}

.am-item-time {
  font-size: var(--font-size-small);
  white-space: nowrap;
  color: var(--text-weaker);
  flex-shrink: 0;
}

.am-item-active .am-item-time {
  color: var(--text-on-interactive-base);
  opacity: 0.7;
}

/* Promote button on session rows */

.am-item-promote {
  position: absolute;
  right: 4px;
  flex-shrink: 0;
  opacity: 0;
}

.am-item:hover .am-item-time {
  opacity: 0;
}

.am-item:hover .am-item-promote {
  opacity: 1;
}

/* Create worktree button (empty state) */

.am-worktree-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border: 1px dashed var(--border-weak-base);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-weak);
  font-size: var(--kilo-font-size-12);
  cursor: pointer;
  transition:
    background-color 120ms,
    color 120ms;
}

.am-worktree-create:hover {
  background: var(--surface-inset-base-hover);
  color: var(--text-base);
}

.am-worktree-create:active {
  opacity: 0.8;
}

/* Detail pane */

.am-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Tab bar */

.am-tab-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-weak-base);
  background: var(--surface-base);
  height: 36px;
  flex-shrink: 0;
}

.am-tab-leading {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  align-self: stretch;
  padding: 0 4px;
  border-right: 1px solid var(--border-weak-base);
}

.am-tab-list {
  --am-tab-max-width: 240px;
  --am-tab-width: clamp(72px, calc(100% / var(--tab-count, 1)), var(--am-tab-max-width));
  display: flex;
  align-items: stretch;
  flex: 0 1 calc(var(--tab-count, 1) * var(--am-tab-max-width));
  min-width: 0;
  overflow-x: auto;
  height: 100%;

  /* Hide scrollbar while keeping scroll functionality */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.am-tab-list-wrap {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  height: 100%;
}

.am-tab-list::-webkit-scrollbar {
  display: none;
}

/* Wrapper that positions overflow fade indicators */
.am-tab-scroll-area {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: stretch;
  height: 100%;
  overflow: hidden;
}

/* Fixed add-button area after the scrollable tab list */
.am-tab-add-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  align-self: stretch;
  padding-right: 4px;
}

.am-tab-add-separator {
  width: 1px;
  align-self: stretch;
  margin-right: 4px;
  background: var(--border-weak-base);
  flex-shrink: 0;
}

/* Fade indicators for overflow */
.am-tab-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.am-tab-fade-visible {
  opacity: 1;
}

.am-tab-fade-left {
  left: 0;
  background: linear-gradient(to right, var(--surface-base) 0%, transparent 100%);
}

.am-tab-fade-right {
  right: 0;
  background: linear-gradient(to left, var(--surface-base) 0%, transparent 100%);
}

.am-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  background: none;
  color: var(--text-weak);
  font-size: var(--kilo-font-size-12);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom-width: 2px;
  border-radius: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.am-tab:hover,
.am-tab:focus-visible {
  background: var(--button-ghost-hover, var(--surface-base-hover, rgba(128, 128, 128, 0.2)));
  color: var(--text-base);
}

.am-tab-active {
  color: var(--text-base);
  border-bottom-color: var(--surface-interactive-base);
  background: color-mix(in srgb, var(--surface-interactive-base) 10%, transparent);
}

.am-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.am-tab-icon [data-component="icon"] {
  color: currentColor;
}

.am-tab-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-tab-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
}

.am-tab-tooltip[data-component="tooltip-trigger"] {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  flex: 1;
  padding-right: 27px;
  margin-right: -27px;
}

.am-tab-close-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  position: relative;
  z-index: 1;
  transition: opacity 100ms ease;
}

.am-tab:hover .am-tab-close-wrap,
.am-tab-active .am-tab-close-wrap {
  opacity: 1;
  pointer-events: auto;
}

.am-tab-close-wrap:hover {
  opacity: 1;
}

.am-tab-close[data-component="icon-button"] {
  width: 20px;
  height: 20px;
}

.am-tab-close[data-component="icon-button"] [data-slot="icon-svg"] {
  color: var(--text-base);
}

/* Drag-and-drop sortable tab wrapper */

.am-tab-sortable {
  display: flex;
  height: 100%;
  width: var(--am-tab-width);
  min-width: var(--am-tab-width);
  max-width: var(--am-tab-width);
  flex: 0 0 var(--am-tab-width);
  touch-action: none;
  transition:
    flex-basis 140ms ease,
    max-width 140ms ease,
    min-width 140ms ease,
    width 140ms ease;
}

.am-tab-list[data-tab-widths-frozen] .am-tab-sortable,
.am-tab-dragging {
  transition: none;
}

.am-tab-sortable > [data-component="tooltip-trigger"],
.am-tab-sortable > [data-slot="context-menu-trigger"] > [data-component="tooltip-trigger"] {
  height: 100%;
  min-width: 0;
  width: 100%;
}

.am-tab-sortable > .am-tab,
.am-tab-sortable > [data-slot="context-menu-trigger"] > .am-tab {
  height: 100%;
}

.am-tab-dragging {
  opacity: 0.25;
}

/* Drag overlay tab (follows the cursor) */

.am-tab-overlay {
  background: var(--surface-base);
  border: 1px solid var(--border-weak-base);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  color: var(--text-base);
}

/* Drag-and-drop sortable worktree wrapper */

.am-wt-sortable {
  touch-action: none;
  cursor: grab;
}

body.am-wt-dragging-active,
body.am-wt-dragging-active * {
  cursor: grabbing !important;
}

.am-wt-sortable > [data-slot="hover-card-trigger"] {
  width: 100%;
}

.am-wt-dragging {
  opacity: 0.25;
}

/* Drag overlay worktree (follows the cursor) */

.am-wt-overlay {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--surface-base);
  border: 1px solid var(--border-weak-base);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  color: var(--text-base);
  font-size: var(--font-size-small);
  white-space: nowrap;
}

.am-tab-add {
  flex-shrink: 0;
  align-self: center;
}

/* Split-button variant used in the tab bar when the experimental
   terminal tabs feature is active — primary icon + chevron dropdown. */
.am-tab-add-split {
  flex-shrink: 0;
  align-self: center;
}

.am-tab-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  align-self: stretch;
  margin-left: auto;
  padding-left: 6px;
  padding-right: 4px;
  border-left: 1px solid var(--border-weak-base);
}
.am-sidebar-search-trigger {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-weak);
  cursor: pointer;
}

.am-sidebar-search-trigger:hover,
.am-sidebar-search-trigger[data-expanded] {
  background: var(--surface-inset-base-hover);
  color: var(--text-base);
}

.am-sidebar-search-popover[data-component="popover-content"] {
  width: min(360px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - 64px));
  padding: 0;
  overflow: hidden;
}

.am-sidebar-search-popover [data-slot="popover-body"] {
  padding: 0;
}

.am-sidebar-search [data-component="list"] {
  max-height: min(440px, calc(100vh - 88px));
  gap: 0;
  padding: 8px 0 0;
}

.am-sidebar-search [data-slot="list-search-wrapper"] {
  margin: 0 0 4px;
  padding: 0 8px;
}

.am-sidebar-search [data-slot="list-search"] {
  background: var(--surface-inset-base);
}

.am-sidebar-search [data-slot="list-scroll"] {
  max-height: 360px;
  gap: 2px;
  padding: 0 4px;
}

.am-sidebar-search [data-slot="list-group"]:last-child {
  padding-bottom: 4px;
}

.am-sidebar-search [data-slot="list-header"] {
  padding: 7px 8px 4px;
  color: var(--text-weaker);
  font-size: var(--kilo-font-size-10);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.am-sidebar-search [data-slot="list-item"] {
  min-height: 46px;
  padding: 6px 8px;
}

.am-sidebar-search [data-slot="list-item"][data-active="true"],
.am-sidebar-search [data-slot="list-item"][data-selected="true"] {
  background: color-mix(in srgb, var(--text-base) 10%, transparent);
}

.am-sidebar-search-result {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.am-sidebar-search-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: var(--text-weak);
}

.am-sidebar-search-spinner {
  width: 14px;
  height: 14px;
}

.am-sidebar-search-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

.am-sidebar-search-title,
.am-sidebar-search-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-sidebar-search-title {
  color: var(--text-base);
  font-size: var(--kilo-font-size-12);
  font-weight: 500;
  line-height: 1.35;
}

.am-sidebar-search-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-base);
  font-size: var(--kilo-font-size-10);
  font-weight: 400;
  line-height: 1.35;
}

.am-sidebar-search-swatch {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
}

.am-sidebar-search-status,
.am-sidebar-search-count,
.am-sidebar-search-time {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-base);
  font-size: var(--kilo-font-size-10);
  font-weight: 400;
}

.am-sidebar-search-status {
  color: #fbbf24;
  text-transform: uppercase;
}

.am-sidebar-search-count {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--surface-inset-base);
}

/* Empty worktree state */

.am-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.am-empty-state-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  background: var(--surface-inset-base);
  color: var(--text-weaker);
}

.am-empty-state-text {
  font-size: var(--kilo-font-size-15);
  font-weight: 500;
  color: var(--text-weak);
}

/* Read-only session wrapper + banner */

.am-chat-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}

.am-readonly-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-weak-base);
  background: var(--surface-inset-base);
}

.am-readonly-text {
  font-size: var(--font-size-base);
  color: var(--text-weak);
}

/* Diff Panel */

.am-diff-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--text-weak);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 5px;
  font-family: var(--font-mono, monospace);
  font-size: var(--kilo-font-size-10);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  transition:
    background 120ms,
    color 120ms;
}

.am-diff-toggle-btn:hover {
  background: var(--button-ghost-hover, var(--surface-base-hover));
  color: var(--text-base);
}

.am-diff-toggle-btn.am-tab-diff-btn-active {
  background: var(--surface-interactive-base) !important;
  color: var(--text-base) !important;
}

.am-diff-toggle-btn.am-diff-toggle-has-changes {
  color: var(--text-base);
}

.am-diff-toggle-stats {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.am-diff-toggle-btn.am-tab-diff-btn-active .am-stat-files {
  color: rgba(255, 255, 255, 0.7);
}

.am-diff-toggle-btn.am-tab-diff-btn-active .am-stat-additions {
  color: #6ee7b7;
}

.am-diff-toggle-btn.am-tab-diff-btn-active .am-stat-deletions {
  color: #fca5a5;
}

.am-tab-diff-btn-active {
  background: var(--surface-interactive-base) !important;
  color: var(--text-base) !important;
}

.am-detail-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  isolation: isolate;
}

.am-detail-content-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.am-detail-split {
  flex-direction: row;
}

.am-main-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  isolation: isolate;
}

.am-main-pane-terminal-active .am-chat-wrapper {
  opacity: 0;
  pointer-events: none;
}

.am-detail-split .am-main-pane {
  border-right: 1px solid var(--border-weak-base);
}

.am-diff-resize {
  position: relative;
  display: flex;
  flex-shrink: 0;
  min-width: 0;
}

.am-diff-resize > [data-component="resize-handle"]::after {
  background: var(--surface-interactive-base);
}

.am-diff-panel-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.am-diff-panel-wrapper > [data-component="resize-handle"]::after {
  background: var(--surface-interactive-base);
}

.am-diff-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 0;
  --am-diff-count-size: 12px;
}

.am-diff-panel:focus,
.am-review-layout:focus {
  outline: none;
}

.am-diff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 4px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-weak-base);
  position: relative;
  z-index: 20;
  background: var(--surface-base);
}

.am-diff-header-title {
  font-size: var(--font-size-small);
  font-weight: 500;
  color: var(--text-weak);
}

.am-diff-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.am-diff-header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-small);
  color: var(--text-weak);
  white-space: nowrap;
}

.am-diff-header-adds {
  color: var(--syntax-diff-add, #318430);
  font-weight: 500;
}

.am-diff-header-dels {
  color: var(--syntax-diff-delete, #da3319);
  font-weight: 500;
}

.am-diff-header-collapsed,
.am-review-toolbar-collapsed {
  color: var(--text-weaker);
  font-variant-numeric: tabular-nums;
}

.am-diff-header [data-component="radio-group"],
.am-diff-header [data-component="radio-group"] [data-slot="radio-group-item-label"],
.am-diff-header [data-component="radio-group"] [data-slot="radio-group-item-control"] {
  cursor: pointer;
}

.am-diff-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 16px;
  color: var(--text-weak);
  font-size: var(--font-size-base);
}

.am-diff-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--text-weaker);
  font-size: var(--font-size-base);
}

.am-diff-end-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px 34px;
  color: var(--text-weaker);
  pointer-events: none;
  user-select: none;
}

.am-diff-end-mascot-wrap {
  filter: drop-shadow(0 6px 12px color-mix(in oklab, var(--surface-base) 45%, black));
}

.am-diff-end-mascot {
  image-rendering: pixelated;
}

.am-kiloman-upper {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: am-kiloman-idle 520ms linear infinite;
}

.am-diff-end-text {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--text-weak);
}

@keyframes am-kiloman-idle {
  0% {
    transform: translateY(0px);
  }
  25% {
    transform: translateY(1px);
  }
  50% {
    transform: translateY(0px);
  }
  75% {
    transform: translateY(-1px);
  }
  100% {
    transform: translateY(0px);
  }
}

.am-diff-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  cursor: pointer;
}

/* Override session-review defaults that assume a 40px header slot.
   The upstream styles set height:100%, contain:strict, scrollbar-width:none
   on [data-component="session-review"] and --sticky-accordion-top:40px on
   its sticky headers. We don't render the 40px title row so reset to 0. */
.am-diff-content[data-component="session-review"] {
  height: auto;
  contain: none;
  scrollbar-width: auto;
  width: 100%;
}

.am-diff-content[data-component="session-review"] [data-component="sticky-accordion-header"] {
  --sticky-accordion-top: 0px;
}

/* Ensure virtualized accordion rows span the panel without per-row rounded corners. */
.am-diff-content [data-component="accordion"],
.am-review-diff-content [data-component="accordion"] {
  width: 100% !important;
  align-items: stretch !important;
}

.am-diff-content [data-slot="accordion-item"],
.am-review-diff-content [data-slot="accordion-item"],
.am-diff-content [data-slot="accordion-header"],
.am-review-diff-content [data-slot="accordion-header"],
.am-diff-content [data-slot="accordion-trigger"],
.am-review-diff-content [data-slot="accordion-trigger"] {
  width: 100% !important;
  align-self: stretch !important;
}

.am-diff-content [data-slot="accordion-trigger"],
.am-review-diff-content [data-slot="accordion-trigger"],
.am-diff-content [data-slot="accordion-content"],
.am-review-diff-content [data-slot="accordion-content"] {
  border-radius: 0 !important;
}

.am-diff-content [data-slot="accordion-item"][data-file-path],
.am-review-diff-content [data-slot="accordion-item"][data-file-path] {
  width: 100% !important;
  align-self: stretch !important;
}

.am-diff-content [data-slot="accordion-content"],
.am-review-diff-content [data-slot="accordion-content"] {
  width: 100% !important;
}

.am-diff-content [data-component="sticky-accordion-header"],
.am-review-diff-content [data-component="sticky-accordion-header"] {
  width: 100% !important;
  left: 0;
  right: 0;
}

.am-diff-content [data-slot="session-review-trigger-content"],
.am-review-diff-content [data-slot="session-review-trigger-content"] {
  width: 100%;
  min-width: 0;
}

.am-diff-content [data-slot="session-review-file-info"],
.am-review-diff-content [data-slot="session-review-file-info"] {
  min-width: 0;
  flex: 1 1 auto;
  cursor: grab;
}

.am-diff-content [data-slot="session-review-file-info"]:active,
.am-review-diff-content [data-slot="session-review-file-info"]:active {
  cursor: grabbing;
}

.am-diff-content [data-slot="session-review-file-name-container"],
.am-review-diff-content [data-slot="session-review-file-name-container"] {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.am-diff-content [data-slot="session-review-directory"],
.am-review-diff-content [data-slot="session-review-directory"] {
  min-width: 0;
  flex: 0 1 auto;
}

.am-diff-content [data-slot="session-review-filename"],
.am-review-diff-content [data-slot="session-review-filename"] {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-diff-content [data-slot="session-review-trigger-actions"],
.am-review-diff-content [data-slot="session-review-trigger-actions"] {
  flex-shrink: 0;
  min-width: max-content;
  gap: 8px;
}

.am-image-diff {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1px;
  border-top: 1px solid var(--border-weak-base);
  background: var(--border-weak-base);
  cursor: auto;
}

.am-image-diff-pane {
  min-width: 0;
  background: var(--vscode-editor-background, var(--surface-base));
}

.am-image-diff-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-weak-base);
  color: var(--text-weak);
  font-size: var(--font-size-small);
  font-weight: 600;
}

.am-image-diff-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 20px;
  background-color: var(--vscode-editor-background, var(--surface-base));
  background-image: conic-gradient(
    from 90deg at 1px 1px,
    color-mix(in oklab, var(--text-base) 5%, transparent) 25%,
    transparent 0
  );
  background-size: 16px 16px;
  overflow: auto;
}

.am-image-diff-canvas img {
  display: block;
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  box-shadow: 0 8px 28px color-mix(in oklab, black 20%, transparent);
}

.am-diff-panel .am-image-diff-canvas img {
  max-height: 320px;
}

.am-image-diff-message,
.am-image-diff-unavailable {
  color: var(--text-weak);
  font-size: var(--font-size-small);
  text-align: center;
}

.am-image-diff-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 20px;
  border-top: 1px solid var(--border-weak-base);
  background: var(--vscode-editor-background, var(--surface-base));
}

.am-markdown-diff {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--border-weak-base);
  border-top: 1px solid var(--border-weak-base);
  cursor: auto;
}

.am-markdown-diff[data-split="true"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.am-markdown-pane {
  position: relative;
  min-width: 0;
  padding: 16px 20px 24px;
  background: var(--vscode-editor-background, var(--surface-base));
  color: var(--vscode-editor-foreground, var(--text-base));
  overflow-x: auto;
}

.am-markdown-pane[data-comments="true"] {
  padding: 12px 20px 20px 64px;
}

.am-markdown-pane-title {
  margin: -4px 0 12px;
  color: var(--text-weak);
  font-size: var(--font-size-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.am-markdown-pane[data-comments="true"] .am-markdown-pane-title {
  margin: 0 0 12px;
}

.am-markdown-pane [data-component="markdown"] {
  max-width: 900px;
}

.am-markdown-gutter-layer {
  position: absolute;
  inset: 0 auto 0 0;
  width: 56px;
  pointer-events: none;
}

.am-markdown-target {
  position: absolute;
  left: 0;
  width: 56px;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 2px;
  box-sizing: border-box;
  color: var(--text-weak);
  font-family: var(--vscode-editor-font-family, monospace);
  font-size: var(--font-size-small);
  user-select: none;
  pointer-events: auto;
}

.am-markdown-comment-button,
.am-markdown-line-number {
  height: 20px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 20px;
}

.am-markdown-comment-button {
  width: 18px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
}

.am-markdown-target:hover .am-markdown-comment-button,
.am-markdown-comment-button:focus-visible {
  opacity: 1;
}

.am-markdown-comment-button:hover,
.am-markdown-comment-button:focus-visible {
  color: var(--vscode-button-foreground, var(--icon-invert-base, #fff));
  background: var(--vscode-button-background, var(--button-primary-base, var(--icon-interactive-base)));
}

.am-markdown-line-number {
  min-width: 24px;
  padding: 0 4px;
  text-align: right;
  cursor: pointer;
}

.am-markdown-line-number:hover,
.am-markdown-line-number:focus-visible {
  color: var(--text-base);
}

.am-markdown-body {
  min-width: 0;
}

.am-markdown-inline-annotations {
  min-width: 0;
}

.am-markdown-list-annotation {
  list-style: none;
  margin: 0 0 8px;
}

.am-markdown-table-annotation td {
  padding: 0;
  border: none;
}

@media (max-width: 840px) {
  .am-markdown-diff[data-split="true"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep +N/-N indicators at consistent size across side/fullscreen views */
.am-diff-panel [data-component="diff-changes"] [data-slot="diff-changes-additions"],
.am-diff-panel [data-component="diff-changes"] [data-slot="diff-changes-deletions"],
.am-review-layout [data-component="diff-changes"] [data-slot="diff-changes-additions"],
.am-review-layout [data-component="diff-changes"] [data-slot="diff-changes-deletions"] {
  font-size: var(--am-diff-count-size);
  line-height: 1.2;
}

/* Inline annotations (pierre renderAnnotation) */

.am-annotation {
  padding: 6px 10px;
  border: 1px solid var(--border-weak-base);
  border-left: 3px solid var(--surface-interactive-strong);
  border-radius: 0 6px 6px 0;
  margin: 4px 8px;
  background: var(--surface-base);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-base);
}

.am-annotation-draft {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.am-annotation-header {
  font-size: inherit;
  color: var(--text-weak);
  font-weight: 500;
}

.am-annotation-textarea {
  width: 100%;
  padding: 4px 6px;
  font-size: inherit;
  font-family: var(--vscode-editor-font-family, monospace);
  color: var(--text-base);
  background: var(--surface-strong);
  border: 1px solid var(--border-base);
  border-radius: 4px;
  resize: vertical;
  outline: none;
  min-height: 48px;
  box-sizing: border-box;
}

.am-annotation-textarea:focus {
  border-color: var(--border-strong-base);
}

.am-annotation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.am-annotation-speech {
  display: flex;
  align-items: center;
}

.am-annotation-btn {
  padding: 2px 10px;
  font-size: inherit;
  font-family: inherit;
  border-radius: 4px;
  border: 1px solid var(--border-base);
  cursor: pointer;
  background: var(--surface-base);
  color: var(--text-base);
}

.am-annotation-btn:hover {
  background: var(--surface-interactive-base);
}

.am-annotation-btn-submit {
  background: var(--surface-interactive-strong, var(--vscode-button-background, #0078d4));
  color: var(--text-on-fill, var(--vscode-button-foreground, #fff));
  border-color: transparent;
  font-weight: 500;
}

.am-annotation-btn-submit:hover {
  background: var(--surface-interactive-strong-hover, var(--vscode-button-hoverBackground, #0066b8));
}

.am-annotation-comment {
  flex: 1;
  min-width: 0;
}

.am-annotation-comment-text {
  font-size: inherit;
  color: var(--text-base);
  line-height: 1.4;
  word-break: break-word;
}

.am-annotation-comment-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.am-annotation-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-weak);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  vertical-align: middle;
  line-height: 1;
  transition:
    background-color 120ms,
    color 120ms;
}

.am-annotation-icon-btn svg {
  display: block;
}

.am-annotation-icon-btn:hover {
  background: var(--surface-interactive-base);
  color: var(--text-base);
}

/* File comment count badge */

.am-diff-file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  border-radius: 9px;
  background: var(--surface-interactive-strong);
  color: var(--text-on-fill);
  margin-left: 6px;
  flex-shrink: 0;
}

.am-diff-large-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  height: 18px;
  border-radius: 9px;
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  color: color-mix(in oklab, var(--text-warning, #a15c00) 85%, var(--text-base));
  background: color-mix(in oklab, var(--surface-warning, rgba(245, 158, 11, 0.16)) 65%, transparent);
  border: 1px solid color-mix(in oklab, var(--border-warning, rgba(245, 158, 11, 0.45)) 75%, transparent);
  white-space: nowrap;
  flex-shrink: 0;
}

.am-diff-summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  height: 18px;
  border-radius: 9px;
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  color: var(--text-weak);
  background: color-mix(in oklab, var(--surface-interactive-base) 70%, transparent);
  border: 1px solid var(--border-weak-base);
  white-space: nowrap;
  flex-shrink: 0;
}

.am-diff-summary-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  padding: 12px;
  border-top: 1px solid var(--border-weak-base);
  color: var(--text-weak);
  font-size: var(--font-size-small);
}

/* Comments footer bar */

.am-diff-comments-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border-weak-base);
  flex-shrink: 0;
}

.am-diff-comments-count {
  font-size: var(--font-size-small);
  color: var(--text-weak);
}

/* Setup overlay */

.am-setup-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-base);
  animation: am-fade-in 0.15s ease;
}

@keyframes am-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.am-setup-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 400px;
  text-align: center;
}

.am-setup-card > [data-component="icon"] {
  color: var(--text-weak);
  opacity: 0.5;
}

.am-setup-title {
  font-size: var(--font-size-large);
  font-weight: 600;
  color: var(--text-base);
}

.am-setup-branch {
  font-size: var(--kilo-font-size-12);
  color: var(--text-weak);
  font-family: var(--font-family-mono, monospace);
}

.am-setup-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset-base);
  color: var(--text-base);
  font-size: var(--font-size-base);
  text-align: center;
}

.am-setup-spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Confirmation dialog */

.am-confirm {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 24px 16px 24px;
}

.am-confirm-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--font-size-base);
  color: var(--text-base);
  line-height: 1.5;
}

.am-confirm-message > [data-component="icon"] {
  flex-shrink: 0;
  color: var(--icon-critical-base);
  margin-top: 2px;
}

.am-confirm-branch {
  font-family: var(--font-family-mono, monospace);
  font-size: var(--font-size-small);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset-base);
  white-space: nowrap;
}

.am-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.am-confirm-delete {
  background: var(--surface-critical-strong) !important;
  color: var(--text-on-brand-base) !important;
}

.am-confirm-delete:hover {
  opacity: 0.9;
}

/* Keyboard shortcut hint inside buttons */

.am-shortcut-hint {
  font-size: var(--font-size-small);
  opacity: 0.6;
  margin-left: 6px;
}

/* Split button (+ with dropdown arrow) */

.am-split-button {
  display: flex;
  align-items: center;
  gap: 0;
}

.am-split-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-weak);
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0.6;
  transition: all 120ms;
}

.am-split-arrow:hover {
  opacity: 1;
  background: var(--surface-inset-base-hover);
}

.am-split-arrow[data-expanded] {
  opacity: 1;
  background: var(--surface-inset-base-hover);
}

.am-split-menu {
  min-width: 250px;
}

.am-split-menu [data-slot="dropdown-menu-item"] {
  padding: 6px 10px;
}

.am-worktree-menu-gap {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.am-worktree-menu-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.am-worktree-menu-branch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.am-worktree-menu-branch strong {
  font-weight: 600;
}

/* New Versioned Session Dialog */

.am-nv-dialog {
  display: flex;
  flex-direction: column;
  min-width: 460px;
  flex: 1;
  min-height: 0;
}

/* Allow portal-based dropdowns to escape the dialog bounds */
[data-component="dialog"]:has(.am-nv-dialog) [data-slot="dialog-content"] {
  overflow: visible;
  max-height: 85vh;
}

/* Scrollable form content area — keeps submit button always visible */
.am-nv-dialog-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 20px;
}

/* Fixed footer for the submit button */
.am-nv-dialog-footer {
  flex-shrink: 0;
  padding: 14px 20px 20px;
}

.am-nv-name-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  background: var(--surface-base);
  color: var(--text-base);
  font-size: var(--kilo-font-size-13);
  outline: none;
  box-sizing: border-box;
}

.am-nv-name-input:focus {
  border-color: var(--border-focus, #007fd4);
}

.am-nv-name-input::placeholder {
  color: var(--vscode-input-placeholderForeground, var(--text-weaker));
}

/* Dialog overrides for prompt-input-container — resizable from bottom edge */
.am-nv-dialog .am-prompt-input-container {
  margin: 0;
  resize: vertical;
  overflow: hidden;
  min-height: 120px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.am-nv-dialog .am-prompt-input-wrapper {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.am-nv-dialog .am-prompt-input-container:has([class~="model-selector-popover"][data-component="popover-content"]),
.am-nv-dialog-content:has([class~="model-selector-popover"][data-component="popover-content"]),
[data-component="dialog"]:has(.am-nv-dialog [class~="model-selector-popover"][data-component="popover-content"])
  [data-slot="dialog-body"] {
  overflow: visible;
}

.am-nv-dialog .am-prompt-input-ghost-wrapper {
  height: 100%;
}

.am-nv-dialog [class~="prompt-input-hint"] {
  flex-shrink: 0;
}

.am-nv-dialog .am-prompt-input {
  color: var(--vscode-input-foreground, var(--text-base));
  resize: none;
  width: 100%;
  min-height: 100%;
  max-height: none;
}

.am-nv-config-label {
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-weaker);
  white-space: nowrap;
}

/* Version selector bar below the prompt */
.am-nv-version-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Version pills */

.am-nv-pills {
  display: flex;
  gap: 2px;
  background: var(--surface-base);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.am-nv-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  border-radius: calc(var(--radius-sm) - 1px);
  background: transparent;
  color: var(--text-weak);
  font-size: var(--kilo-font-size-12);
  font-weight: 500;
  cursor: pointer;
  transition: all 100ms;
}

.am-nv-pill:hover {
  background: var(--surface-inset-base-hover);
  color: var(--text-base);
}

.am-nv-pill-active {
  background: var(--border-focus, #007fd4) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Version hint text */

.am-nv-version-hint {
  font-size: var(--kilo-font-size-12);
  color: var(--text-weaker);
}

/* Compare mode pill in the version bar */

.am-nv-pill-compare {
  margin-left: 6px;
  width: auto;
  gap: 4px;
  padding: 0 8px;
  border: 1px dashed var(--border-base);
  color: var(--text-weak);
}

.am-nv-pill-compare:hover {
  border-color: var(--border-focus, #007fd4);
  color: var(--text-base);
  background: var(--surface-inset-base-hover);
}

.am-nv-pill-compare-label {
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  white-space: nowrap;
}

/* Compare mode section */

.am-nv-compare-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.am-nv-compare-count {
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  color: var(--text-weaker);
  margin-left: 6px;
}

.am-nv-pill-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-base);
  color: var(--text-weak);
  cursor: pointer;
  transition: all 100ms;
}

.am-nv-pill-back:hover {
  background: var(--surface-inset-base-hover);
  color: var(--text-base);
}

/* Multi-model selector popover */

.am-compare-popover[data-component="popover-content"] {
  max-width: none;
  width: var(--kb-popper-anchor-width);
}

.am-compare-popover [data-slot="popover-body"] {
  padding: 0;
}

.am-mm-wrapper {
  display: flex;
  flex-direction: column;
}

.am-mm-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-base);
  color: var(--text-weaker);
}

.am-mm-search-input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text-base);
  font-size: var(--kilo-font-size-12);
  outline: none;
}

.am-mm-search-input::placeholder {
  color: var(--vscode-input-placeholderForeground, var(--text-weaker));
}

.am-mm-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
}

.am-mm-group-label {
  padding: 6px 10px 2px;
  font-size: var(--kilo-font-size-10);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-weaker);
}

.am-mm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  min-height: 30px;
  transition: background 80ms;
}

.am-mm-item:hover {
  background: var(--surface-inset-base-hover);
}

.am-mm-item-checked {
  background: var(--surface-inset-base-hover);
}

.am-mm-item-disabled {
  opacity: 0.4;
}

.am-mm-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.am-mm-checkbox {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--border-focus);
  cursor: pointer;
}

.am-mm-item-name {
  font-size: var(--kilo-font-size-12);
  color: var(--text-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-mm-free-data {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  max-width: 132px;
  white-space: nowrap;
}

.am-mm-free-badge,
.am-mm-byok-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  font-size: var(--kilo-font-size-10);
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-mm-free-badge {
  color: #fff;
  background: var(--vscode-testing-iconPassed, #4caf50);
}

.am-mm-byok-badge {
  color: var(--vscode-badge-foreground);
  background: var(--vscode-badge-background);
}

.am-mm-free-data-icon {
  display: inline-flex;
  align-items: center;
  color: var(--vscode-inputValidation-warningForeground, var(--vscode-descriptionForeground));
  flex-shrink: 0;
}

.am-mm-count-select {
  flex-shrink: 0;
  padding: 2px 4px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  background: var(--surface-base);
  color: var(--text-base);
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.am-mm-count-select:focus {
  border-color: var(--border-focus);
}

.am-nv-spinner {
  width: 14px;
  height: 14px;
}

.am-nv-submit {
  width: 100%;
  justify-content: center;
}

/* Advanced options toggle */

.am-advanced-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  border: none;
  background: none;
  color: var(--text-weak);
  font-size: var(--kilo-font-size-12);
  cursor: pointer;
  transition: color 100ms;
}

.am-advanced-toggle:hover {
  color: var(--text-base);
}

/* Advanced options section */

.am-advanced-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.am-advanced-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.am-advanced-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  background: var(--surface-base);
  color: var(--text-base);
  font-size: var(--kilo-font-size-12);
  font-family: inherit;
  outline: none;
  transition: border-color 120ms;
}

.am-advanced-input:focus {
  border-color: var(--border-focus, #007fd4);
}

.am-advanced-input::placeholder {
  color: var(--vscode-input-placeholderForeground, var(--text-weaker));
}

/* Branch selector */

.am-branch-badge {
  font-size: var(--kilo-font-size-10);
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-raised-stronger-non-alpha);
  color: var(--text-weak);
  white-space: nowrap;
}

.am-branch-badge-remote {
  background: var(--surface-raised-base);
  opacity: 0.7;
}

.am-branch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--text-base);
  font-size: var(--kilo-font-size-12);
  cursor: pointer;
  transition: background 80ms;
  text-align: left;
}

.am-branch-item:hover {
  background: var(--surface-raised-base-hover);
}

.am-branch-item-active {
  background: var(--surface-raised-base);
}

.am-branch-item-highlighted {
  background: var(--surface-raised-base-hover);
}

/* Keyboard shortcut hints in dropdown menus */

.am-menu-shortcut {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.am-menu-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--surface-raised-stronger-non-alpha);
  color: var(--text-weak);
  font-size: var(--kilo-font-size-10);
  font-family: inherit;
  line-height: 1;
}

.am-branch-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
}

.am-branch-item-time {
  font-size: var(--kilo-font-size-11);
  color: var(--text-weaker);
  white-space: nowrap;
}

/* HoverCard popover for worktree items */

.am-hover-card {
  padding: 10px 12px;
  min-width: 160px;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.am-hover-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.am-hover-card-label {
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-weaker);
  line-height: 1.4;
}

.am-hover-card-branch {
  font-size: var(--kilo-font-size-13);
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.4;
  word-break: break-all;
}

.am-hover-card-meta {
  font-size: var(--kilo-font-size-12);
  color: var(--text-weaker);
  line-height: 1.4;
}

.am-hover-card-keybind {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--surface-inset-base);
  border: 1px solid var(--border-weak-base);
  font-family: var(--font-family-sans);
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  line-height: 1;
  color: var(--text-weak);
  white-space: nowrap;
}

.am-hover-card-divider {
  height: 1px;
  background: var(--border-weak-base);
  margin: 6px 0;
}

.am-hover-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.am-hover-card-row-label {
  font-size: var(--kilo-font-size-12);
  color: var(--text-weaker);
}

.am-hover-card-row-value {
  font-size: var(--kilo-font-size-12);
  font-weight: 500;
  color: var(--text-base);
}

.am-hover-card-diff-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, monospace);
  font-variant-numeric: tabular-nums;
}

.am-hover-card-row-stale {
  align-items: center;
}

.am-hover-card-stale-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-warning, #f59e0b);
  font-weight: 600;
}

.am-hover-card-note {
  margin-top: 4px;
  font-size: var(--kilo-font-size-12);
  line-height: 1.35;
  color: var(--text-weak);
  text-align: left;
}

.am-hover-card-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

.am-hover-card-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-weaker);
  font-size: var(--kilo-font-size-11);
}

.am-hover-card-hint [data-component="icon"] {
  opacity: 0.8;
}

/* Keyboard shortcuts dialog */

.am-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 24px 20px 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.am-shortcuts-category {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.am-shortcuts-category-title {
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-weaker);
  padding: 0 0 4px 0;
}

.am-shortcuts-list {
  border: 1px solid var(--border-weak-base);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.am-shortcuts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 16px;
}

.am-shortcuts-row + .am-shortcuts-row {
  border-top: 1px solid var(--border-weak-base);
}

.am-shortcuts-label {
  font-size: var(--font-size-base);
  color: var(--text-base);
  white-space: nowrap;
}

.am-shortcuts-keys {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.am-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-inset-base);
  border: 1px solid var(--border-weak-base);
  font-family: var(--font-family-sans);
  font-size: var(--kilo-font-size-11);
  font-weight: 500;
  line-height: 1;
  color: var(--text-weak);
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--border-weak-base);
}

/* Skeleton loading states */

@keyframes am-skeleton-pulse {
  0%,
  100% {
    opacity: 0.12;
  }
  50% {
    opacity: 0.28;
  }
}

/* Not a git repo notice */

.am-not-git-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: var(--kilo-font-size-12);
  color: var(--text-weak);
}

.am-skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: am-fade-in 0.2s ease;
}

/* Worktree skeleton — matches .am-worktree-item layout */
.am-skeleton-wt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
}

.am-skeleton-wt-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--text-base);
  animation: am-skeleton-pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.am-skeleton-wt-text {
  height: 13px;
  border-radius: 3px;
  background: var(--text-base);
  animation: am-skeleton-pulse 1.5s ease-in-out infinite;
}

.am-skeleton-wt:nth-child(2) .am-skeleton-wt-icon,
.am-skeleton-wt:nth-child(2) .am-skeleton-wt-text {
  animation-delay: 0.15s;
}

/* Session skeleton — matches .am-item layout */
.am-skeleton-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
}

.am-skeleton-session-title {
  height: 13px;
  border-radius: 3px;
  background: var(--text-base);
  animation: am-skeleton-pulse 1.5s ease-in-out infinite;
}

.am-skeleton-session-time {
  height: 10px;
  width: 52px;
  border-radius: 3px;
  background: var(--text-base);
  animation: am-skeleton-pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.am-skeleton-session:nth-child(2) .am-skeleton-session-title,
.am-skeleton-session:nth-child(2) .am-skeleton-session-time {
  animation-delay: 0.15s;
}

.am-skeleton-session:nth-child(3) .am-skeleton-session-title,
.am-skeleton-session:nth-child(3) .am-skeleton-session-time {
  animation-delay: 0.3s;
}

/* Tab switcher for New/Import tabs in the dialog */

.am-tab-switcher {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
  padding: 0 20px;
  margin-bottom: 4px;
}

.am-tab-switcher-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-weak);
  font-size: var(--kilo-font-size-12);
  font-weight: 500;
  cursor: pointer;
  transition: all 100ms;
}

.am-tab-switcher-pill:hover {
  background: var(--surface-inset-base-hover);
  color: var(--text-base);
}

.am-tab-switcher-pill-active {
  background: var(--surface-interactive-base) !important;
  color: var(--text-on-interactive-base) !important;
}

/* Import tab layout */

.am-import-tab {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
  min-width: 460px;
  max-height: 350px;
  overflow-y: visible;
}

.am-import-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.am-import-divider {
  height: 1px;
  background: var(--border-weak-base);
}

/* PR URL input row */

.am-pr-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.am-pr-input-wrapper {
  flex: 1;
  position: relative;
}

.am-pr-input-wrapper [data-component="icon"] {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-weaker);
  pointer-events: none;
}

.am-pr-input {
  width: 100%;
  height: 32px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border-weak-base);
  border-radius: var(--radius-sm);
  background: var(--vscode-input-background, var(--surface-inset-base));
  color: var(--vscode-input-foreground, var(--text-base));
  font-size: var(--font-size-base);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.am-pr-input:focus {
  border-color: var(--border-focus, #007fd4);
}

.am-pr-input::placeholder {
  color: var(--vscode-input-placeholderForeground, var(--text-weaker));
}

.am-pr-input:disabled {
  opacity: 0.5;
}

/* Branch/worktree selector — popover trigger must be full-width */

.am-selector-wrapper [data-slot="popover-trigger"] {
  display: flex;
  width: 100%;
}

.am-selector-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-weak-base);
  border-radius: var(--radius-sm);
  background: var(--vscode-input-background, var(--surface-inset-base));
  color: var(--text-base);
  font-size: var(--font-size-base);
  font-weight: 400;
  cursor: pointer;
  text-align: left;
}

.am-selector-trigger:hover {
  border-color: var(--text-weaker);
}

.am-selector-trigger:disabled {
  opacity: 0.5;
  cursor: default;
}

.am-selector-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 1;
}

.am-selector-left [data-component="icon"] {
  color: var(--text-weaker);
  flex-shrink: 0;
}

.am-selector-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-base);
}

.am-selector-placeholder {
  color: var(--text-weaker);
}

.am-selector-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}

.am-selector-right [data-component="icon"] {
  color: var(--text-weaker);
}

/* Dropdown popover — must override kilo-ui defaults for max-width and body padding */

.am-dropdown[data-component="popover-content"] {
  max-width: none;
  width: var(--kb-popper-anchor-width);
}

.am-dropdown [data-slot="popover-body"] {
  padding: 0;
}

.am-dropdown-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-weak-base);
}

.am-dropdown-search [data-component="icon"] {
  color: var(--text-weaker);
  flex-shrink: 0;
  opacity: 0.5;
}

.am-dropdown-search-input {
  flex: 1;
  border: none;
  background: none;
  color: var(--vscode-input-foreground, var(--text-base));
  font-size: var(--font-size-base);
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.am-dropdown-search-input::placeholder {
  color: var(--vscode-input-placeholderForeground, var(--text-weaker));
}

.am-dropdown-list {
  max-height: min(320px, var(--kb-popper-content-available-height, 320px) - 44px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
}

/* Branch item in dropdown */

.am-branch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-base);
}

.am-branch-item:hover {
  background: var(--surface-inset-base-hover);
}

.am-branch-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.am-branch-item-left [data-component="icon"] {
  color: var(--text-weaker);
  flex-shrink: 0;
}

.am-branch-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.am-branch-item-time {
  font-size: var(--kilo-font-size-11);
  color: var(--text-weaker);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}

.am-branch-badge {
  font-size: var(--kilo-font-size-10);
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-inset-base);
  color: var(--text-weaker);
  white-space: nowrap;
  flex-shrink: 0;
}

.am-dropdown-empty {
  padding: 16px;
  text-align: center;
  font-size: var(--kilo-font-size-12);
  color: var(--text-weaker);
}

/* Import empty state */

.am-import-empty {
  padding: 20px;
  text-align: center;
  font-size: var(--kilo-font-size-12);
  color: var(--text-weaker);
  line-height: 1.5;
}

/* Diff panel header actions row */

.am-diff-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  min-width: 0;
}

.am-diff-header-actions > * {
  flex-shrink: 0;
}

.am-apply-spinner {
  width: 12px;
  height: 12px;
}

.am-apply-dialog {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 20px 20px 20px;
  box-sizing: border-box;
}

.am-apply-dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.am-apply-dialog-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--kilo-font-size-12);
  color: var(--text-weak);
  font-variant-numeric: tabular-nums;
}

.am-apply-dialog-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.am-apply-dialog-tree {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-weak-base);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.am-apply-dialog-tree .am-file-tree {
  height: 100%;
}

.am-apply-conflicts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid color-mix(in oklab, var(--border-weak-base) 55%, var(--syntax-diff-delete, #da3319));
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--surface-inset-base) 90%, var(--syntax-diff-delete, #da3319));
}

.am-apply-conflicts-title {
  font-size: var(--kilo-font-size-11);
  font-weight: 600;
  color: var(--text-base);
}

.am-apply-conflict {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.am-apply-conflict-file {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--kilo-font-size-11);
  color: var(--text-base);
}

.am-apply-conflict-reason {
  flex: 1;
  min-width: 0;
  text-align: right;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  font-size: var(--kilo-font-size-10);
  color: var(--text-weaker);
}

.am-apply-alert {
  font-size: var(--kilo-font-size-11);
  color: var(--syntax-diff-delete, #da3319);
  line-height: 1.35;
}

.am-apply-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border-weak-base);
  padding-top: 10px;
  flex-shrink: 0;
}

/* Review tab in tab bar */

.am-tab-review {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border-weak-base);
}

.am-tab-review [data-component="icon"] {
  flex-shrink: 0;
  opacity: 0.7;
}

/* Full-screen review tab layout */

.am-review-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  --am-diff-count-size: 12px;
}

/* Review toolbar */

.am-review-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 8px;
  flex-shrink: 0;
  min-width: 0;
  border-bottom: 1px solid var(--border-weak-base);
  background: var(--surface-base);
  gap: 8px;
}

.am-review-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.am-review-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.am-review-toolbar-right > * {
  flex-shrink: 0;
}

.am-review-toolbar [data-component="radio-group"],
.am-review-toolbar [data-component="radio-group"] [data-slot="radio-group-item-label"],
.am-review-toolbar [data-component="radio-group"] [data-slot="radio-group-item-control"] {
  cursor: pointer;
}

.am-review-toolbar
  [data-component="radio-group"]
  [data-slot="radio-group-item-label"]:active
  [data-slot="radio-group-item-control"] {
  transform: translateY(1px);
}

.am-review-toolbar-stats {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 8px;
  font-size: var(--font-size-small);
  color: var(--text-weak);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-review-toolbar-adds {
  color: var(--syntax-diff-add, #318430);
  font-weight: 500;
}

.am-review-toolbar-dels {
  color: var(--syntax-diff-delete, #da3319);
  font-weight: 500;
}

/* Virtual diff panel: file path in toolbar stats area */

.am-review-toolbar-dir {
  color: var(--text-weak);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.am-review-toolbar-fname {
  color: var(--text-base);
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
}

/* Review body: file tree + diff viewer */

.am-review-body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.am-review-host {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.am-review-tree-resize {
  position: relative;
  display: flex;
  flex-shrink: 0;
  min-width: 0;
}

.am-review-tree-wrapper {
  flex: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border-weak-base);
}

.am-review-tree-resize > [data-component="resize-handle"]::after {
  background: var(--surface-interactive-base);
}

.am-review-diff {
  flex: 1;
  width: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-padding-top: 8px;
}

.am-review-diff-content[data-component="session-review"] {
  height: auto;
  contain: none;
  scrollbar-width: auto;
  width: 100%;
  min-width: 0;
}

.am-review-diff-content[data-component="session-review"] [data-component="sticky-accordion-header"] {
  --sticky-accordion-top: 0px;
}

/* Ensure the diff container fills the available width.
   pierre's diffs-container needs explicit width for split mode. */
.am-review-diff diffs-container,
.am-review-diff [data-component="diff"] {
  width: 100%;
  display: block;
}

/* Tighter diff line height in review mode */
.am-review-layout {
  --diffs-line-height: var(--kilo-font-size-20);
}

/* ─── File tree (GitHub-style) ─── */

.am-file-tree {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-size: var(--kilo-font-size-13);
  font-family: var(--font-family-sans, -apple-system, BlinkMacSystemFont, sans-serif);
}

.am-file-tree-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px;
}

.am-file-tree-group {
  display: flex;
  flex-direction: column;
}

/* Shared row base for files and directories */
.am-file-tree-dir,
.am-file-tree-file {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: none;
  background: none;
  color: var(--text-base);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  border-radius: 5px;
  position: relative;
}

.am-file-tree-dir:hover,
.am-file-tree-file:hover {
  background: var(--surface-inset-base-hover, rgba(128, 128, 128, 0.1));
}

/* Directory-specific: slightly muted text */
.am-file-tree-dir {
  color: var(--text-weak);
}

/* Shrink icons to 16px */
.am-file-tree [data-component="file-icon"],
.am-file-tree [data-component="icon"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Directory chevron + folder icon color */
.am-file-tree-dir [data-component="icon"] {
  flex-shrink: 0;
  color: var(--text-weaker);
}

.am-file-tree-dir-highlight > [data-component="icon"]:last-of-type {
  color: var(--surface-interactive-strong);
}

/* Active file — subtle background + left accent bar */
.am-file-tree-active {
  background: var(--surface-base-active, rgba(128, 128, 128, 0.15));
}

.am-file-tree-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--surface-interactive-strong, var(--vscode-focusBorder, #007fd4));
}

.am-file-tree-active:hover {
  background: var(--surface-base-active, rgba(128, 128, 128, 0.15));
}

.am-file-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Color the name for added / deleted files */
.am-file-tree-status-added .am-file-tree-name {
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-status-deleted .am-file-tree-name {
  color: var(--syntax-diff-delete, #da3319);
}

.am-file-tree-status-modified .am-file-tree-name {
  color: var(--text-base);
}

.am-file-tree-check {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-weak-base);
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  background: var(--surface-base);
}

.am-file-tree-check-on {
  border-color: var(--surface-interactive-strong);
  background: color-mix(in oklab, var(--surface-interactive-strong) 18%, var(--surface-base));
  color: var(--surface-interactive-strong);
}

.am-file-tree-check [data-component="icon"] {
  width: 10px;
  height: 10px;
}

.am-file-tree-selected {
  background: color-mix(in oklab, var(--surface-base-active, rgba(128, 128, 128, 0.15)) 72%, transparent);
}

/* Compact +N -N stats pushed to the right */
.am-file-tree-changes {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  font-size: var(--am-diff-count-size);
  font-family: var(--vscode-editor-font-family, monospace);
  line-height: 1;
  color: var(--text-weaker);
}

.am-file-tree-stat-add {
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-stat-del {
  color: var(--syntax-diff-delete, #da3319);
}

/* Status badges for added / deleted files */
.am-file-tree-badge-added {
  font-size: var(--am-diff-count-size);
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in lab, var(--syntax-diff-add, #318430) 15%, transparent);
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-comment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--surface-interactive-strong);
  color: var(--text-on-fill);
  font-size: var(--kilo-font-size-10);
  font-weight: 600;
  line-height: 1;
  margin-left: 6px;
  flex-shrink: 0;
}

.am-file-tree-badge-deleted {
  font-size: var(--am-diff-count-size);
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in lab, var(--syntax-diff-delete, #da3319) 15%, transparent);
  color: var(--syntax-diff-delete, #da3319);
}

/* File tree summary footer */

.am-file-tree-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-weak-base);
  font-size: var(--kilo-font-size-11);
  color: var(--text-weaker);
  flex-shrink: 0;
}

.am-file-tree-summary-adds {
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-summary-dels {
  color: var(--syntax-diff-delete, #da3319);
}

/* ============ Default base branch picker dialog ============ */

.am-default-base-branch {
  min-width: 360px;
}

.am-default-base-branch .am-dropdown-list {
  max-height: 320px;
}

.am-branch-hint {
  margin-left: auto;
  color: var(--text-weaker);
  font-size: var(--kilo-font-size-11);
}

/* ============================================
   High Contrast Theme Support
   --vscode-contrastBorder is only defined in HC themes,
   so transparent fallback keeps normal themes unchanged.
   ============================================ */

body.vscode-high-contrast,
body.vscode-high-contrast-light {
  /* Sidebar panel border */
  .am-sidebar {
    border-right-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Sidebar items */
  .am-local-item,
  .am-worktree-item,
  .am-item {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  .am-local-item-active,
  .am-worktree-item-active,
  .am-item-active {
    border-color: var(--vscode-contrastBorder, transparent);
  }

  /* Create worktree button */
  .am-worktree-create {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Tab bar */
  .am-tab-bar {
    border-bottom-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  .am-tab {
    border: 1px solid transparent;
  }

  .am-tab-active {
    border-color: var(--vscode-contrastBorder, transparent);
    border-bottom-color: var(--surface-interactive-base);
  }

  .am-tab-overlay {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Inputs and textareas */
  .am-worktree-rename-input,
  .am-nv-name-input,
  .am-advanced-input,
  .am-pr-input,
  .am-annotation-textarea {
    border-color: var(--vscode-contrastBorder, var(--border-base));
  }

  .am-worktree-rename-input:focus,
  .am-nv-name-input:focus,
  .am-advanced-input:focus,
  .am-pr-input:focus,
  .am-annotation-textarea:focus {
    border-color: var(--vscode-contrastActiveBorder, var(--vscode-focusBorder));
  }

  /* Selector trigger (dropdown button) */
  .am-selector-trigger {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Annotation buttons */
  .am-annotation-btn {
    border-color: var(--vscode-contrastBorder, var(--border-base));
  }

  .am-annotation-icon-btn {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  /* Version pills */
  .am-nv-pill,
  .am-tab-switcher-pill {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  .am-nv-pill-active {
    border-color: var(--vscode-contrastBorder, transparent) !important;
  }

  .am-tab-switcher-pill-active {
    border-color: var(--vscode-contrastBorder, transparent) !important;
  }

  /* Diff toggle button */
  .am-diff-toggle-btn {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  /* Diff panel header */
  .am-diff-header {
    border-bottom-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Inline annotations */
  .am-annotation {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Multi-model checkbox */
  .am-mm-checkbox {
    outline: 1px solid var(--vscode-contrastBorder, transparent);
  }

  /* Multi-model count select */
  .am-mm-count-select {
    border-color: var(--vscode-contrastBorder, var(--border-base));
  }

  /* Advanced toggle */
  .am-advanced-toggle {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  /* Keyboard shortcut keys */
  .am-kbd {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Split arrow */
  .am-split-arrow {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  /* Read-only banner */
  .am-readonly-banner {
    border-top-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Shortcuts list */
  .am-shortcuts-list {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  .am-shortcuts-row + .am-shortcuts-row {
    border-top-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Branch items */
  .am-branch-item {
    border: 1px solid var(--vscode-contrastBorder, transparent);
  }

  .am-branch-item:hover {
    border-color: var(--vscode-contrastBorder, transparent);
  }

  /* Apply dialog tree */
  .am-apply-dialog-tree {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Hover card keybind */
  .am-hover-card-keybind {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* File tree items */
  .am-file-tree-dir,
  .am-file-tree-file {
    border: 1px solid transparent;
  }

  .am-file-tree-active {
    border-color: var(--vscode-contrastBorder, transparent);
  }

  .am-file-tree-check {
    border-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* File tree summary */
  .am-file-tree-summary {
    border-top-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Review toolbar */
  .am-review-toolbar {
    border-bottom-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Review tree wrapper */
  .am-review-tree-wrapper {
    border-right-color: var(--vscode-contrastBorder, var(--border-weak-base));
  }

  /* Focus states */
  .am-local-item:focus-visible,
  .am-worktree-item:focus-visible,
  .am-item:focus-visible,
  .am-tab:focus-visible,
  .am-worktree-create:focus-visible,
  .am-nv-pill:focus-visible,
  .am-tab-switcher-pill:focus-visible,
  .am-diff-toggle-btn:focus-visible,
  .am-branch-item:focus-visible,
  .am-file-tree-dir:focus-visible,
  .am-file-tree-file:focus-visible {
    outline: 1px solid var(--vscode-contrastActiveBorder, var(--vscode-focusBorder));
    outline-offset: -1px;
  }
}

/* Context menu — restyle to match dropdown-menu visuals.
   The kilo-ui ContextMenu component hardcodes its own data-component / data-slot
   attributes after the prop spread, so we can't override them via props.
   Instead we apply a class and re-declare the styles here. */

.am-ctx-menu {
  min-width: 210px;
  border: 1px solid color-mix(in oklch, var(--border-base) 50%, transparent) !important;
  box-shadow: var(--shadow-md) !important;

  [data-slot="context-menu-item"],
  [data-slot="context-menu-checkbox-item"],
  [data-slot="context-menu-radio-item"],
  [data-slot="context-menu-sub-trigger"] {
    padding: 6px 10px;
    font-size: var(--font-size-small);
    transition: none;

    &:hover,
    &[data-highlighted] {
      background: var(--surface-raised-base-hover);
    }
  }

  [data-slot="context-menu-separator"] {
    margin: 4px 0;
  }
}

/* Experimental terminal tabs (feature-flagged) */

.am-tab-terminal {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border-weak-base);
}

.am-tab-terminal [data-component="icon"] {
  flex-shrink: 0;
  opacity: 0.7;
}

/*
 * Stacking layout for xterm terminal tabs.
 *
 * The hydration invariant (see the render helpers under `terminal/`) requires that
 * xterm canvases never leave the paint tree. Both the layer and each
 * terminal slot therefore use absolute-positioning + opacity for
 * visibility — NEVER `display: none`, because that would detach the
 * subtree and stop xterm's internal rAF render loop, causing the
 * "press Enter to see content" bug on worktree switches.
 *
 * Stack:  position:relative container hosting the main pane, review,
 *         and side panel. Sits below the tab bar inside `.am-detail`.
 * Layer:  absolute-positioned overlay covering the main pane.
 *         `pointer-events: none` when no terminal is active, letting
 *         clicks fall through to the chat behind it.
 * Slots:  absolute-positioned and stacked inside the layer; only the
 *         active one is opaque and receives pointer events.
 */

.am-detail-stack {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.am-terminal-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: var(--vscode-terminal-background, #1e1e1e);
  z-index: 30;
  /* Force a dedicated compositor layer so opacity flips do not re-lay-out
     the xterm canvases underneath. */
  will-change: opacity;
}

.am-terminal-layer-active {
  opacity: 1;
  pointer-events: auto;
}

.am-terminal-slot {
  position: absolute;
  inset: 0;
  display: flex;
  min-height: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.am-terminal-slot-visible {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.am-terminal-host {
  flex: 1;
  min-height: 0;
  min-width: 0;
  padding: 8px;
  background: var(--vscode-terminal-background, #1e1e1e);
}

/* Third-party xterm classes — addressed by attribute selector so the
   agent-manager "am-* prefix" architecture test does not flag them. */
.am-terminal-host [class="xterm"] {
  height: 100%;
}

.am-terminal-host [class~="xterm-viewport"] {
  background: transparent !important;
}
