/* Component Library */

/* Agent Card */
.agent-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--duration-normal) var(--ease-default);
  position: relative;
  overflow: hidden;
}

.agent-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Status conveyed via inline badges/dots, not border bars */

.agent-card[data-status="stopped"] {
  opacity: 0.6;
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.agent-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

.agent-role {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  text-transform: capitalize;
}

.agent-specialty {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
  line-height: var(--line-tight);
}

.agent-skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.skill-badge {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

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

.agent-indicators {
  display: flex;
  gap: var(--space-2);
}

.indicator {
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-tertiary);
}

.indicator.active {
  color: var(--color-accent-primary);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* Status Badge */
.status-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.running {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-badge.idle {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning, #f59e0b);
}

.status-badge.error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.status-badge.stopped {
  background: var(--color-bg-tertiary);
  color: var(--color-text-tertiary);
  opacity: 0.7;
}

/* Agent Grid */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
  padding: var(--space-6);
}

@media (max-width: 768px) {
  .agent-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-4);
  }
}

/* Topology Graph Container */
.topology-container {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-6);
  min-height: 500px;
}

.topology-graph {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-tertiary);
}

.empty-state-icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-base);
  color: var(--color-text-tertiary);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-secondary) 0%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  height: 200px;
}

/* Navigation */
/* ─── Sidebar Navigation ──────────────────────────── */

.nav-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100dvh;
  background: var(--color-bg-primary);
  border-right: 1px solid var(--color-border-default);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: var(--z-sticky);
  padding: var(--space-4) 0;
}

.nav-group {
  margin-bottom: var(--space-2);
}

.nav-group-label {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-5);
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  border: none;
  background: none;
  text-align: left;
  border-right: 3px solid transparent;
}

.nav-item:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
}

.nav-item.active {
  color: var(--color-accent-primary);
  background: rgba(99, 102, 241, 0.08);
  border-right-color: var(--color-accent-primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
}

.nav-footer .nav-item:hover {
  color: var(--color-error);
  background: var(--color-error-bg);
}

/* Hamburger — hidden on desktop, shown on mobile */
.nav-hamburger {
  display: none;
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: calc(var(--z-sticky) + 2);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-primary);
}

/* Backdrop overlay for mobile drawer */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sticky) - 1);
}

.nav-backdrop.open {
  display: block;
}

/* Main content offset for sidebar */
#app-content {
  margin-left: 240px;
}

/* ─── Mobile sidebar drawer ──────────────────────── */
@media (max-width: 768px) {
  .nav-sidebar {
    transform: translateX(-100%);
    transition: transform var(--duration-normal) var(--ease-default);
    z-index: calc(var(--z-sticky) + 1);
  }

  .nav-sidebar.open {
    transform: translateX(0);
  }

  .nav-hamburger {
    display: flex;
  }

  #app-content {
    margin-left: 0;
    /* Space for hamburger row */
    padding-top: 52px;
  }
}

/* Header */
.dashboard-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
}

.dashboard-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.dashboard-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

/* Section Header */
.section-header {
  padding: var(--space-6) var(--space-6) var(--space-4);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.section-description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* WebSocket Status Indicator */
.ws-status {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  z-index: var(--z-toast);
}

.ws-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-status-stopped);
}

.ws-status.connected .ws-status-dot {
  background: var(--color-status-running);
  animation: pulse 2s ease-in-out infinite;
}

.ws-status.connecting .ws-status-dot {
  background: var(--color-warning);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.app-version {
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  margin-left: var(--space-2);
  padding-left: var(--space-2);
  border-left: 1px solid var(--color-border-default);
}

/* Skill Registry Components */
.skill-list {
  padding: 0 var(--space-6) var(--space-6);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .skill-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

.skill-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--duration-normal) var(--ease-default);
}

.skill-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.skill-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.skill-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

.skill-version {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

.skill-description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-normal);
}

/* Skill Mapping Components */
.skill-mapping {
  padding: 0 var(--space-6) var(--space-6);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .mapping-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

.mapping-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--duration-normal) var(--ease-default);
}

.mapping-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-tertiary);
}

.mapping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
}

.skill-count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--weight-medium);
}

.mapping-skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Terminal Page */
.terminal-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-accent-primary);
  margin-bottom: var(--space-2);
}
.terminal-back-link:hover {
  color: var(--color-accent-primary-hover);
}

.terminal-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  margin: var(--space-4) var(--space-6);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-primary);
}

.terminal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-default);
}

.terminal-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.terminal-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-status-stopped);
}

.terminal-status.connected .terminal-status-dot {
  background: var(--color-status-running);
}

.terminal-status.disconnected .terminal-status-dot {
  background: var(--color-status-error);
}

.terminal-status.reconnecting .terminal-status-dot {
  background: var(--color-warning);
  animation: pulse 1s ease-in-out infinite;
}

.terminal-status.error .terminal-status-dot {
  background: var(--color-status-error);
}

.terminal-viewport {
  flex: 1;
  padding: var(--space-2);
  overflow: hidden;
}

.terminal-viewport .xterm {
  height: 100%;
}

.dashboard-subtitle code {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent-primary);
}

/* API Keys Page */

/* Scope Selector */
.scope-selector {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-default);
}

.scope-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.scope-btn:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-border-strong);
}

.scope-btn.active {
  color: var(--color-accent-primary);
  background: var(--color-info-bg);
  border-color: var(--color-accent-primary);
}

.scope-org-select {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.scope-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.scope-dropdown {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  min-width: 200px;
}

.scope-dropdown:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

/* Key Cards */
.key-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  padding: var(--space-6);
}

@media (max-width: 768px) {
  .key-cards-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-4);
  }
}

.key-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-default);
}

.key-card:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-tertiary);
}

/* Key status conveyed via inline badges, not border bars */

.key-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.key-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.key-card-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.key-card-value.empty {
  color: var(--color-text-tertiary);
  font-style: italic;
  font-family: var(--font-sans);
}

.source-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.source-badge.platform {
  background: var(--color-bg-elevated);
  color: var(--color-text-tertiary);
}

.source-badge.org {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.source-badge.user {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.key-card-actions {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
}

.key-card-actions button {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  width: auto;
}

.key-btn-primary,
.key-btn-ghost,
.key-btn-danger {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--line-normal);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.key-btn-primary {
  background: transparent;
  color: var(--color-accent-primary);
  border: 1px solid var(--color-accent-primary);
}

.key-btn-primary:hover {
  background: rgba(194, 104, 46, 0.1);
  color: var(--color-accent-primary-hover);
  border-color: var(--color-accent-primary-hover);
}

.key-btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-subtle);
}

.key-btn-ghost:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-secondary);
}

.key-btn-danger {
  background: transparent;
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

.key-btn-danger:hover {
  background: var(--color-error-bg);
}

/* User Overrides Table */
.user-overrides-section {
  padding: 0 var(--space-6) var(--space-6);
}

.user-overrides-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.user-overrides-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-tertiary);
}

.user-overrides-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-subtle);
}

.user-overrides-table tr:last-child td {
  border-bottom: none;
}

.user-overrides-table tr:hover td {
  background: var(--color-bg-tertiary);
}

.override-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.override-badge {
  font-size: var(--text-xs);
  padding: 0.1rem var(--space-2);
  background: var(--color-info-bg);
  color: var(--color-info);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.no-overrides {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

/* Key Modal */
.key-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

.key-modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
}

.key-modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.key-modal-scope {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-6);
}

.key-input-group {
  margin-bottom: var(--space-6);
}

.key-input-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.key-input-wrapper {
  display: flex;
  gap: 0;
}

.key-input-wrapper input {
  flex: 1;
  padding: var(--space-3);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.key-input-wrapper input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

.key-input-reveal {
  padding: var(--space-3);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-default);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: var(--text-sm);
  width: auto;
}

.key-input-reveal:hover {
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
}

.key-modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

.key-modal-actions button {
  padding: var(--space-2) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  width: auto;
}

.key-modal-cancel {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-default);
}

.key-modal-cancel:hover {
  background: var(--color-bg-elevated);
}

.key-modal-save {
  background: var(--color-accent-primary);
  color: #fff;
  border: none;
}

.key-modal-save:hover {
  background: var(--color-accent-primary-hover);
}

/* Scout Credentials */
.cred-table-wrap {
  padding: var(--space-6);
}

.cred-provider-name {
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  display: block;
}

.cred-provider-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.cred-status {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cred-status-active {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.cred-status-empty {
  background: rgba(148, 163, 184, 0.15);
  color: var(--color-text-tertiary);
}

.cred-status-expired {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error);
}

.cred-empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-tertiary);
}

.cred-empty p:first-child {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.cred-textarea {
  width: 100%;
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  resize: vertical;
}

.cred-textarea:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 2px rgba(194, 104, 46, 0.15);
}

.cred-kv-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.cred-kv-key,
.cred-kv-val {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}

.cred-kv-key:focus,
.cred-kv-val:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

.cred-kv-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

.cred-loading {
  text-align: center;
  color: var(--color-text-tertiary);
  padding: var(--space-6);
}

/* Access Denied */
.access-denied {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--color-text-tertiary);
}

.access-denied-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.access-denied-description {
  font-size: var(--text-base);
}

/* Welcome Overlay */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-default);
}

.welcome-overlay.visible {
  opacity: 1;
}

.welcome-modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 520px;
  width: 90vw;
  padding: var(--space-8);
  transform: translateY(12px);
  transition: transform var(--duration-normal) var(--ease-out);
}

.welcome-overlay.visible .welcome-modal {
  transform: translateY(0);
}

.welcome-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.welcome-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.welcome-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.welcome-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.welcome-feature {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.welcome-feature-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent-primary);
  margin-bottom: var(--space-1);
}

.welcome-feature-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: var(--line-relaxed);
}

.welcome-tips {
  background: var(--color-info-bg);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: var(--line-relaxed);
}

.welcome-tips code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--color-bg-elevated);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.35rem;
  color: var(--color-accent-primary);
}

.welcome-cta {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-6);
  background: var(--color-accent-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast) var(--ease-default);
  cursor: pointer;
  border: none;
}

.welcome-cta:hover {
  background: var(--color-accent-primary-hover);
}

@media (max-width: 480px) {
  .welcome-features {
    grid-template-columns: 1fr;
  }
  .welcome-modal {
    padding: var(--space-6);
  }
}

/* Settings / Profile Page */
.settings-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 600px;
}

.settings-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.settings-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.settings-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.settings-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.settings-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-value {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.settings-upgrade-link {
  font-size: var(--text-sm);
  color: var(--color-accent);
  text-decoration: none;
  margin-left: var(--space-2);
}
.settings-upgrade-link:hover {
  text-decoration: underline;
}

.settings-form {
  margin-top: var(--space-2);
}

.settings-input-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.settings-input-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-input {
  flex: 1;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.settings-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

.settings-input::placeholder {
  color: var(--color-text-tertiary);
}

.settings-save-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-default);
}

.settings-save-btn:hover {
  background: var(--color-accent-primary-hover);
}

.settings-msg {
  font-size: var(--text-xs);
  margin-top: var(--space-2);
  min-height: 1.25rem;
}

.settings-msg.success {
  color: var(--color-success);
}

.settings-msg.error {
  color: var(--color-error);
}

@media (max-width: 480px) {
  .settings-field-grid {
    grid-template-columns: 1fr;
  }
  .settings-input-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ──────────────────────────────────────────────
   Org Chart
   ────────────────────────────────────────────── */

.org-chart-container {
  padding: 0 var(--space-6) var(--space-6);
  overflow-x: auto;
}

.org-chart-loading {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-tertiary);
}

.org-chart {
  display: flex;
  gap: var(--space-8);
  justify-content: center;
  align-items: flex-start;
  min-width: max-content;
  padding: var(--space-4) 0;
}

.org-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org-connector-line {
  width: 2px;
  height: var(--space-6);
  background: var(--color-border-default);
}

.org-children {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
  max-width: 800px;
  position: relative;
  padding-top: var(--space-2);
  border-top: 2px solid var(--color-border-default);
}

/* Org Node — compact card */
.org-node {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  min-width: 120px;
  max-width: 160px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  position: relative;
}

.org-node:hover {
  border-color: var(--color-accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.org-node[data-status="stopped"] {
  opacity: 0.5;
}

.org-coordinator {
  border-color: var(--color-accent-primary);
  border-width: 2px;
  min-width: 150px;
}

.org-unmanaged-header {
  background: var(--color-bg-tertiary);
  border-style: dashed;
  cursor: default;
}

.org-unmanaged-header:hover {
  transform: none;
  box-shadow: none;
}

.org-node-status {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}

.org-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.org-node-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-1);
}

.org-node-icon svg {
  width: 14px;
  height: 14px;
  color: #fff;
}

.org-node-name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
  word-break: break-all;
}

.org-node-role {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-transform: capitalize;
  margin-bottom: var(--space-1);
}

.org-node-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.org-node-tokens {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

/* Location Badges (shared) */
.loc-badge {
  font-size: 0.6rem;
  font-weight: var(--weight-bold);
  padding: 1px var(--space-1);
  border-radius: 3px;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.loc-badge.internal {
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.loc-badge.external {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.1);
  border: 1px dashed rgba(251, 146, 60, 0.5);
}

/* Model badge/dot */
.model-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.model-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

/* ──────────────────────────────────────────────
   Roster Table
   ────────────────────────────────────────────── */

.roster-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.roster-controls {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding-right: var(--space-6);
}

.roster-filter-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.roster-checkbox {
  accent-color: var(--color-accent-primary);
}

.roster-table-wrap {
  padding: 0 var(--space-6) var(--space-6);
  overflow-x: auto;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: var(--text-sm);
}

.roster-th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-tertiary);
  white-space: nowrap;
  user-select: none;
}

.roster-th.sortable {
  cursor: pointer;
}

.roster-th.sortable:hover {
  color: var(--color-text-secondary);
}

.sort-icon {
  font-size: 0.6rem;
  color: var(--color-text-tertiary);
  margin-left: 2px;
}

.sort-icon.active {
  color: var(--color-accent-primary);
}

.roster-row {
  cursor: pointer;
  transition: background var(--duration-fast);
  border-bottom: 1px solid var(--color-border-subtle);
}

.roster-row:hover {
  background: var(--color-bg-tertiary);
}

.roster-row[data-status="stopped"] {
  opacity: 0.5;
}

.roster-row:last-child {
  border-bottom: none;
}

/* Internal/External indicated by INT/EXT badge, not border */

.roster-td {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-primary);
  white-space: nowrap;
}

.roster-name {
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.roster-status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

.roster-role {
  text-transform: capitalize;
  color: var(--color-text-secondary);
}

.roster-project {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.roster-num {
  font-family: var(--font-mono);
  text-align: right;
}

.roster-time {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

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

/* Sparkline */
.sparkline {
  vertical-align: middle;
}

/* ──────────────────────────────────────────────
   Agent Detail Panel (shared)
   ────────────────────────────────────────────── */

.detail-agent-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0;
  flex-wrap: wrap;
}

.detail-agent-role {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-transform: capitalize;
  margin-top: var(--space-1);
}

.detail-project-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

/* Utilization */
.detail-util-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.detail-util-stat {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}

.detail-util-value {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.detail-util-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.detail-spark-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.detail-spark-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* Activity */
.detail-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.detail-activity-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.detail-activity-row:last-child {
  border-bottom: none;
}

.detail-activity-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  min-width: 3rem;
  flex-shrink: 0;
}

.detail-activity-action {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* Personality */
.detail-personality {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-relaxed);
  margin-bottom: var(--space-3);
  font-style: italic;
}

.detail-skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Managed agents list */
.detail-managed-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.detail-managed-agent {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}


.detail-managed-agent[data-status="stopped"] {
  opacity: 0.5;
}

/* Responsive org chart */
@media (max-width: 768px) {
  .org-chart {
    flex-direction: column;
    align-items: center;
  }

  .org-children {
    max-width: 100%;
  }

  .roster-controls {
    padding-right: var(--space-4);
  }

  .roster-table-wrap {
    padding: 0 var(--space-4) var(--space-4);
  }
}

/* ──────────────────────────────────────────────
   Trust & Security Page
   ────────────────────────────────────────────── */

/* Sub-tabs within the page */
.trust-sub-tabs {
  display: flex;
  gap: var(--space-1);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-secondary);
}

.trust-sub-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--duration-fast) var(--ease-default);
  cursor: pointer;
}

.trust-sub-tab:hover {
  color: var(--color-text-secondary);
}

.trust-sub-tab.active {
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
}

/* Projects List */
.trust-projects-list {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Project Group Card */
.project-group {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: border-color var(--duration-normal) var(--ease-default);
}

.project-group:hover {
  border-color: var(--color-border-strong);
}

.project-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  gap: var(--space-4);
}

.project-group-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.project-group-chevron {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  width: 1rem;
  text-align: center;
}

.project-group-name {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.project-group-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  flex-wrap: wrap;
}

.meta-sep {
  color: var(--color-text-tertiary);
}

.project-group-body {
  margin-top: var(--space-5);
}

/* Agent grid within a project */
.project-agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}

@media (max-width: 768px) {
  .project-agent-grid {
    grid-template-columns: 1fr;
  }
}

/* Trust-specific agent card additions */
.trust-agent-card {
  cursor: pointer;
}

.trust-tiers {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.tier-sep {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.trust-detail-hint {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.trust-agent-card:hover .trust-detail-hint,
.trust-agent-card:focus .trust-detail-hint {
  opacity: 1;
}

/* Tier Badges */
.tier-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.tier-badge-sm {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: var(--weight-semibold);
  padding: 0.125rem var(--space-1);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.tier-badge.tier-0,
.tier-badge-sm.tier-0 {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
}

.tier-badge.tier-2,
.tier-badge-sm.tier-2 {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

.tier-badge.tier-3,
.tier-badge-sm.tier-3 {
  color: #facc15;
  background: rgba(250, 204, 21, 0.1);
}

.tier-badge.tier-4,
.tier-badge-sm.tier-4 {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.1);
}

.tier-badge.tier-5,
.tier-badge-sm.tier-5 {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

/* Intra-project Trust Flows */
.trust-flows-section {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}

.trust-flows-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.trust-flows-empty {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.trust-flow-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.trust-flow-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.trust-flow-agent {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  min-width: 6rem;
}

.trust-flow-arrow {
  display: flex;
  align-items: center;
  gap: 0;
}

.trust-flow-line {
  display: inline-block;
  width: 1.5rem;
  height: 0;
  border-top: 2px solid;
}

.trust-flow-line.cross {
  border-top-style: dashed;
}

.trust-flow-head {
  font-size: 0.6rem;
  line-height: 1;
}

.trust-verified {
  color: var(--color-success);
  font-size: var(--text-sm);
  cursor: help;
}

.trust-unverified {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  cursor: help;
}

/* Cross-project Links */
.trust-cross-section {
  margin-top: var(--space-4);
}

.trust-cross-details {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.trust-cross-summary {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-accent-tertiary);
  cursor: pointer;
  font-weight: var(--weight-medium);
  user-select: none;
}

.trust-cross-summary:hover {
  background: var(--color-bg-elevated);
}

.trust-cross-list {
  padding: 0 var(--space-4) var(--space-3);
}

.cross-agent {
  color: var(--color-accent-tertiary);
}

/* Detail Slide-out Panel */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--color-border-default);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out);
  overflow-y: auto;
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-modal) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-default);
}

.detail-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel-inner {
  padding: var(--space-6);
}

.detail-header {
  margin-bottom: var(--space-6);
}

.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.detail-agent-name {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.detail-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  color: var(--color-text-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.detail-close:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
}

.detail-agent-project {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.detail-section {
  margin-bottom: var(--space-6);
}

.detail-section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
}

.detail-profile-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.detail-profile-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.detail-profile-label {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  width: 10rem;
  flex-shrink: 0;
}

.detail-profile-desc {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-left: var(--space-2);
}

.detail-empty {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Detail Edit Form */
.detail-title-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.detail-edit-btn {
  background: none;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-2);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.15s ease;
}
.detail-edit-btn:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
}
.detail-edit-btn svg {
  width: 14px;
  height: 14px;
}

.detail-edit-form {
  padding: var(--space-4);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  border: 1px solid var(--color-border-subtle);
}

.edit-field {
  margin-bottom: var(--space-3);
}

.edit-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.edit-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  transition: border-color 0.15s ease;
}
.edit-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.edit-toggle-group {
  display: flex;
  gap: var(--space-2);
}

.edit-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.edit-toggle-btn.active {
  border-color: var(--color-accent-primary);
  background: rgba(99, 102, 241, 0.08);
  color: var(--color-text-primary);
}
.edit-toggle-btn:hover:not(.active) {
  background: var(--color-bg-tertiary);
}

.edit-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.edit-save-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  background: var(--color-accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.edit-save-btn:hover { opacity: 0.9; }
.edit-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.edit-cancel-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  background: none;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.edit-cancel-btn:hover {
  background: var(--color-bg-tertiary);
}

.edit-status {
  font-size: var(--text-xs);
  margin-top: var(--space-2);
  min-height: 1.2em;
}
.edit-status.success { color: var(--color-success); }
.edit-status.error { color: var(--color-error); }

/* Detail Relationships */
.detail-rel-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.detail-rel-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}


.detail-rel-dir {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  width: 1.5rem;
  text-align: center;
}

.detail-rel-agent {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  flex: 1;
}

.detail-rel-agent.cross-agent {
  color: var(--color-accent-tertiary);
}

/* Detail Releases */
.detail-release-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.detail-release-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

.detail-release-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  width: 3.5rem;
  flex-shrink: 0;
}

.detail-release-dir {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.detail-release-agent {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
}

.detail-release-desc {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  padding-left: 4rem;
  margin-top: calc(-1 * var(--space-1));
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: var(--space-2);
}

/* Responsive */
@media (max-width: 768px) {
  .trust-projects-list {
    padding: var(--space-4);
  }

  .project-group {
    padding: var(--space-4);
  }

  .project-group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .detail-panel {
    width: 100%;
  }

  .trust-flow-row {
    flex-wrap: wrap;
  }
}

/* ──────────────────────────────────────────────
   Projects Board (Kanban drag-to-assign)
   ────────────────────────────────────────────── */

.projects-board {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-6);
  overflow-x: auto;
  align-items: flex-start;
  min-height: calc(100vh - 200px);
}

.proj-column {
  flex: 1;
  min-width: 240px;
  max-width: 340px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
}

.proj-column-unassigned {
  border-style: dashed;
  opacity: 0.85;
}

.proj-column-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.proj-column-title {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.proj-column-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.proj-column-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 80px;
  flex: 1;
  transition: background var(--duration-fast) var(--ease-default);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Drop zone feedback */
.proj-drop-zone.proj-drop-active {
  background: rgba(99, 102, 241, 0.08);
  outline: 2px dashed var(--color-accent-primary);
  outline-offset: -2px;
}

.proj-empty-hint {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Agent card in project column */
.proj-agent-card {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  cursor: grab;
  transition: all var(--duration-fast) var(--ease-default);
  position: relative;
}

.proj-agent-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.proj-agent-card:active {
  cursor: grabbing;
}

.proj-agent-card.proj-dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.proj-agent-card[data-status="stopped"] {
  opacity: 0.5;
}

.proj-agent-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.proj-agent-status {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.proj-agent-name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-agent-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-left: calc(6px + var(--space-2));
}

.proj-agent-role {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-transform: capitalize;
}

/* Responsive board */
@media (max-width: 768px) {
  .projects-board {
    flex-direction: column;
    padding: var(--space-4);
  }

  .proj-column {
    max-width: 100%;
    min-width: 0;
  }
}

/* ──────────────────────────────────────────────
   Stats Row
   ────────────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  padding: 0 var(--space-6) var(--space-4);
}

.stat-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.stat-card:hover {
  border-color: var(--color-border-strong);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stat-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: 1.2;
}

.stat-change {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  margin-top: var(--space-1);
}

.stat-up { color: var(--color-success); }
.stat-down { color: var(--color-error); }
.stat-neutral { color: var(--color-text-tertiary); }

@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 var(--space-4) var(--space-4);
  }
}

/* ──────────────────────────────────────────────
   View Toggle (Cards / Table)
   ────────────────────────────────────────────── */

.view-toggle {
  display: flex;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border: none;
  background: none;
}

.view-toggle-btn:hover { color: var(--color-text-secondary); }

.view-toggle-btn.active {
  background: var(--color-accent-primary);
  color: #fff;
}

.view-toggle-btn svg {
  width: 14px;
  height: 14px;
}

/* ──────────────────────────────────────────────
   Agent Cards Grid (marketing-style)
   ────────────────────────────────────────────── */

.agent-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  padding: 0 var(--space-6) var(--space-6);
}

.agent-card-mkt {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  position: relative;
}

.agent-card-mkt:hover {
  border-color: var(--color-accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.agent-card-mkt[data-status="stopped"] { opacity: 0.55; }

.agent-card-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.agent-card-av {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-card-av svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.agent-card-info {
  flex: 1;
  min-width: 0;
}

.agent-card-info .agent-name {
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-card-info .agent-role {
  margin-bottom: 0;
  font-size: var(--text-xs);
}

.agent-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

.agent-card-stat-item { text-align: center; }

.agent-card-stat-item .stat-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  display: block;
}

.agent-card-stat-item .stat-label {
  font-size: 0.6rem;
  margin-bottom: 0;
  justify-content: center;
  text-transform: none;
  letter-spacing: 0;
}

/* Storage bar */
.storage-bar-bg {
  height: 4px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-1);
}

.storage-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-default);
}

.storage-bar-label {
  font-size: 0.6rem;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

/* Card actions */
.agent-card-actions {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
}

.agent-card-btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: none;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.agent-card-btn:hover {
  color: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
}

.agent-card-btn svg {
  width: 12px;
  height: 12px;
}

/* Agent card — current task / last activity */
.agent-card-task {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  min-height: 28px;
}
.agent-task-status {
  flex-shrink: 0;
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.agent-task-status.active {
  color: var(--color-success);
}
.agent-task-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-task-time {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  font-size: 10px;
}

/* Agent card — message input */
.agent-card-message {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.agent-msg-input {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-default);
}
.agent-msg-input:focus {
  border-color: var(--color-accent-primary);
}
.agent-msg-input::placeholder {
  color: var(--color-text-tertiary);
}
.agent-msg-input:disabled {
  opacity: 0.5;
}
.agent-msg-send {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}
.agent-msg-send:hover {
  color: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
}
.agent-msg-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.agent-msg-send svg {
  width: 12px;
  height: 12px;
}

@media (max-width: 1024px) {
  .agent-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .agent-cards-grid {
    grid-template-columns: 1fr;
    padding: 0 var(--space-4) var(--space-4);
  }
}

/* ──────────────────────────────────────────────
   Activity Feed
   ────────────────────────────────────────────── */

.activity-section { padding: 0 var(--space-6) var(--space-6); }

.activity-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.activity-title svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.activity-feed {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--duration-fast);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--color-bg-tertiary); }

.activity-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent-primary);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
  min-width: 0;
}

.activity-text .activity-agent {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent-primary);
  margin-right: var(--space-2);
}

.activity-text .activity-action {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.activity-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   Team Overview — Command Center Layout
   ────────────────────────────────────────────── */

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

/* Health Bar — traffic-light pills */
.to-health-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
  flex-shrink: 0;
  gap: var(--space-4);
}

.to-health-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.to-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
  white-space: nowrap;
}

.to-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.to-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.to-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.to-pill-working {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}
.to-dot-working, .to-dot-running, .to-dot-active {
  background: #4ade80;
}

.to-pill-idle {
  background: rgba(234, 179, 8, 0.12);
  color: #fbbf24;
}
.to-dot-idle {
  background: #fbbf24;
}

.to-pill-error {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}
.to-dot-error {
  background: #f87171;
}

.to-pill-starting {
  background: rgba(234, 179, 8, 0.12);
  color: #fbbf24;
}
.to-dot-starting {
  background: #fbbf24;
  animation: pulse 1.5s infinite;
}

.to-pill-total {
  background: var(--color-bg-tertiary);
  color: var(--color-text-tertiary);
}

.to-health-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.to-cost {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.to-ns-filter {
  padding: 4px 8px;
  font-size: var(--text-xs);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

/* Agent Roster — compact rows */
.to-roster {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.to-agent-row {
  display: grid;
  grid-template-columns: 12px 32px 1fr auto 2fr auto auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-6);
  min-height: 48px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.to-agent-row:hover {
  background: var(--color-bg-secondary);
}

/* Status-tinted backgrounds — errors and idle pop visually */
.to-agent-row[data-status="error"] {
  background: rgba(239, 68, 68, 0.06);
}
.to-agent-row[data-status="error"]:hover {
  background: rgba(239, 68, 68, 0.10);
}
.to-agent-row[data-status="idle"] {
  background: rgba(234, 179, 8, 0.04);
}
.to-agent-row[data-status="idle"]:hover {
  background: rgba(234, 179, 8, 0.08);
}
.to-agent-row[data-status="stopped"] {
  opacity: 0.5;
}

/* Status dot */
.to-agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Avatar */
.to-agent-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.to-agent-avatar svg {
  width: 14px;
  height: 14px;
  color: #fff;
}

/* Name */
.to-agent-name {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Role — subtle, muted */
.to-agent-role {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Task — the most important signal */
.to-agent-task {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  min-width: 0;
}

.to-task-active {
  color: var(--color-text-secondary);
}

.to-task-last {
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Model dot */
.to-agent-model {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

/* Time */
.to-agent-time {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Empty state */
.to-empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-tertiary);
}

/* Org chart toggle */
.to-org-toggle {
  padding: var(--space-2) var(--space-6);
  border-top: 1px solid var(--color-border-default);
}

.to-org-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-default);
}

.to-org-toggle-btn:hover {
  color: var(--color-text-secondary);
}

.to-org-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* Org chart section — collapsible */
.to-org-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.to-org-section.to-org-open {
  max-height: 600px;
  overflow-y: auto;
  border-top: 1px solid var(--color-border-default);
}

/* Detail task text */
.to-detail-task-text {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin: 0;
}

/* Loading state */
.to-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}

@media (max-width: 768px) {
  .to-health-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-3) var(--space-4);
  }

  .to-agent-row {
    grid-template-columns: 10px 28px 1fr auto;
    padding: var(--space-2) var(--space-4);
    min-height: 44px;
  }

  /* Hide role, task, model, time on mobile — just show dot + avatar + name + last-seen */
  .to-agent-role,
  .to-agent-task,
  .to-agent-model {
    display: none;
  }
}

/* ──────────────────────────────────────────────
   Model Selector Dropdown
   ────────────────────────────────────────────── */

.model-selector-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  padding: var(--space-1) 0;
  margin-top: var(--space-1);
}

.model-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.model-option:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.model-option.selected {
  color: var(--color-text-primary);
  font-weight: var(--weight-semibold);
}

.model-option .model-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.model-option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.model-option-name {
  font-weight: var(--weight-medium);
}

.model-option-price {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
}

.model-option-tier {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-accent-secondary);
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   Trust Graph
   ────────────────────────────────────────────── */

.trust-graph-container {
  padding: var(--space-6);
}

.trust-graph-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.trust-graph-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.trust-graph-legend-line {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 2px solid var(--color-text-tertiary);
}

.trust-graph-legend-line.dashed {
  border-top-style: dashed;
  border-color: #ec4899;
}

.trust-graph-svg {
  width: 100%;
  height: auto;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: visible;
}

.trust-graph-node:hover circle {
  filter: brightness(1.2);
}

/* ──────────────────────────────────────────────
   Audit Log
   ────────────────────────────────────────────── */

.audit-view {
  padding: var(--space-6);
}

.audit-filters {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.audit-filter-select {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  min-width: 140px;
}

.audit-filter-select:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

.audit-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-secondary);
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.audit-table thead th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-tertiary);
  white-space: nowrap;
}

.audit-row {
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--duration-fast);
}

.audit-row:hover {
  background: var(--color-bg-tertiary);
}

.audit-row:last-child {
  border-bottom: none;
}

.audit-row td {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-primary);
  white-space: nowrap;
}

.audit-cell-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.audit-agent {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.audit-desc {
  white-space: normal !important;
  max-width: 280px;
  color: var(--color-text-secondary);
}

.audit-size {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: right;
}

.audit-flags {
  display: flex;
  gap: var(--space-1);
  font-size: var(--text-sm);
}

.audit-flag-cross {
  color: #ec4899;
  cursor: help;
}

.audit-flag-high {
  cursor: help;
}

.audit-row-detail td {
  padding: 0;
}

.audit-detail-inner {
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-tertiary);
  border-top: 1px solid var(--color-border-subtle);
}

.audit-detail-field {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.audit-detail-field:last-child {
  margin-bottom: 0;
}

.audit-detail-label {
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
}

.audit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  margin-top: var(--space-3);
}

.audit-count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.audit-load-more {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent-primary);
  background: none;
  border: 1px solid var(--color-accent-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.audit-load-more:hover {
  background: var(--color-info-bg);
}

/* ──────────────────────────────────────────────
   Platform Proxy Selection (Settings page)
   ────────────────────────────────────────────── */

.proxy-select-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.proxy-select-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.proxy-select-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.proxy-pool-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.proxy-pool-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.proxy-pool-item:hover {
  border-color: var(--color-border-strong);
}

.proxy-pool-item.selected {
  border-color: var(--color-accent-primary);
  background: var(--color-info-bg);
}

.proxy-pool-radio {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border-strong);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.proxy-pool-item.selected .proxy-pool-radio {
  border-color: var(--color-accent-primary);
}

.proxy-pool-item.selected .proxy-pool-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent-primary);
}

.proxy-pool-info {
  flex: 1;
  min-width: 0;
}

.proxy-pool-name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.proxy-pool-url {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-pool-status {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.proxy-pool-status.active { background: var(--color-success); }
.proxy-pool-status.inactive { background: var(--color-status-stopped); }

@media (max-width: 768px) {
  .audit-filters {
    flex-direction: column;
  }
  .audit-filter-select {
    min-width: 0;
    width: 100%;
  }
}

/* ──────────────────────────────────────────────
   LLM Proxy Topology (Settings page)
   ────────────────────────────────────────────── */

.settings-layout-wide {
  max-width: 900px;
}

.settings-card-wide {
  grid-column: 1 / -1;
}

.proxy-topology {
  width: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  padding: var(--space-4);
  overflow: hidden;
}

.proxy-topo-svg {
  width: 100%;
  max-width: 700px;
  height: auto;
}

/* SVG Nodes */
.topo-key-node { cursor: pointer; transition: opacity var(--duration-fast) var(--ease-default); }
.topo-key-node:hover circle { filter: url(#glow-sm); }
.topo-key-node.active:hover circle { filter: url(#glow); }
.topo-key-node.inactive { opacity: 0.7; }
.topo-key-node.inactive:hover { opacity: 1; }

.topo-pod-center { cursor: pointer; transition: opacity var(--duration-fast) var(--ease-default); }
.topo-pod-center:hover circle { filter: url(#glow); }
.topo-pod-center.alt { opacity: 0.5; }
.topo-pod-center.alt:hover { opacity: 0.8; }

.topo-agent-node { cursor: pointer; transition: opacity var(--duration-fast) var(--ease-default); }
.topo-agent-node:hover circle { filter: url(#glow-sm); }

/* Flow Animation */
.topo-status-pulse { animation: statusPulse 2s ease-in-out infinite; }
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.topo-pulse-ring { animation: pulseRing 3s ease-in-out infinite; }
@keyframes pulseRing { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.04; } }

/* Inline Form */
.proxy-inline-form { margin-top: var(--space-4); }

.proxy-form-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  position: relative;
}

.proxy-form-header { display: flex; align-items: center; gap: var(--space-3); }

.proxy-form-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  flex: 1;
}

.proxy-form-close {
  background: none; border: none; color: var(--color-text-tertiary);
  font-size: 20px; cursor: pointer; padding: 0; line-height: 1;
  transition: color var(--duration-fast) var(--ease-default);
}
.proxy-form-close:hover { color: var(--color-text-primary); }

.proxy-form-desc {
  font-size: var(--text-sm); color: var(--color-text-secondary);
  margin-top: var(--space-2); line-height: 1.5;
}

/* Status Badges */
.proxy-status-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  min-width: 6.5rem; padding: 2px var(--space-2); font-size: var(--text-xs);
  font-weight: var(--weight-semibold); border-radius: var(--radius-full);
  letter-spacing: 0.02em; background: var(--color-bg-tertiary);
  color: var(--color-text-tertiary); border: 1px solid var(--color-border-subtle);
  white-space: nowrap;
}
.proxy-status-badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: var(--radius-full); background: currentColor; flex-shrink: 0;
}
.proxy-status-badge.active {
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.2);
}
.proxy-status-badge.limited {
  color: #eab308;
  background: rgba(234, 179, 8, 0.08); border-color: rgba(234, 179, 8, 0.2);
}
.proxy-status-badge.pending {
  color: var(--color-accent-primary);
  background: rgba(96, 165, 250, 0.08); border-color: rgba(96, 165, 250, 0.2);
}
.proxy-status-badge.awaiting {
  color: #f97316;
  background: rgba(249, 115, 22, 0.08); border-color: rgba(249, 115, 22, 0.2);
}
.proxy-status-badge.awaiting::before {
  animation: statusPulse 2s ease-in-out infinite;
}
.proxy-status-badge.inactive {
  color: var(--color-text-tertiary);
  background: var(--color-bg-tertiary); border-color: var(--color-border-subtle);
}
.proxy-status-badge.error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.2);
}
.proxy-status-badge.error::before {
  animation: statusPulse 1.5s ease-in-out infinite;
}

/* Proxy Cascade — Three-Tier View */
.proxy-cascade {
  display: flex; flex-direction: column; align-items: center;
  gap: 0; margin-top: var(--space-4); padding: 0 var(--space-4);
}
.proxy-cascade-tier {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; max-width: 480px; padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border-subtle); border-radius: var(--radius-lg);
  background: var(--color-bg-secondary); transition: all 200ms ease;
}
.proxy-cascade-tier.active {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.04);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.06);
}
.proxy-cascade-tier.unconfigured {
  border-style: dashed; opacity: 0.6;
}
.proxy-cascade-icon {
  font-size: 20px; flex-shrink: 0; width: 32px; text-align: center;
}
.proxy-cascade-info {
  flex: 1; min-width: 0;
}
.proxy-cascade-label {
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
.proxy-cascade-desc {
  font-size: var(--text-xs); color: var(--color-text-tertiary);
  margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proxy-cascade-arrow {
  display: flex; flex-direction: column; align-items: center;
  color: var(--color-text-tertiary); padding: var(--space-1) 0;
}
.proxy-cascade-arrow.active { color: var(--color-success); }
.proxy-cascade-arrow-label {
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: var(--weight-semibold); margin-top: 2px;
}

/* Bulk Assign Bar */
.bulk-check-cell { width: 32px; text-align: center; }
.bulk-check-cell input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--color-success);
}
.bulk-check-cell input[type="checkbox"]:disabled {
  opacity: 0.3; cursor: not-allowed;
}
.bulk-assign-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--space-3); padding: var(--space-3) var(--space-4);
  background: var(--color-bg-secondary); border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}
.bulk-assign-info {
  font-size: var(--text-sm); color: var(--color-text-secondary);
}
.bulk-assign-info span { font-weight: var(--weight-semibold); color: var(--color-text-primary); }
.bulk-assign-controls {
  display: flex; align-items: center; gap: var(--space-2);
}

/* Action Buttons */
.proxy-remove-btn {
  padding: var(--space-2) var(--space-3); font-size: var(--text-xs);
  font-weight: var(--weight-medium); color: #ef4444; background: none;
  border: 1px solid rgba(239, 68, 68, 0.3); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--duration-fast) var(--ease-default);
}
.proxy-remove-btn:hover { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }

.proxy-cancel-btn {
  padding: var(--space-2) var(--space-3); font-size: var(--text-xs);
  font-weight: var(--weight-medium); color: var(--color-text-secondary);
  background: none; border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}
.proxy-cancel-btn:hover { background: var(--color-bg-tertiary); border-color: var(--color-border-strong); }

/* Confirm Dialog */
.proxy-confirm-remove {
  margin-top: var(--space-3); padding: var(--space-3);
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15); border-radius: var(--radius-md);
}
.proxy-confirm-text { font-size: var(--text-sm); color: var(--color-text-secondary); margin-bottom: var(--space-3); }
.proxy-confirm-actions { display: flex; gap: var(--space-2); }

/* Key Hint */
.proxy-key-hint { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: var(--space-2); }

/* Admin Org Key Row */
.admin-org-key-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4); background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
.admin-org-key-info { display: flex; align-items: center; gap: var(--space-3); }

/* Admin Proxy Table */
.admin-proxy-table-wrap {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
}
.admin-proxy-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.admin-proxy-table thead { background: var(--color-bg-tertiary); }
.admin-proxy-table th {
  padding: var(--space-2) var(--space-3); text-align: left;
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary); letter-spacing: 0.04em;
  text-transform: uppercase; border-bottom: 1px solid var(--color-border-subtle);
  white-space: nowrap;
}
.admin-proxy-table td {
  padding: var(--space-3); border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}
.admin-proxy-table tbody tr:last-child td { border-bottom: none; }
.admin-proxy-table tbody tr:hover { background: var(--color-bg-tertiary); }

.admin-user-name { display: block; font-weight: var(--weight-semibold); color: var(--color-text-primary); }
.admin-user-sub { display: block; font-size: var(--text-xs); color: var(--color-text-tertiary); font-family: var(--font-mono); }
.admin-proxy-name { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-secondary); }
.admin-last-req { font-size: var(--text-xs); color: var(--color-text-tertiary); white-space: nowrap; }

.admin-proxy-switch {
  padding: var(--space-1) var(--space-2); font-size: var(--text-xs);
  font-weight: var(--weight-medium); color: var(--color-text-primary);
  background: var(--color-bg-secondary); border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md); cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default);
  appearance: none; -webkit-appearance: none; padding-right: var(--space-5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23737373' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.admin-proxy-switch:hover { border-color: var(--color-border-strong); }
.admin-proxy-switch:focus-visible { outline: 2px solid var(--color-accent-primary); outline-offset: 1px; }

/* Admin Action Buttons */
.admin-action-btn {
  padding: var(--space-1) var(--space-2); font-size: var(--text-xs);
  font-weight: var(--weight-medium); color: var(--color-accent-primary);
  background: none; border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: var(--radius-md); cursor: pointer; white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-default);
}
.admin-action-btn:hover { background: rgba(96, 165, 250, 0.1); border-color: var(--color-accent-primary); }
.admin-action-btn.danger { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.admin-action-btn.danger:hover { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }
.admin-action-btn.success { color: var(--color-success); border-color: rgba(34, 197, 94, 0.3); }
.admin-action-btn.success:hover { background: rgba(34, 197, 94, 0.1); border-color: var(--color-success); }
.admin-actions-cell { display: flex; gap: var(--space-1); flex-wrap: wrap; }

/* OAuth Connect Flow */
.proxy-oauth-section {
  margin-top: var(--space-4); padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}
.proxy-oauth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-3); font-size: var(--text-xs);
  color: var(--color-text-tertiary); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: var(--weight-semibold);
}
.proxy-oauth-divider::before, .proxy-oauth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--color-border-subtle);
}
.proxy-oauth-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); font-size: var(--text-sm);
  font-weight: var(--weight-semibold); color: #c4b5fd;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}
.proxy-oauth-btn:hover { background: rgba(167, 139, 250, 0.15); border-color: rgba(167, 139, 250, 0.4); }
.proxy-oauth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.proxy-oauth-status { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); font-size: var(--text-sm); }
.proxy-oauth-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(167, 139, 250, 0.2); border-top-color: #a78bfa;
  border-radius: var(--radius-full); animation: oauthSpin 0.8s linear infinite;
}
@keyframes oauthSpin { to { transform: rotate(360deg); } }

.proxy-disconnect-btn {
  padding: var(--space-1) var(--space-3); font-size: var(--text-xs);
  font-weight: var(--weight-medium); color: var(--color-text-tertiary);
  background: none; border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}
.proxy-disconnect-btn:hover { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }

/* ─── Platform Management Tabs ─── */
.platform-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: var(--space-1);
}

.platform-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  margin-bottom: -1px;
}

.platform-tab:hover {
  color: var(--color-text-secondary);
}

.platform-tab.active {
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
}

/* Platform Section Header */
.platform-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Responsive — Proxy */
@media (max-width: 768px) {
  .proxy-topology { min-height: 200px; padding: var(--space-2); }
  .admin-proxy-table { font-size: var(--text-xs); }
  .admin-proxy-table th, .admin-proxy-table td { padding: var(--space-2); }
  .admin-org-key-row { flex-direction: column; gap: var(--space-2); align-items: flex-start; }
}

/* ─── Agent Management ─────────────────────────────── */

.agent-mgmt-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
  padding: 0 var(--space-6) var(--space-6);
}

.agent-mgmt-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--duration-fast) var(--ease-default);
}

/* Status conveyed via inline status dot/badge */

.agent-mgmt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.agent-mgmt-card-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.agent-mgmt-card-role {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

.agent-mgmt-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.agent-mgmt-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.agent-mgmt-card-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
}

.agent-filter-bar {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--space-6) var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

.agent-filter-bar select,
.agent-filter-bar input {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-family: inherit;
}

.agent-filter-bar input {
  min-width: 200px;
}

.log-viewer {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-xs);
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--color-text-secondary);
}

.chunk-editor {
  width: 100%;
  min-height: 200px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--color-text-primary);
  resize: vertical;
}

.detail-sub-tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  overflow-x: auto;
}

.detail-sub-tab {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-default);
}

.detail-sub-tab:hover {
  color: var(--color-text-secondary);
  background: var(--color-bg-tertiary);
}

.detail-sub-tab.active {
  color: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  background: var(--color-bg-secondary);
}

.detail-sub-content {
  padding: var(--space-4);
}

.persona-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default);
}

.persona-card:hover {
  border-color: var(--color-border-strong);
}

.persona-card-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.persona-card-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.persona-card-meta {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.agent-stats-row {
  display: flex;
  gap: var(--space-4);
  padding: 0 var(--space-6) var(--space-4);
  flex-wrap: wrap;
}

.agent-stat-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  min-width: 140px;
  flex: 1;
}

.agent-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.agent-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

/* Model badge colors */
.model-badge { padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.model-badge.opus { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.model-badge.sonnet { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.model-badge.haiku { background: rgba(52, 211, 153, 0.15); color: #34d399; }

/* Agent status badges */
.agent-status { padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.agent-status.running { background: rgba(52, 211, 153, 0.15); color: var(--color-success); }
.agent-status.stopped { background: rgba(148, 163, 184, 0.15); color: var(--color-text-tertiary); }
.agent-status.error { background: rgba(239, 68, 68, 0.15); color: var(--color-error); }
.agent-status.starting { background: rgba(251, 191, 36, 0.15); color: var(--color-warning); }

/* Responsive — Agent Management */
@media (max-width: 768px) {
  .agent-mgmt-cards-grid { grid-template-columns: 1fr; }
  .agent-filter-bar { flex-direction: column; align-items: stretch; }
  .agent-filter-bar input { min-width: auto; }
  .agent-stats-row { flex-direction: column; }
  .detail-sub-tabs { gap: 0; }
}

/* ─── Usage Monitoring Page ────────────────────────── */

.usage-period-selector,
.usage-chart-toggle {
  display: flex;
  gap: 2px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.usage-period-btn,
.usage-chart-btn {
  padding: var(--space-1, 0.25rem) var(--space-3);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast, 150ms) var(--ease-default, ease);
}

.usage-period-btn:hover,
.usage-chart-btn:hover { color: var(--color-text-primary); }

.usage-period-btn.active,
.usage-chart-btn.active {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.2));
}

.usage-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.usage-gauge-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5, 1.25rem);
  transition: border-color var(--duration-normal) var(--ease-default);
}

.usage-gauge-card:hover { border-color: var(--color-border-strong); }

.usage-gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-3);
}

.usage-gauge-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ──────────────────────────────────────────────────────
   Usage Monitoring & Billing
   ────────────────────────────────────────────────────── */

.usage-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.usage-stat-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  transition: border-color var(--duration-fast) var(--ease-default);
}

.usage-stat-card:hover {
  border-color: var(--color-border-strong);
}

.usage-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  margin-bottom: var(--space-1);
}

.usage-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.usage-gauge-value {
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-mono);
}

.usage-color-green { color: var(--color-success); }
.usage-color-amber { color: var(--color-warning); }
.usage-color-orange { color: #f97316; }
.usage-color-red { color: var(--color-error); }

.usage-gauge-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--color-bg-tertiary);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.usage-gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.usage-fill-green { background: var(--color-success); }
.usage-fill-amber { background: var(--color-warning); }
.usage-fill-orange { background: #f97316; }
.usage-fill-red { background: var(--color-error); }

.usage-gauge-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.usage-trend {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.usage-stat-warn {
  border-color: var(--color-warning);
}
.usage-stat-warn .usage-stat-value {
  color: var(--color-warning);
}

.usage-stat-critical {
  border-color: var(--color-error);
}
.usage-stat-critical .usage-stat-value {
  color: var(--color-error);
}

.usage-projections {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
}

.usage-projection-row {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
  font-family: var(--font-mono);
}

.usage-chart-container {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-3);
  margin-bottom: var(--space-6);
}

.usage-chart-svg { width: 100%; height: auto; }

.usage-chart-container svg {
  width: 100%;
  height: auto;
}

.usage-chart-label {
  font-size: 10px;
  fill: var(--color-text-tertiary);
  font-family: var(--font-mono);
}

.usage-chart-grid { stroke: var(--color-border-default); stroke-width: 0.5; }
.usage-chart-threshold { stroke: var(--color-warning); stroke-width: 1; opacity: 0.4; }
.usage-chart-threshold-critical { stroke: var(--color-error); stroke-width: 1; opacity: 0.4; }

.usage-line-session { stroke: var(--color-accent-primary); stroke-width: 2; fill: none; }
.usage-area-session { fill: var(--color-accent-primary); opacity: 0.08; }
.usage-line-weekly { stroke: #60a5fa; stroke-width: 2; fill: none; }
.usage-area-weekly { fill: #60a5fa; opacity: 0.08; }
.usage-line-sonnet { stroke: var(--color-success); stroke-width: 2; fill: none; }
.usage-area-sonnet { fill: var(--color-success); opacity: 0.08; }

.usage-chart-legend {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-3);
}

.usage-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.usage-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Activity Timeline */

.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.activity-entry {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: background var(--duration-fast) var(--ease-default);
}

.activity-entry:hover {
  background: var(--color-bg-tertiary);
}

.activity-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  min-width: 50px;
  flex-shrink: 0;
}

.activity-type-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 1px var(--space-2);
  border: 1px solid;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-summary {
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Model Select Inline */

.model-select-inline {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
}

.model-select-inline:focus {
  border-color: var(--color-accent-primary);
  outline: none;
}

/* Model change dropdown — used in detail panels (GAP-14) */
.model-select {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  min-width: 80px;
}
.model-select:focus { border-color: var(--color-accent-primary); outline: none; }
.model-select:disabled { opacity: 0.5; cursor: wait; }

/* MC detail model field — inline with icon */
.mc-model-field { display: inline-flex; align-items: center; gap: var(--space-1); }

/* ═══════════════════════════════════════════════════════════
   Credentials Page — Admin Credential Pool Management (GAP-10)
   ═══════════════════════════════════════════════════════════ */

.cred-page { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4); height: 100%; }

/* Health bar — reuses Team Overview pill pattern */
.cred-health-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border-default);
}
.cred-health-left { display: flex; align-items: center; gap: var(--space-4); }
.cred-health-right { display: flex; align-items: center; gap: var(--space-3); }
.cred-title { font-size: var(--text-lg); font-weight: var(--font-weight-semibold); margin: 0; }
.cred-add-btn {
  display: inline-flex; align-items: center; gap: var(--space-1);
  background: var(--color-accent-primary); color: #fff; border: none;
  border-radius: var(--radius-md); padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm); cursor: pointer; font-weight: var(--font-weight-medium);
}
.cred-add-btn:hover { opacity: 0.9; }
.cred-add-btn i { width: 14px; height: 14px; }

/* Credential cards grid */
.cred-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-3); }

/* Individual credential card */
.cred-card {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.cred-card[data-status="expired"],
.cred-card[data-status="revoked"] { background: rgba(239, 68, 68, 0.04); }
.cred-card[data-status="inactive"] { background: rgba(245, 158, 11, 0.04); }

.cred-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.cred-card-label-row { display: flex; align-items: center; gap: var(--space-2); }
.cred-card-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cred-card-label { font-weight: var(--font-weight-semibold); font-size: var(--text-sm); }
.cred-card-status {
  font-size: var(--text-xs); color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.cred-card-meta { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); }
.cred-card-agents { display: inline-flex; align-items: center; gap: 2px; }
.cred-card-agents i { width: 12px; height: 12px; }
.cred-card-level { text-transform: uppercase; letter-spacing: 0.05em; }
.cred-card-refresh i { width: 14px; height: 14px; }

/* Budget bars */
.cred-card-budgets { display: flex; flex-direction: column; gap: var(--space-1); }
.cred-budget-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.cred-budget-label { width: 42px; color: var(--color-text-muted); flex-shrink: 0; }
.cred-budget-track {
  flex: 1; height: 6px; background: var(--color-bg-tertiary);
  border-radius: 3px; overflow: hidden;
}
.cred-budget-fill { height: 100%; background: var(--color-success); border-radius: 3px; transition: width 0.3s; }
.cred-budget-fill.cred-budget-warn { background: var(--color-warning); }
.cred-budget-pct { width: 32px; text-align: right; color: var(--color-text-muted); }

/* Footer */
.cred-card-footer {
  display: flex; align-items: center; gap: var(--space-2);
  padding-top: var(--space-2); border-top: 1px solid var(--color-border-default);
  font-size: var(--text-xs); color: var(--color-text-muted);
}
.cred-card-time { flex-shrink: 0; }
.cred-expand-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 2px;
  background: none; border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm); padding: 2px var(--space-2);
  font-size: var(--text-xs); color: var(--color-text-secondary);
  cursor: pointer;
}
.cred-expand-btn:hover { background: var(--color-bg-secondary); }
.cred-expand-btn i { width: 12px; height: 12px; }

/* Expanded agent list */
.cred-agent-list {
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}
.cred-agent-list-open { max-height: 400px; overflow-y: auto; }
.cred-agent-empty { padding: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); text-align: center; }
.cred-agent-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-2); position: relative;
  font-size: var(--text-xs); border-top: 1px solid var(--color-border-default);
}
.cred-agent-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.cred-agent-name { font-weight: var(--font-weight-medium); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-agent-role { color: var(--color-text-muted); }
.cred-agent-model { color: var(--color-text-muted); }
.cred-reassign-btn {
  background: none; border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm); padding: 2px; cursor: pointer;
  color: var(--color-text-muted); display: inline-flex; align-items: center;
}
.cred-reassign-btn:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.cred-reassign-btn i { width: 12px; height: 12px; }

/* Reassign picker dropdown */
.cred-reassign-picker {
  position: absolute; right: 0; top: 100%; z-index: 100;
  background: var(--color-bg-primary); border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 180px; padding: var(--space-1);
}
.cred-reassign-option {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; padding: var(--space-2); border: none;
  background: none; cursor: pointer; font-size: var(--text-xs);
  border-radius: var(--radius-sm); color: var(--color-text-primary);
}
.cred-reassign-option:hover { background: var(--color-bg-secondary); }

/* Create modal */
.cred-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.cred-modal {
  background: var(--color-bg-primary); border-radius: var(--radius-lg);
  padding: var(--space-6); width: 100%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.cred-modal-title { margin: 0 0 var(--space-4); font-size: var(--text-lg); font-weight: var(--font-weight-semibold); }
.cred-label-hint { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); display: block; }
.cred-modal-status { font-size: var(--text-sm); margin-top: var(--space-2); }
.cred-modal-status.error { color: var(--color-error); }
.cred-modal-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); }

/* Mobile responsive */
@media (max-width: 768px) {
  .cred-grid { grid-template-columns: 1fr; }
  .cred-health-bar { flex-direction: column; gap: var(--space-2); align-items: flex-start; }
}

/* Recommendation Cards */

.usage-recs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
}

.usage-costs-container {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-3);
  overflow-x: auto;
}

.usage-costs-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-default);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.usage-costs-total strong {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text-primary);
}

.usage-costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.usage-costs-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border-default);
  white-space: nowrap;
}

.usage-sort { cursor: pointer; user-select: none; }
.usage-sort:hover { color: var(--color-text-primary); }

.usage-costs-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle, rgba(255,255,255,0.04));
  color: var(--color-text-secondary);
}

.usage-costs-table tr:hover td { background: var(--color-bg-tertiary); }
/* High spenders indicated by inline icon/badge */

.usage-agent-name {
  font-weight: 500;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.usage-num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.usage-cost { font-weight: 600; color: var(--color-text-primary); }

.usage-model-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: capitalize;
}

.usage-model-opus { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.usage-model-sonnet { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.usage-model-haiku { background: rgba(52, 211, 153, 0.15); color: #34d399; }

.usage-share-bar-container {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 80px;
}

.usage-share-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--color-accent-primary);
  opacity: 0.6;
  transition: width 0.4s ease;
  flex-shrink: 0;
}

.usage-share-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.usage-rec-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  background: var(--color-bg-secondary);
  transition: border-color var(--duration-normal) var(--ease-default);
}

.usage-rec-card:hover { border-color: var(--color-border-strong); }

.usage-rec-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--color-text-tertiary);
}

.usage-rec-action .usage-rec-icon { color: #60a5fa; }
.usage-rec-event .usage-rec-icon { color: var(--color-warning); }

.usage-rec-body { flex: 1; }

.usage-rec-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-2) 0;
  line-height: 1.5;
}

.usage-rec-time { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.usage-rec-actions { display: flex; gap: var(--space-2); }

.usage-rec-btn {
  padding: var(--space-1, 0.25rem) var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--duration-fast, 150ms) ease;
}

.usage-rec-act { border-color: #60a5fa; color: #60a5fa; }
.usage-rec-act:hover { background: rgba(96, 165, 250, 0.1); }
.usage-rec-dismiss:hover { background: var(--color-bg-tertiary); color: var(--color-text-primary); }

.usage-rec-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8) 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/* Responsive — Usage Monitoring */
@media (max-width: 768px) {
  .usage-gauges { grid-template-columns: 1fr; }
  .usage-stats-row { grid-template-columns: 1fr 1fr; }
  .usage-recs-grid { grid-template-columns: 1fr; }
  .usage-costs-table { font-size: var(--text-xs); }
  .usage-costs-table th,
  .usage-costs-table td { padding: var(--space-1, 0.25rem) var(--space-2); }
  .usage-chart-legend { flex-wrap: wrap; }
  .activity-entry { flex-wrap: wrap; }
}

/* ─── Rate Limit Utilization Bars ─────────────────── */

.rl-bars-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}

.rl-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.rl-bar-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  width: 24px;
  flex-shrink: 0;
  text-align: right;
}

.rl-bar-track {
  flex: 1;
  height: 6px;
  background: var(--color-bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.rl-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--duration-normal) var(--ease-default);
}

.rl-bar-green {
  background: var(--color-success);
}

.rl-bar-yellow {
  background: var(--color-warning, #f59e0b);
}

.rl-bar-red {
  background: var(--color-error);
}

.rl-bar-pct {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  width: 28px;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rl-throttle-count {
  font-size: var(--text-xs);
  color: var(--color-error);
  font-weight: var(--font-medium);
  margin-top: 2px;
}

.rl-bars-cell {
  vertical-align: middle;
}

/* ─── Invite Management ──────────────────────────── */

.invite-create-card {
  padding: 0 0 var(--space-4);
}

.invite-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.invite-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.invite-form-field .settings-label {
  font-size: var(--text-xs);
}

.invite-code-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
  transition: background var(--duration-fast) var(--ease-default);
}

.invite-code-mono:hover {
  background: var(--color-bg-quaternary, var(--color-border-default));
}

/* Type badges */
.invite-type-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.invite-type-personal {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.invite-type-org {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.invite-type-trial {
  background: rgba(115, 115, 115, 0.15);
  color: var(--color-text-secondary);
}

.invite-type-create {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
}

/* Trust level badges */
.invite-trust-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.invite-trust-0 {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.invite-trust-1,
.invite-trust-2 {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.invite-trust-3 {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.invite-trust-4,
.invite-trust-5 {
  background: rgba(115, 115, 115, 0.15);
  color: var(--color-text-secondary);
}

.invite-rel-cell {
  text-transform: capitalize;
  font-size: var(--text-sm);
}

/* Created result card */
.invite-result {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.invite-result-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.invite-result-row .settings-label {
  width: 36px;
  flex-shrink: 0;
  font-size: var(--text-xs);
}

.invite-code-display {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.invite-link-display {
  font-size: var(--text-xs);
  word-break: break-all;
  flex-shrink: 1;
}

.invite-copy-btn {
  font-size: var(--text-xs);
  padding: 2px 8px;
  flex-shrink: 0;
}

.invite-revoke-btn {
  font-size: var(--text-xs);
  padding: 2px 10px;
}

@media (max-width: 768px) {
  .invite-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Session Pool Bar ───────────────────────────── */

.session-pool-bar {
  padding: var(--space-2) 0;
}

.session-count {
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.session-queued {
  font-size: var(--text-xs);
  color: var(--color-warning);
  margin-top: 2px;
  display: block;
  text-align: right;
}

/* ─── Premier Skills ──────────────────────────── */

.skill-toggle-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.skill-toggle-card.skill-enabled {
  border-color: var(--color-accent-primary);
}

.skill-toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.skill-toggle-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.skill-toggle-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
}

.skill-toggle-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin: var(--space-2) 0 0;
  line-height: 1.4;
}

.skill-toggle-meta {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

/* Tier badge */
.skill-tier-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--font-semibold);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skill-tier-premiere {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.skill-tier-default {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

/* Toggle switch — iOS-style */
.skill-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.skill-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.skill-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-bg-tertiary);
  border-radius: 22px;
  transition: background var(--duration-fast) var(--ease-default);
}

.skill-switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--color-text-primary);
  border-radius: 50%;
  transition: transform var(--duration-fast) var(--ease-default);
}

.skill-switch input:checked + .skill-switch-slider {
  background: var(--color-accent-primary);
}

.skill-switch input:checked + .skill-switch-slider::before {
  transform: translateX(18px);
}

.skill-switch input:disabled + .skill-switch-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Location Settings ──────────────────────── */

.loc-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
}

.loc-section:first-of-type {
  margin-top: var(--space-3);
  padding-top: 0;
  border-top: none;
}

.loc-section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-3);
}

.loc-coords {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--text-xs);
}

.loc-refresh-btn {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
}

.loc-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.loc-toggle-info {
  flex: 1;
}

.loc-toggle-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
}

.loc-toggle-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
  line-height: 1.4;
}

.loc-interval-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.loc-interval-select {
  width: auto;
  min-width: 100px;
}

/* ─── Dynamic Team View ────────────────────────────── */

.roster-ns-filter {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}

.agent-card-context {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: 2px;
}

.pod-label, .project-label {
  font-size: var(--text-xs);
  padding: 1px var(--space-1);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.pod-label {
  background: rgba(14, 165, 233, 0.12);
  color: var(--color-info, #0ea5e9);
}

.project-label {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
}

.roster-pod {
  white-space: nowrap;
  font-size: var(--text-sm);
  color: var(--color-info, #0ea5e9);
}

.detail-pod-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(14, 165, 233, 0.12);
  color: var(--color-info, #0ea5e9);
}

.detail-project-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
}

/* ─── Chat (iMessage-style) ───────────────────────── */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* Full height — sidebar is beside, not above */
  max-width: 800px;
  margin: 0 auto;
  background: var(--color-bg-primary);
  position: relative; /* anchor for scroll pill */
}

.chat-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Multi-agent chat tab bar — low chrome, content-first */
.chat-tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-default);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none; /* Firefox */
}
.chat-tab-bar::-webkit-scrollbar { display: none; }

.chat-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition: background 0.15s, border-color 0.15s;
}
.chat-tab:hover { background: var(--color-bg-tertiary); }
.chat-tab.active {
  background: var(--color-bg-primary);
  border-color: var(--color-border-default);
  color: var(--color-text-primary);
}

.chat-tab-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-text-tertiary);
}
.chat-tab-dot.online { background: var(--color-success); }

.chat-tab-name { font-weight: var(--weight-normal); }
.chat-tab.active .chat-tab-name { font-weight: var(--weight-medium); }

.chat-tab-badge {
  background: var(--color-accent-primary);
  color: white;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.chat-tab-close {
  font-size: 14px;
  line-height: 1;
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.chat-tab:hover .chat-tab-close { opacity: 1; }
.chat-tab-close:hover { color: var(--color-text-primary); background: var(--color-bg-tertiary); }

.chat-tab-add-wrap { position: relative; }
.chat-tab-add {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--color-border-default);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.chat-tab-add:hover { border-color: var(--color-accent-primary); color: var(--color-accent-primary); }

/* Agent picker dropdown from "+" button */
.chat-tab-picker {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}
.chat-tab-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
}
.chat-tab-picker-item:hover { background: var(--color-bg-tertiary); }

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.chat-avatar svg { width: 20px; height: 20px; }

.chat-header-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.chat-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
}

.chat-status-dot.online { background: var(--color-success); }
.chat-status-dot.offline { background: var(--color-text-tertiary); }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Date separator */
.chat-date-sep {
  text-align: center;
  padding: var(--space-3) 0;
}

.chat-date-sep span {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  background: var(--color-bg-secondary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

/* Message bubbles */
.chat-bubble-row {
  display: flex;
  margin-bottom: 2px;
}

.chat-bubble-row.user { justify-content: flex-end; }
.chat-bubble-row.assistant { justify-content: flex-start; }

.chat-bubble {
  max-width: 75%;
  padding: var(--space-2) var(--space-3);
  border-radius: 18px;
  line-height: 1.45;
  font-size: var(--text-sm);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-bubble.user {
  background: var(--color-accent-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble-content {
  white-space: pre-wrap;
}

.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
}

.chat-bubble-time {
  font-size: 10px;
  opacity: 0.6;
}

.chat-bubble.user .chat-bubble-time { color: rgba(255,255,255,0.7); }
.chat-bubble.assistant .chat-bubble-time { color: var(--color-text-tertiary); }

/* Read receipts */
.chat-receipt {
  font-size: 10px;
}

.chat-receipt.sent { color: rgba(255,255,255,0.5); }
.chat-receipt.delivered { color: rgba(255,255,255,0.7); }
.chat-receipt.read { color: #60a5fa; }
.chat-receipt.failed { color: var(--color-error); font-weight: bold; }
.chat-receipt.sending { color: rgba(255,255,255,0.4); }

/* Input bar */
.chat-input-bar {
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border-default);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: 24px;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 120px;
  padding: 4px 0;
}

.chat-input::placeholder {
  color: var(--color-text-tertiary);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-accent-primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.chat-send-btn:not(:disabled):hover {
  opacity: 0.85;
}

.chat-send-btn svg { width: 16px; height: 16px; }

/* Empty state */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8);
  flex: 1;
  color: var(--color-text-tertiary);
}

.chat-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.chat-empty-icon svg { width: 28px; height: 28px; color: var(--color-text-tertiary); }

.chat-empty h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-2);
}

.chat-empty p {
  font-size: var(--text-sm);
  margin: 0;
  max-width: 300px;
}

/* Loading dots */
.chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  flex: 1;
}

.chat-loading-dots {
  display: flex;
  gap: 4px;
}

.chat-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: chat-dot-bounce 1.2s infinite;
}

.chat-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Typing indicator — animated dots in assistant bubble */
.chat-typing-bubble {
  padding: var(--space-2) var(--space-4);
}

.chat-typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 20px;
}

.chat-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: chat-typing-bounce 1.4s infinite;
}

.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Scroll-to-bottom pill — floats above input bar */
.chat-scroll-pill {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-accent-primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
  transition: opacity 0.15s;
}

.chat-scroll-pill:hover { opacity: 0.85; }
.chat-scroll-pill svg { width: 14px; height: 14px; }

/* Suggestion chips — empty state prompts */
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
  width: 100%;
  max-width: 280px;
}

.chat-suggestion-chip {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.chat-suggestion-chip:hover {
  border-color: var(--color-accent-primary);
  background: var(--color-bg-tertiary);
}

/* Markdown content in assistant bubbles */
.chat-md pre.chat-code-block {
  background: rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  overflow-x: auto;
  font-size: var(--text-xs);
  line-height: 1.5;
}

.chat-md code.chat-code-inline {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.chat-md a {
  color: var(--color-accent-primary);
  text-decoration: underline;
}

.chat-md strong { font-weight: var(--weight-semibold); }

.chat-md li.chat-list-item {
  margin-left: var(--space-4);
  list-style: disc;
}

.chat-md li.chat-list-ordered {
  list-style: decimal;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .chat-container {
    height: calc(100dvh - 52px); /* Account for hamburger row */
    max-width: 100%;
  }

  .chat-bubble {
    max-width: 85%;
  }

  .chat-input-bar {
    padding: var(--space-2) var(--space-3);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  }

  .chat-scroll-pill {
    bottom: 70px;
  }
}

/* ─── My Assistant (consumer agent management) ──── */

.ma-page {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ma-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.ma-status-card {
  text-align: center;
  padding: var(--space-6);
}

.ma-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin: 0 auto var(--space-3);
}

.ma-avatar svg { width: 32px; height: 32px; }

.ma-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.ma-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.ma-edit-name-btn {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.ma-edit-name-btn:hover { color: var(--color-text-primary); }
.ma-edit-name-btn svg { width: 14px; height: 14px; }

.ma-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-1);
}

.ma-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.ma-status-dot.online { background: var(--color-success); }
.ma-status-dot.offline { background: var(--color-text-tertiary); }
.ma-status-dot.starting { background: var(--color-warning, #f59e0b); animation: ma-pulse 1.5s infinite; }
.ma-status-dot.error { background: var(--color-error); }

@keyframes ma-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ma-status-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
}

.ma-status-desc {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin: 0;
}

/* Service level badge on status card */
.ma-service-level {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.ma-sl-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.sl-unlimited { background: rgba(99, 102, 241, 0.15); color: var(--color-accent-primary); }
.sl-premium { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.sl-standard { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.sl-basic { background: var(--color-bg-elevated); color: var(--color-text-secondary); }
.sl-trial { background: var(--color-bg-elevated); color: var(--color-text-tertiary); }

.ma-sl-desc {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* Usage summary widget — today's message count / daily limit */
.ma-usage-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.ma-usage-summary svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ma-usage-bar {
  flex: 1;
  max-width: 120px;
  height: 4px;
  background: var(--color-bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.ma-usage-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width var(--duration-normal) var(--ease-default);
}

.ma-usage-warn .ma-usage-bar-fill { background: var(--color-warning, #f59e0b); }
.ma-usage-danger .ma-usage-bar-fill { background: var(--color-error, #ef4444); }
.ma-usage-danger { color: var(--color-error, #ef4444); }

.ma-actions {
  margin-top: var(--space-4);
}

.ma-action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.ma-action-btn:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

.ma-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.ma-action-btn svg { width: 14px; height: 14px; }

/* Edit name card */
.ma-edit-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.ma-edit-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
}

.ma-save-btn {
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-accent-primary);
  color: white;
  font-size: var(--text-sm);
  cursor: pointer;
}

.ma-cancel-btn {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
}

.ma-edit-msg {
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

.ma-edit-msg.success { color: var(--color-success); }
.ma-edit-msg.error { color: var(--color-error); }

/* Section titles */
.ma-section-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-1);
}

.ma-section-desc {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin: 0 0 var(--space-3);
}

.ma-about-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Abilities list */
.ma-abilities-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ma-ability {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
}

.ma-ability.locked {
  opacity: 0.5;
}

.ma-ability-info {
  flex: 1;
  min-width: 0;
}

.ma-ability-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.ma-ability-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.ma-ability-locked-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* Activity stats */
.ma-stats-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ma-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.ma-stat-item svg { width: 16px; height: 16px; color: var(--color-text-tertiary); flex-shrink: 0; }

/* Sessions list */
.ma-sessions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ma-session-item {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
}

.ma-session-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ma-session-date {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.ma-session-turns {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.ma-empty-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin: 0;
}

/* Scheduled Tasks (My Assistant) */
.ma-tasks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ma-task-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-bg-tertiary);
}

.ma-task-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-accent);
}

.ma-task-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ma-task-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ma-task-meta {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.ma-task-next {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 640px) {
  .ma-page {
    padding: var(--space-3);
  }

  .ma-card {
    padding: var(--space-4);
  }

  .ma-edit-row {
    flex-direction: column;
  }

  .ma-edit-input {
    width: 100%;
  }
}

/* ─── Mission Control ─────────────────────────────── */

.mc-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.mc-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
  flex-shrink: 0;
}

.mc-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.mc-status-counts {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

.mc-count {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-tertiary);
}

.mc-count::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mc-count-online::before { background: var(--color-success); }
.mc-count-idle::before { background: var(--color-warning); }
.mc-count-error::before { background: var(--color-error); }
.mc-count-total::before { background: var(--color-text-tertiary); }

/* Split Pane */
.mc-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.mc-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border-default);
  overflow-y: auto;
  background: var(--color-bg-primary);
}

.mc-detail {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  background: var(--color-bg-secondary);
}

/* Agent List */
.mc-agent-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  min-height: 56px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--duration-fast) var(--ease-default);
}

.mc-agent-item:hover {
  background: var(--color-bg-secondary);
}

.mc-agent-item.mc-agent-selected {
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--color-accent-primary);
}

.mc-agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mc-dot-online { background: var(--color-success); }
.mc-dot-idle { background: var(--color-warning); }
.mc-dot-starting { background: var(--color-warning); animation: pulse 1.5s infinite; }
.mc-dot-error { background: var(--color-error); }
.mc-dot-offline { background: var(--color-text-tertiary); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.mc-agent-info {
  flex: 1;
  min-width: 0;
}

.mc-agent-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-agent-task {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-agent-status-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.mc-status-online { color: var(--color-success); }
.mc-status-idle { color: var(--color-warning); }
.mc-status-starting { color: var(--color-warning); }
.mc-status-error { color: var(--color-error); }
.mc-status-offline { color: var(--color-text-tertiary); }

/* Detail Panel */
.mc-detail-header {
  margin-bottom: var(--space-6);
}

.mc-detail-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.mc-detail-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.mc-detail-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.mc-detail-badge.mc-status-online { background: rgba(34, 197, 94, 0.15); }
.mc-detail-badge.mc-status-idle { background: rgba(234, 179, 8, 0.15); }
.mc-detail-badge.mc-status-error { background: rgba(239, 68, 68, 0.15); }
.mc-detail-badge.mc-status-offline { background: var(--color-bg-elevated); color: var(--color-text-tertiary); }

.mc-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.mc-detail-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.mc-detail-meta svg {
  width: 14px;
  height: 14px;
}

.mc-detail-section {
  margin-bottom: var(--space-5);
}

.mc-detail-section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.mc-detail-task {
  font-size: var(--text-base);
  color: var(--color-text-primary);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
}

/* Activity Feed */
.mc-activity-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mc-activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.mc-activity-item:hover {
  background: var(--color-bg-primary);
}

.mc-activity-item.mc-activity-error {
  color: var(--color-error);
}

.mc-activity-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-text-tertiary);
}

.mc-activity-error .mc-activity-icon {
  color: var(--color-error);
}

.mc-activity-text {
  flex: 1;
  color: var(--color-text-secondary);
}

.mc-activity-time {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* Empty States */
.mc-empty,
.mc-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--color-text-tertiary);
  text-align: center;
  height: 100%;
}

.mc-detail-empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.mc-detail-empty-text {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

/* Task List */
.mc-tasks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.mc-task-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
}

.mc-task-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-text-tertiary);
}

.mc-task-active .mc-task-icon { color: var(--color-success); }
.mc-task-completed .mc-task-icon { color: var(--color-text-tertiary); }
.mc-task-failed .mc-task-icon { color: var(--color-error); }
.mc-task-cancelled .mc-task-icon { color: var(--color-text-tertiary); opacity: 0.5; }

.mc-task-info {
  flex: 1;
  min-width: 0;
}

.mc-task-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.mc-task-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

.mc-task-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.mc-task-priority { display: flex; align-items: center; }
.mc-task-priority svg { width: 14px; height: 14px; }
.mc-task-due { color: var(--color-text-tertiary); }
.mc-task-runs { color: var(--color-text-tertiary); }

/* Mobile: stack instead of side-by-side */
@media (max-width: 768px) {
  .mc-split {
    flex-direction: column;
  }

  .mc-sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--color-border-default);
  }

  .mc-detail {
    padding: var(--space-4);
  }

  .mc-status-bar {
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
    padding: var(--space-3) var(--space-4);
  }

  .mc-quick-actions {
    flex-direction: column;
  }
}

/* MC Phase 2 — Header Controls */
.mc-header-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.mc-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.mc-toggle svg {
  width: 14px;
  height: 14px;
}

.mc-toggle:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
}

.mc-toggle-active {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--color-success);
  color: var(--color-success);
}

/* MC Phase 2 — Staleness Indicators */
.mc-agent-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}

.mc-agent-staleness {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.mc-stale-warn {
  color: var(--color-warning);
}

.mc-stale-danger {
  color: var(--color-error);
}

.mc-stale-dim {
  opacity: 0.5;
}

.mc-agent-item.mc-stale-dim {
  opacity: 0.5;
}

.mc-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border-radius: 9px;
  background: var(--color-warning);
  color: #000;
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

/* MC Phase 2 — Auto Badge */
.mc-auto-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
  text-transform: uppercase;
}

/* MC Phase 2 — Detail Actions */
.mc-detail-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* MC Phase 2 — Approval Queue */
.mc-approval-queue {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mc-approval-card {
  padding: var(--space-4);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
}

.mc-approval-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.mc-approval-icon {
  width: 18px;
  height: 18px;
  color: var(--color-warning);
}

.mc-approval-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-warning);
  flex: 1;
}

.mc-approval-time {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.mc-approval-desc {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.mc-approval-meta {
  margin-bottom: var(--space-2);
}

.mc-approval-tool {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.mc-approval-command {
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  overflow-x: auto;
  margin-bottom: var(--space-3);
}

.mc-approval-actions {
  display: flex;
  gap: var(--space-2);
}

.mc-deny-btn {
  color: var(--color-error) !important;
}

.mc-approve-all-agent {
  align-self: flex-start;
}

/* MC Phase 2 — Chat Input */
.mc-chat-input-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.mc-chat-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
}

.mc-chat-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

/* MC Phase 2 — Quick Actions */
.mc-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-default);
  margin-top: auto;
}

.mc-quick-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.mc-quick-btn svg {
  width: 14px;
  height: 14px;
}

.mc-quick-btn:hover:not(:disabled) {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-strong);
}

.mc-quick-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* MC Phase 2 — Status Footer */
.mc-status-footer {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border-default);
  background: var(--color-bg-primary);
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.mc-count-pending::before {
  background: var(--color-warning);
}

/* MC Phase 2 — Broadcast Modal */
.mc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.mc-modal {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 100%;
  max-width: 480px;
  margin: var(--space-4);
}

.mc-modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.mc-modal-desc {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
}

.mc-modal-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
  margin-bottom: var(--space-4);
}

.mc-modal-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}

.mc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* MC Phase 2 — Topology Canvas Panel */
.mc-topology-panel {
  width: 50%;
  min-width: 300px;
  position: relative;
  background: #1a1a2e;
}

.mc-topology-panel canvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 768px) {
  .mc-topology-panel {
    width: 100%;
    height: 300px;
    min-width: unset;
  }
}

/* ─── Billing Page ──────────────────────────────────── */

.billing-period {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
}

.billing-usage-bar-container {
  margin: var(--space-4) 0 var(--space-6);
}

.billing-usage-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.billing-usage-bar {
  height: 8px;
  background: var(--color-bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.billing-usage-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.billing-model-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.billing-model-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.billing-model-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.billing-model-bar {
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.billing-model-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── Phase 1: Command Palette ─────────────────────── */
/* WHY floating above input: palette appears where the user's attention already is.
   Positioned absolutely relative to .chat-container so it stays with the chat. */

.chat-cmd-palette {
  position: absolute;
  bottom: 64px; /* above input bar */
  left: var(--space-4);
  right: var(--space-4);
  max-height: 260px;
  overflow-y: auto;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.chat-cmd-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: background 0.1s;
}

.chat-cmd-item:hover,
.chat-cmd-item.active {
  background: var(--color-bg-tertiary);
}

.chat-cmd-item.active {
  border-left: 2px solid var(--color-accent-primary);
}

.chat-cmd-name {
  color: var(--color-accent-primary);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.chat-cmd-alias {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.chat-cmd-desc {
  color: var(--color-text-secondary);
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Phase 1: System Cards (command results) ──────── */
/* WHY visually distinct from chat bubbles: system cards are ephemeral UI, not
   persisted messages. Bordered card with monospace font, no avatar, centered. */

.chat-system-card {
  margin: var(--space-3) var(--space-4);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow: hidden;
}

.chat-system-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border-subtle);
}

.chat-system-card-title {
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-system-card-close {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: var(--text-lg);
  padding: 0 var(--space-1);
  line-height: 1;
}

.chat-system-card-close:hover {
  color: var(--color-text-primary);
}

.chat-system-card-body {
  padding: var(--space-3);
}

.chat-sys-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.chat-sys-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-sys-dot.online { background: var(--color-success); }
.chat-sys-dot.offline { background: var(--color-text-tertiary); }

/* /help command layout */
.chat-cmd-help-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chat-cmd-help-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-1) 0;
}

.chat-cmd-help-name {
  color: var(--color-accent-primary);
  font-weight: var(--weight-medium);
  min-width: 140px;
}

.chat-cmd-help-desc {
  color: var(--color-text-secondary);
  margin-left: auto;
}

/* ─── Phase 1: Keyboard Shortcuts Overlay ──────────── */
/* WHY centered overlay: accessible, dismissible, doesn't interfere with chat.
   Dark backdrop prevents interaction with content below. */

.chat-shortcuts-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.chat-shortcuts-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.chat-shortcuts-panel {
  position: relative;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  font-family: var(--font-mono);
}

.chat-shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-default);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--text-base);
}

.chat-shortcuts-close {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: var(--text-xl);
  padding: 0;
  line-height: 1;
}

.chat-shortcuts-close:hover {
  color: var(--color-text-primary);
}

.chat-shortcuts-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-shortcut-group-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.chat-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) 0;
}

.chat-shortcut-keys {
  display: flex;
  gap: var(--space-1);
}

.chat-shortcut-keys kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  min-width: 20px;
  text-align: center;
}

.chat-shortcut-desc {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.chat-shortcuts-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-default);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: center;
}

.chat-shortcuts-footer kbd {
  display: inline-block;
  padding: 1px 4px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
}

/* Mobile: hide vim shortcuts, keep palette functional */
@media (max-width: 640px) {
  .chat-cmd-palette {
    left: var(--space-2);
    right: var(--space-2);
  }

  .chat-shortcuts-panel {
    width: 95%;
  }

  .chat-cmd-desc {
    display: none; /* save space on small screens */
  }
}

/* ─── Credential Health (Settings) ──────────────────── */

.cred-health-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.cred-health-item {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
}

.cred-health-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.cred-health-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cred-healthy .cred-health-icon { color: var(--color-success); }
.cred-expiring .cred-health-icon { color: var(--color-warning); }
.cred-expired .cred-health-icon { color: var(--color-error); }

.cred-health-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.cred-health-level {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  background: var(--color-bg-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.cred-health-status {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-left: auto;
}

.cred-budget-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.cred-budget-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  min-width: 80px;
}

.cred-budget-bar {
  flex: 1;
  height: 6px;
  background: var(--color-bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.cred-budget-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width var(--duration-normal) var(--ease-default);
}

.cred-budget-fill.cred-budget-warn {
  background: var(--color-warning);
}

.cred-budget-pct {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  min-width: 30px;
  text-align: right;
}

.cred-health-agent {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-2);
}

/* ── My Teams (GAP-7) ── */

.mt-page {
  padding: var(--space-6);
  max-width: 1200px;
}

.mt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

.mt-header h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
}

.mt-count {
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-normal);
  font-size: var(--text-base);
  margin-left: var(--space-2);
}

.mt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.mt-team-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mt-team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.mt-team-header:hover {
  background: var(--color-bg-tertiary);
}

.mt-team-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.mt-team-name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-base);
}

.mt-agent-count {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.mt-team-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.mt-team-actions button {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  background: transparent;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.mt-team-actions button:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.mt-team-actions button.danger:hover {
  border-color: var(--color-red);
  color: var(--color-red);
}

.mt-chevron {
  transition: transform 0.2s;
  color: var(--color-text-tertiary);
}

.mt-chevron.expanded {
  transform: rotate(180deg);
}

.mt-team-body {
  border-top: 1px solid var(--color-border-default);
  padding: var(--space-3) var(--space-4);
}

.mt-agent-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}

.mt-agent-row + .mt-agent-row {
  border-top: 1px solid var(--color-border-subtle);
}

.mt-agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mt-agent-dot.running { background: var(--color-green); }
.mt-agent-dot.error { background: var(--color-red); }
.mt-agent-dot.starting { background: var(--color-yellow); }
.mt-agent-dot.stopped { background: var(--color-text-tertiary); }

.mt-agent-name {
  font-weight: var(--font-weight-medium);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mt-agent-role {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.mt-agent-task {
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mt-agent-model {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.mt-agent-time {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  min-width: 50px;
  text-align: right;
}

.mt-agent-actions {
  display: flex;
  gap: var(--space-1);
}

.mt-agent-actions button {
  padding: 2px 6px;
  font-size: var(--text-xs);
  background: transparent;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.mt-agent-actions button:hover {
  background: var(--color-bg-tertiary);
}

.mt-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-tertiary);
}

.mt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.mt-modal {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 90%;
  max-width: 480px;
}

.mt-modal h3 {
  margin-bottom: var(--space-4);
  font-size: var(--text-lg);
}

.mt-modal label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.mt-modal input,
.mt-modal textarea {
  width: 100%;
  padding: var(--space-2);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

.mt-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.mt-picker-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.mt-picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: background 0.15s;
}

.mt-picker-item:hover {
  background: var(--color-bg-tertiary);
}

.mt-picker-item + .mt-picker-item {
  border-top: 1px solid var(--color-border-subtle);
}

/* GAP-12: Team cost summary */
.mt-team-cost {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  background: var(--color-bg-tertiary);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
}

.mt-cost-card {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-2);
}

.mt-cost-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.mt-cost-turns {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.mt-cost-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mt-cost-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}

.mt-cost-row + .mt-cost-row {
  border-top: 1px solid var(--color-border-subtle);
}

.mt-cost-agent {
  flex: 1;
  color: var(--color-text-primary);
}

.mt-cost-value {
  font-weight: var(--font-weight-medium);
  min-width: 60px;
  text-align: right;
}

/* GAP-15: Role select dropdown */
.role-select {
  appearance: auto;
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  cursor: pointer;
}

.role-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .mt-page {
    padding: var(--space-4);
  }

  .mt-header {
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
  }

  .mt-agent-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .mt-agent-task,
  .mt-agent-model {
    display: none;
  }
}

/* ===== Browser Page (VNC embed) ===== */

.browser-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  padding: var(--space-4);
}

.browser-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-3);
}

.browser-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.browser-title h1 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.browser-status {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.browser-status--error {
  color: var(--color-danger);
}

.browser-viewport {
  flex: 1;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.browser-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ─── Upgrade CTA ─────────────────────────────────────── */

.upgrade-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  min-height: 60vh;
  gap: var(--space-4);
}

.upgrade-cta-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-2);
}

.upgrade-cta-icon svg {
  width: 28px;
  height: 28px;
}

.upgrade-cta-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.upgrade-cta-desc {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  max-width: 420px;
  line-height: 1.5;
  margin: 0;
}

.upgrade-cta-btn {
  padding: var(--space-3) var(--space-6);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-default);
  margin-top: var(--space-2);
}

.upgrade-cta-btn:hover {
  opacity: 0.9;
}

.upgrade-cta-current {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  margin: 0;
}
