  /* ── Agent Grid ── */
  .agent-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    transition: width 0.2s, min-width 0.2s;
  }
  .sidebar-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
  }
  .sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }
  .agent-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right: none;
    overflow: hidden;
  }
  .agent-sidebar.collapsed > *:not(.sidebar-toggle) { display: none; }
  .agent-sidebar.collapsed .sidebar-toggle {
    position: fixed;
    top: 52px;
    left: 4px;
    right: auto;
  }
  .agent-list {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }

  .agent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .agent-card:hover { border-color: var(--accent); }
  .agent-card.selected { border-color: var(--accent); background: #1c2333; }
  .agent-card.flash { animation: flash-card 0.6s ease; }
  .agent-group-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    padding: 8px 4px 2px;
    margin-top: 4px;
    cursor: grab;
    border-radius: 4px;
    transition: background 0.15s;
  }
  .agent-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .group-chevron {
    font-size: 10px;
    margin-right: 4px;
    transition: transform 0.15s;
    display: inline-block;
  }
  .agent-group-header.collapsed .group-chevron { transform: rotate(-90deg); }
  .group-actions {
    display: flex;
    gap: 2px;
  }
  .group-actions button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 11px;
    padding: 1px 4px;
    border-radius: 3px;
  }
  .group-actions button:hover { color: var(--accent); background: rgba(88,166,255,0.1); }
  .group-actions .group-delete:hover { color: var(--red); background: rgba(248,81,73,0.1); }
  .agent-group-header.dragging { opacity: 0.4; }
  .agent-group-header.drag-over {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    box-shadow: 0 0 0 1px var(--accent);
  }
  .agent-group-header.drag-over-above { box-shadow: 0 -2px 0 var(--accent); }
  .agent-group-header.drag-over-below { box-shadow: 0 2px 0 var(--accent); }
  .agent-card[draggable="true"] { cursor: grab; }
  .filtered .agent-card[draggable="true"] { cursor: pointer; }
  .agent-card.dragging { opacity: 0.4; }
  .agent-card.drag-over-above { box-shadow: 0 -2px 0 var(--accent); }
  .agent-card.drag-over-below { box-shadow: 0 2px 0 var(--accent); }
  .drag-handle { display: none; }

  @keyframes flash-card {
    0%,100% { background: var(--surface); }
    50% { background: #1a2a1a; }
  }

  .agent-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
  }
  .agent-badges {
    margin-left: auto;
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
  }
  .agent-star {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
    color: var(--text-dim);
    opacity: 0.3;
    transition: opacity 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
  }
  .agent-star.starred { opacity: 0.8; color: #f5c518; }
  .agent-icon {
    font-size: 14px;
    margin-right: 4px;
  }
  .agent-name { font-weight: 600; font-size: 14px; }
  .state-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .state-active   { background: rgba(63,185,80,0.15); color: var(--green); }
  .state-idle     { background: rgba(139,148,158,0.15); color: var(--text-dim); }
  .state-spawning { background: rgba(88,166,255,0.15); color: var(--accent); }
  .state-suspended { background: rgba(210,153,34,0.15); color: var(--yellow); }
  .state-failed   { background: rgba(248,81,73,0.15); color: var(--red); }
  .state-suspending { background: rgba(88,166,255,0.15); color: var(--accent); }
  .state-resuming  { background: rgba(88,166,255,0.15); color: var(--accent); }
  .state-void     { background: rgba(139,148,158,0.1); color: var(--text-dim); }

  .agent-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 2px;
  }
  .agent-meta span { display: flex; align-items: center; gap: 4px; }

  .agent-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .agent-actions button {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
  }
  .agent-actions button:hover { border-color: var(--accent); color: var(--accent); }
  .agent-actions button.danger:hover { border-color: var(--red); color: var(--red); }
  /* ── Unread Badge ── */
  .unread-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 6px;
  }

  .version-mismatch {
    color: #e8a735;
    font-size: 10px;
    font-weight: 600;
  }
  .perm-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .perm-badge.skip {
    background: rgba(231,76,60,0.15);
    color: #e74c3c;
  }

  /* ── Create Agent Button ── */
  .create-agent-btn {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-align: left;
    margin: 8px 12px;
    box-sizing: border-box;
    width: calc(100% - 24px);
  }
  .create-agent-btn:hover { color: var(--accent); border-color: var(--accent); }
  /* ── Button loading state ── */
  .agent-actions button.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
  }
  .agent-actions button.loading::after {
    content: '';
    width: 10px; height: 10px;
    border: 2px solid var(--text-dim);
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
  }
  @keyframes btn-spin {
    to { transform: rotate(360deg); }
  }


  /* ── Agent failure reason ── */
  .agent-failure {
    font-size: 11px;
    color: var(--red);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* ── Search Input ── */
  .agent-search {
    position: relative;
    padding: 8px 12px;
  }
  .agent-search input {
    width: 100%;
    padding: 8px 30px 8px 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
  }
  .agent-search input:focus { border-color: var(--accent); }
  .agent-search .search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-dim);
    pointer-events: none;
  }
  .agent-search .search-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-dim);
    cursor: pointer;
    display: none;
    background: none;
    border: none;
    padding: 2px 4px;
    line-height: 1;
  }
  .agent-search .search-clear:hover { color: var(--text); }
  .filter-chips {
    display: flex;
    gap: 6px;
    padding: 0 12px 8px;
    flex-wrap: wrap;
    -webkit-user-select: none;
    user-select: none;
  }
  .filter-chip {
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .filter-chip:hover { border-color: var(--accent); color: var(--accent); }
  .filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
