/**
 * GAIAI Agent OS — Neural Swarm Observatory & X-Ray Telemetry Stylesheet
 * File: src/voice/static/css/swarm-observatory.css
 * Design Standard: Palantir / SpaceX / Linear Obsidian Glassmorphism
 * Responsive: Desktop (>=768px Right X-Ray Drawer + Pan/Zoom Canvas) &
 *             Mobile (<768px Zero-Overflow 2-Row HUD + Cluster Deck + 85vh Bottom-Sheet X-Ray)
 */

/* ==========================================================================
   1. FULLSCREEN COMMAND MODE (F / ESC — Hides TopBar & NavRail for 100vw x 100vh)
   ========================================================================== */
body.swarm-fullscreen-active #top-bar,
body.swarm-fullscreen-active #nav-rail,
body.swarm-fullscreen-active #swarm-panel {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

body.swarm-fullscreen-active #app-root,
body.swarm-fullscreen-active #app-container,
body.swarm-fullscreen-active #main-content,
body.swarm-fullscreen-active #swarm-view {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

/* ==========================================================================
   2. OBSERVATORY ROOT & STAGE CONTAINERS
   ========================================================================== */
#swarm-view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #091326 0%, #050811 55%, #030408 100%);
  color: #f4f4f5;
  font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
  box-sizing: border-box;
}

.swarm-observatory-root,
.swarm-observatory-container,
.agent-os-universe-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  overflow: hidden;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 20% 20%, rgba(6, 182, 212, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 80% 75%, rgba(99, 102, 241, 0.07) 0%, transparent 45%),
    #04060c;
}

.swarm-observatory-stage,
.swarm-stage-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.swarm-canvas-viewport,
.swarm-canvas-container {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.swarm-canvas-viewport:active,
.swarm-canvas-container:active {
  cursor: grabbing;
}

.swarm-observatory-canvas,
#swarm-observatory-canvas,
#pcb-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Floating Camera Controls (Bottom Left on Canvas) */
.swarm-camera-controls,
.swarm-canvas-controls {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(10, 14, 24, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.swarm-cam-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  gap: 5px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.swarm-cam-btn.swarm-cam-fit-btn,
.swarm-cam-btn.swarm-cam-zoom-readout {
  width: auto;
  padding: 0 9px;
}

.swarm-cam-btn:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
  color: #ffffff;
}

/* ==========================================================================
   3. FLOATING FUTURISTIC HUD BAR (SwarmHud.js)
   ========================================================================== */
.swarm-hud-bar {
  position: relative;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 8px 18px;
  background: rgba(8, 12, 21, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), inset 0 -1px 0 rgba(56, 189, 248, 0.12);
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Left Group: Brand + 3 Real-Time Active Metrics */
.swarm-hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
}

.swarm-hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.swarm-hud-orb-wrap {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.swarm-hud-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.12);
}

.swarm-hud-orb-ring.is-pulsing {
  animation: swarmHudPulse 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  border-color: rgba(16, 185, 129, 0.65);
  background: rgba(16, 185, 129, 0.2);
}

.swarm-hud-orb-core {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00f0ff;
  box-shadow: 0 0 10px #00f0ff;
}

@keyframes swarmHudPulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.95); opacity: 0; }
}

.swarm-hud-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.swarm-hud-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.swarm-hud-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  white-space: nowrap;
}

.swarm-hud-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  white-space: nowrap;
}

@media (max-width: 1620px) {
  .swarm-hud-live-pill {
    display: none !important;
  }
}

.swarm-hud-live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.swarm-hud-subtitle {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
}

/* 4 Core Telemetry Metric Chips */
.swarm-hud-metrics {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.swarm-metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 10.5px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.swarm-metric-chip.metric-emerald.is-hot {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.16);
}

.swarm-metric-chip.metric-amber.is-hot {
  background: rgba(245, 158, 11, 0.11);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.16);
}

.swarm-metric-chip.is-zero {
  opacity: 0.72;
}

.metric-led {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.led-cyan {
  background: #06b6d4;
  box-shadow: 0 0 7px rgba(6, 182, 212, 0.85);
}

.led-indigo {
  background: #818cf8;
  box-shadow: 0 0 7px rgba(129, 140, 248, 0.8);
}

.led-emerald-pulse {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-emerald 1.8s infinite;
}

.led-amber-pulse {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulse-amber 1.6s infinite;
}

.led-muted {
  background: #52525b;
}

.metric-value {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.metric-label {
  font-size: 10.5px;
  font-weight: 500;
  color: #94a3b8;
}

/* Center Group: Filters & View Mode Switcher */
.swarm-hud-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.swarm-filter-group,
.swarm-view-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
}

.swarm-hud-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
}

.swarm-filter-btn,
.swarm-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.swarm-filter-btn:hover,
.swarm-view-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.swarm-filter-btn.active[data-filter="all"] {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.swarm-filter-btn.active[data-filter="agy"] {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.48);
  color: #c7d2fe;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.22);
}

.swarm-filter-btn.active[data-filter="claude"] {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.48);
  color: #fde68a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.22);
}

.swarm-filter-btn.active[data-filter="active"] {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.22);
}

.swarm-filter-btn.active[data-filter="waiting"] {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.22);
}

.swarm-view-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.45);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.22);
}

.filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-agy { background: #6366f1; box-shadow: 0 0 6px #6366f1; }
.dot-claude { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.dot-live { background: #10b981; box-shadow: 0 0 6px #10b981; }
.dot-waiting, .dot-amber { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

/* Right Group: TR | EN Switcher, Refresh & Fullscreen Button */
.swarm-hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.swarm-lang-segmented {
  display: inline-flex;
  align-items: center;
  padding: 2.5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
}

.swarm-lang-btn {
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.swarm-lang-btn:hover {
  color: #ffffff;
}

.swarm-lang-btn.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.swarm-hud-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.swarm-hud-icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.swarm-hud-icon-btn.is-spinning svg {
  animation: spin 0.6s linear;
}

.swarm-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.swarm-fullscreen-btn:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.swarm-fullscreen-btn.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.48);
  color: #34d399;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.fullscreen-kbd {
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #94a3b8;
}

/* ==========================================================================
   4. CLUSTER DECK VIEW (Tree / Cluster Cards for Desktop & Mobile)
   ========================================================================== */
.swarm-cluster-deck,
.swarm-deck-view {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 80px;
  box-sizing: border-box;
}

.swarm-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.swarm-cluster-card {
  background: linear-gradient(180deg, rgba(13, 18, 30, 0.9) 0%, rgba(8, 11, 19, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.swarm-cluster-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.7), 0 0 20px rgba(6, 182, 212, 0.1);
}

.swarm-cluster-card.cluster-engine-claude {
  border-color: rgba(245, 158, 11, 0.25);
}

.swarm-cluster-card.cluster-is-running {
  border-color: rgba(16, 185, 129, 0.38);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 22px rgba(16, 185, 129, 0.12);
}

.cluster-master-node,
.cluster-master-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cluster-master-node:hover,
.cluster-master-header:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.32);
}

.cluster-subagent-tree,
.cluster-subagents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 14px;
  border-left: 2px solid rgba(56, 189, 248, 0.25);
  margin-left: 10px;
}

.cluster-subagent-card,
.cluster-subagent-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cluster-subagent-card::before,
.cluster-subagent-item::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: rgba(56, 189, 248, 0.3);
}

.cluster-subagent-card:hover,
.cluster-subagent-item:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateX(2px);
}

.cluster-subagent-card.is-running,
.cluster-subagent-item.is-running {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.07);
}

/* ==========================================================================
   5. X-RAY INSPECTOR DRAWER (SwarmInspector.js — Desktop Right Drawer)
   ========================================================================== */
.swarm-xray-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 88;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

@media (min-width: 769px) {
  /* On desktop, allow clicking canvas nodes directly without backdrop blocking */
  .swarm-xray-backdrop {
    display: none !important;
  }
}

.swarm-xray-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 44vw;
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.96) 0%, rgba(6, 9, 16, 0.98) 100%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-left: 1px solid rgba(56, 189, 248, 0.24);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.85), inset 1px 0 0 rgba(255, 255, 255, 0.06);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  overflow: hidden;
}

.swarm-xray-drawer.is-open {
  transform: translateX(0);
}

.xray-bottom-sheet-handle {
  display: none;
}

.xray-drawer-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.xray-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.xray-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.xray-node-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.xray-type-badge,
.xray-engine-badge,
.xray-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.xray-type-badge.badge-master {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #38bdf8;
}

.xray-type-badge.badge-subagent {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}

.xray-engine-badge.engine-agy {
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.xray-engine-badge.engine-claude {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.xray-state-badge {
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.xray-state-badge .xray-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.state-badge-running {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}
.state-badge-running .xray-state-dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.state-badge-waiting {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}
.state-badge-waiting .xray-state-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.state-badge-error {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}
.state-badge-error .xray-state-dot {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.state-badge-idle {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}
.state-badge-idle .xray-state-dot {
  background: #64748b;
}

.xray-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.xray-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.xray-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.xray-close-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.xray-node-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
}

.xray-node-subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.xray-node-role {
  font-size: 11px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xray-id-copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.xray-id-copy-pill:hover {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* Primary Action Row: Open in Cockpit */
.xray-primary-cta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.xray-btn-open-cockpit {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22) 0%, rgba(99, 102, 241, 0.22) 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.18);
}

.xray-btn-open-cockpit:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35) 0%, rgba(99, 102, 241, 0.35) 100%);
  border-color: #38bdf8;
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3);
}

.xray-btn-parent-node {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.xray-btn-parent-node:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Scrollable Body & Sections */
.xray-scroll-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.xray-loading-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 11.5px;
}

.xray-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.xray-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.meta-cell-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.meta-cell-val {
  font-size: 11.5px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xray-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.xray-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.xray-sec-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
}

.xray-sec-count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
}

.xray-code-box {
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(4, 7, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  user-select: text;
}

.xray-thinking-box {
  border-color: rgba(139, 92, 246, 0.32);
  background: rgba(19, 14, 36, 0.72);
  color: #ddd6fe;
}

.xray-thinking-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.xray-thinking-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xray-thinking-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.xray-output-box {
  border-color: rgba(245, 158, 11, 0.25);
}

.xray-empty-note {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: #64748b;
  font-size: 11px;
}

/* Subagent Quick Chips inside X-Ray */
.xray-subagent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.xray-subagent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.xray-subagent-chip:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}

.xray-subagent-chip.is-running {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
}

.xray-subagent-chip.is-waiting {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.09);
}

.subagent-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.subagent-chip-dot.dot-running { background: #10b981; box-shadow: 0 0 6px #10b981; }
.subagent-chip-dot.dot-waiting { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.subagent-chip-dot.dot-idle { background: #64748b; }

.subagent-chip-steps {
  font-size: 9.5px;
  color: #94a3b8;
}

/* Tool Calls Timeline */
.xray-tool-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.xray-tool-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.xray-tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.xray-tool-step {
  font-size: 10px;
  color: #64748b;
}

.xray-tool-name {
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xray-tool-target {
  font-size: 10px;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.28);
  padding: 1px 5px;
  border-radius: 4px;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xray-tool-status {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.xray-tool-status.is-ok {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.xray-tool-status.is-error {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.xray-tool-desc {
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.35;
}

/* IPC Messages Exchanged */
.xray-ipc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.xray-ipc-card {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xray-ipc-card.ipc-sent {
  border-left: 2.5px solid #38bdf8;
}

.xray-ipc-card.ipc-received {
  border-left: 2.5px solid #10b981;
}

.xray-ipc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 9.5px;
}

.ipc-dir-badge {
  font-weight: 700;
  color: #cbd5e1;
}

.ipc-peer-link {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  cursor: pointer;
}

.ipc-time {
  color: #64748b;
}

.xray-ipc-content {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 96px;
  overflow-y: auto;
}

/* ==========================================================================
   6. TABLET & COMPACT DESKTOP ADAPTATION (<= 1200px)
   ========================================================================== */
@media (max-width: 1200px) {
  .swarm-hud-subtitle,
  .swarm-hud-live-pill {
    display: none;
  }

  .swarm-metric-chip .metric-label {
    display: none;
  }

  .swarm-fullscreen-btn .fullscreen-kbd {
    display: none;
  }
}

/* ==========================================================================
   7. MOBILE P100 RESPONSIVE ARCHITECTURE (< 768px — 0px Overflow + Bottom-Sheet)
   ========================================================================== */
@media (max-width: 768px) {
  #swarm-view,
  .swarm-observatory-root,
  .swarm-observatory-container,
  .agent-os-universe-layout {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* 2-Row Touch-Friendly Compact HUD on Mobile */
  .swarm-hud-bar {
    flex-wrap: wrap;
    height: auto;
    min-height: auto;
    padding: 8px 10px;
    gap: 8px;
    width: 100vw;
    max-width: 100vw;
  }

  .swarm-hud-left {
    width: auto;
    flex: 1;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .swarm-hud-left::-webkit-scrollbar {
    display: none;
  }

  .swarm-hud-subtitle,
  .swarm-hud-live-pill {
    display: none !important;
  }

  .swarm-hud-title {
    font-size: 12px;
  }

  .swarm-hud-metrics {
    gap: 4px;
  }

  .swarm-metric-chip {
    height: 28px;
    padding: 0 7px;
    min-height: 28px;
  }

  .swarm-metric-chip .metric-label {
    display: none;
  }

  .swarm-hud-divider {
    display: none !important;
  }

  .swarm-hud-center {
    order: 3;
    width: 100%;
    justify-content: space-between !important;
    overflow-x: hidden !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 4px !important;
    padding-bottom: 2px;
  }
  .swarm-hud-center::-webkit-scrollbar {
    display: none;
  }

  .swarm-filter-group,
  .swarm-view-switcher {
    min-width: 0;
    flex-shrink: 1;
  }

  .swarm-hud-right {
    order: 2;
    flex-shrink: 0;
    margin-left: auto;
    gap: 5px;
  }

  .swarm-filter-btn,
  .swarm-view-btn {
    min-height: 28px !important;
    height: 28px !important;
    padding: 0 6px !important;
    font-size: 9.5px !important;
    gap: 4px;
  }

  .swarm-lang-segmented,
  .swarm-lang-toggle {
    height: 28px !important;
  }

  .swarm-lang-btn {
    min-height: 24px !important;
    height: 24px !important;
    padding: 0 6px !important;
  }

  .swarm-fullscreen-btn .fullscreen-btn-label,
  .swarm-fullscreen-btn .fullscreen-kbd {
    display: none;
  }

  .swarm-fullscreen-btn,
  .swarm-hud-icon-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
  }

  /* Cluster Deck Mobile Optimization */
  .swarm-cluster-deck,
  .swarm-deck-view {
    padding: 12px 10px 90px;
    width: 100vw;
    max-width: 100vw;
  }

  .swarm-deck-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Hide overlapping 3D Holo Monitors on small mobile screens to keep Canvas clean */
  .pcb-hud-stage-overlay .holo-screen-bus {
    display: none !important;
  }

  .pcb-hud-stage-overlay .holo-screen-cli {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }

  /* Bottom-Sheet X-Ray Inspector on Mobile (<768px) */
  .swarm-xray-backdrop.is-open {
    display: block !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1240;
  }

  .swarm-xray-drawer {
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 82vh !important;
    max-height: 85vh !important;
    border-left: none !important;
    border-top: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 20px 20px 0 0 !important;
    transform: translateY(105%) !important;
    z-index: 1250 !important;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.92) !important;
  }

  .swarm-xray-drawer.is-open {
    transform: translateY(0) !important;
  }

  .xray-bottom-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 4px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .xray-handle-bar {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
  }
}


/* ==========================================================================
   8. SWARM OBSERVATORY SHELL, 60 FPS NEURAL CANVAS & CLUSTER DECK (SwarmObservatory.js & SwarmCanvas.js)
   ========================================================================== */
.swarm-observatory-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  overflow: hidden;
  box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 35%, #091326 0%, #050811 55%, #030408 100%);
}

.swarm-observatory-hud-mount {
  flex-shrink: 0;
  width: 100%;
  z-index: 70;
}

.swarm-stage-canvas-wrap,
.swarm-stage-deck-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.swarm-stage-deck-wrap {
  overflow-y: auto;
  overflow-x: hidden;
}

.swarm-deck-container {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 24px 84px;
  box-sizing: border-box;
}

.swarm-observatory-inspector-mount {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

.swarm-observatory-inspector-mount .swarm-xray-drawer {
  pointer-events: auto;
}

/* Infinite Cyber Grid Background */
.swarm-canvas-grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(56, 189, 248, 0.14) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 245, 0.025) 1px, transparent 1px);
  background-size: 28px 28px, 112px 112px, 112px 112px;
  opacity: 0.85;
}

/* World Transform Stage (GPU Composite) */
.swarm-world-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.swarm-edges-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.swarm-nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 2;
}

/* Cluster Orbital Halos */
.cluster-orbit-ring-outer,
.cluster-orbit-ring-inner {
  fill: rgba(6, 182, 212, 0.015);
  stroke-width: 1.4;
  stroke-dasharray: 8 10;
  transition: stroke 0.3s ease, fill 0.3s ease;
}

.swarm-cluster-halo.engine-claude .cluster-orbit-ring-outer,
.swarm-cluster-halo.engine-claude .cluster-orbit-ring-inner {
  fill: rgba(245, 158, 11, 0.015);
}

.swarm-cluster-halo.is-active .cluster-orbit-ring-outer {
  stroke-dasharray: 12 8;
  animation: orbitHaloSpin 36s linear infinite;
}

@keyframes orbitHaloSpin {
  to { stroke-dashoffset: -360; }
}

/* SVG Cubic Bezier Synapse Edges */
.swarm-edge-glow {
  fill: none;
  stroke: rgba(56, 189, 248, 0.14);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke 0.25s ease, stroke-width 0.25s ease;
}

.swarm-edge-base {
  fill: none;
  stroke: rgba(148, 163, 184, 0.32);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.swarm-edge-flow {
  fill: none;
  stroke: rgba(56, 189, 248, 0.75);
  stroke-width: 2;
  stroke-dasharray: 8 10;
  animation: none;
  opacity: 0.25;
}

.swarm-edge-group.engine-claude .swarm-edge-flow {
  stroke: rgba(245, 158, 11, 0.85);
}

.swarm-edge-group.is-running .swarm-edge-glow {
  stroke: rgba(16, 185, 129, 0.28);
  stroke-width: 8;
}

.swarm-edge-group.is-running .swarm-edge-base {
  stroke: url(#grad-edge-agy-active);
  stroke-width: 2.4;
}

.swarm-edge-group.engine-claude.is-running .swarm-edge-base {
  stroke: url(#grad-edge-claude-active);
}

.swarm-edge-group.is-running .swarm-edge-flow {
  animation: synapseFlow 0.85s linear infinite;
  opacity: 1;
  stroke-width: 2.2px;
}

.swarm-edge-group.state-waiting .swarm-edge-base {
  stroke: rgba(245, 158, 11, 0.28);
}

.swarm-edge-group.state-waiting .swarm-edge-flow {
  stroke: rgba(245, 158, 11, 0.65);
  stroke-dasharray: 5 8;
  opacity: 0.78;
  animation: none;
}

.swarm-edge-group.is-highlighted .swarm-edge-glow {
  stroke: rgba(0, 240, 255, 0.45);
  stroke-width: 10;
}

.swarm-edge-photon {
  fill: #ffffff;
  filter: drop-shadow(0 0 8px #00f0ff);
}

.swarm-edge-group.engine-claude .swarm-edge-photon {
  fill: #fef3c7;
  filter: drop-shadow(0 0 8px #f59e0b);
}

@keyframes synapseFlow {
  to { stroke-dashoffset: -36; }
}

@keyframes orbitalSpin {
  to { transform: rotate(360deg); }
}

/* GPU-Accelerated Node Cards on Canvas */
.swarm-node-card {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  will-change: transform;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
}

.swarm-node-glow-backdrop {
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  background: radial-gradient(circle at 50% 50%, rgba(0, 240, 255, 0.32), transparent 70%);
}

.swarm-node-card:hover .swarm-node-glow-backdrop,
.swarm-node-card.is-selected .swarm-node-glow-backdrop {
  opacity: 1;
}

.swarm-node-inner {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 10px 10px;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(12, 18, 32, 0.92) 0%, rgba(7, 10, 19, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
}

.swarm-node-card.is-root-reactor .swarm-node-inner {
  border-color: rgba(56, 189, 248, 0.42);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.8), 0 0 26px rgba(6, 182, 212, 0.16);
}

.swarm-node-card.is-root-reactor.engine-claude .swarm-node-inner {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.8), 0 0 26px rgba(245, 158, 11, 0.16);
}

.swarm-node-card.state-running .swarm-node-inner {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 28px rgba(16, 185, 129, 0.24);
}

.swarm-node-card.state-waiting .swarm-node-inner,
.swarm-deck-cluster-card.state-waiting,
.deck-subagent-card.state-waiting {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.68), 0 0 18px rgba(245, 158, 11, 0.14);
}

.swarm-node-card.state-errored .swarm-node-inner,
.swarm-deck-cluster-card.state-errored,
.deck-subagent-card.state-errored {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 28px rgba(239, 68, 68, 0.25);
}

.swarm-node-card.is-selected .swarm-node-inner {
  border-color: #00f0ff !important;
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.45), 0 20px 48px rgba(0, 0, 0, 0.85) !important;
}

.swarm-node-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.swarm-node-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.swarm-engine-pill {
  font-size: 9px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 5px;
  letter-spacing: 0.04em;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.42);
  color: #c7d2fe;
  white-space: nowrap;
}

.swarm-engine-pill.engine-claude {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.swarm-wp-pill {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.swarm-meta-pill {
  font-size: 9px;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  white-space: nowrap;
}

.swarm-state-badge {
  font-size: 8.5px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.swarm-state-badge.state-running {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.swarm-state-badge.state-waiting {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.swarm-state-badge.state-errored {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #f87171;
}

.swarm-state-badge.state-idle {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #94a3b8;
}

.swarm-node-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.swarm-orbital-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swarm-node-card.is-root-reactor .swarm-orbital-avatar {
  width: 36px;
  height: 36px;
}

.swarm-orbital-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.orbital-track {
  stroke: rgba(255, 255, 255, 0.08);
}

.orbital-spinner-outer {
  stroke: #38bdf8;
  transform-origin: 22px 22px;
}

.orbital-spinner-inner {
  stroke: #818cf8;
  transform-origin: 22px 22px;
}

.swarm-node-card.engine-claude .orbital-spinner-outer {
  stroke: #f59e0b;
}

.swarm-node-card.state-running .orbital-spinner-outer {
  stroke: #10b981;
  animation: spin 3.2s linear infinite;
}

.swarm-node-card.state-running .orbital-spinner-inner {
  stroke: #38bdf8;
  animation: spin 2.1s linear infinite reverse;
}

.swarm-node-card.state-waiting .orbital-spinner-outer {
  stroke: #f59e0b;
  animation: orbitalSpin 8s linear infinite;
}

.swarm-orbital-core-icon {
  font-size: 13px;
  z-index: 1;
}

.swarm-node-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.swarm-node-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swarm-node-subline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swarm-node-model {
  color: #38bdf8;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swarm-node-subcount {
  color: #cbd5e1;
}

.swarm-node-tool-ribbon {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 10px;
  color: #94a3b8;
  overflow: hidden;
}

.swarm-tool-pulse-dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}

.swarm-node-card.state-running .swarm-tool-pulse-dot,
.swarm-deck-cluster-card.state-running .swarm-tool-pulse-dot,
.deck-subagent-card.state-running .swarm-tool-pulse-dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.state-waiting .swarm-tool-pulse-dot,
.dot-waiting,
.dot-amber {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.swarm-tool-name {
  color: #38bdf8;
  font-weight: 600;
  flex-shrink: 0;
}

.swarm-tool-summary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cbd5e1;
}

/* Bottom Center Multi-CLI Cluster Focus Dock */
.swarm-cluster-dock {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 420px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(8, 12, 22, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}
.swarm-cluster-dock::-webkit-scrollbar {
  display: none;
}

.swarm-dock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.swarm-dock-pill:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #ffffff;
}

.swarm-dock-pill.is-focused {
  background: rgba(6, 182, 212, 0.2);
  border-color: #00f0ff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
}

.dock-key {
  font-size: 9.5px;
  color: #94a3b8;
}

.dock-sub-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.dock-sub-pill.is-running {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

/* SwarmObservatory Cluster Deck Cards (.swarm-deck-cluster-card) */
.swarm-deck-cluster-card {
  background: linear-gradient(180deg, rgba(13, 19, 33, 0.92) 0%, rgba(8, 12, 21, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}

.swarm-deck-cluster-card.state-running {
  border-color: rgba(16, 185, 129, 0.4);
}

.deck-root-header {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
}

.deck-root-header:hover,
.deck-root-header.is-selected {
  background: rgba(56, 189, 248, 0.09);
  border-color: rgba(56, 189, 248, 0.4);
}

.deck-root-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.deck-root-badges,
.deck-root-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.deck-cockpit-btn {
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(6, 182, 212, 0.16);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #38bdf8;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.deck-cockpit-btn:hover {
  background: rgba(6, 182, 212, 0.28);
  color: #ffffff;
}

.deck-root-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.deck-root-model {
  font-size: 11px;
  color: #38bdf8;
}

.deck-tool-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 10.5px;
  overflow: hidden;
}

.deck-subagents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding-left: 12px;
  border-left: 2px solid rgba(56, 189, 248, 0.25);
}

.deck-subagent-card {
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
}

.deck-subagent-card:hover,
.deck-subagent-card.is-selected {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}

.deck-subagent-card.state-running {
  border-color: rgba(16, 185, 129, 0.42);
}

.deck-sub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.deck-sub-tier {
  font-size: 9.5px;
  color: #94a3b8;
}

.deck-sub-title {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}

.deck-sub-meta {
  font-size: 10px;
  color: #64748b;
}

.deck-no-subagents,
.swarm-deck-empty {
  padding: 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: #64748b;
  font-size: 11.5px;
  text-align: center;
}

@media (max-width: 768px) {
  .swarm-deck-container {
    padding: 12px 10px 90px;
  }

  .deck-subagents-grid {
    grid-template-columns: 1fr;
  }

  .swarm-cluster-dock {
    bottom: 10px;
    left: 10px;
    right: auto;
    transform: none;
    max-width: calc(100vw - 20px);
    padding: 4px 6px;
  }

  .swarm-dock-pill {
    min-height: 28px !important;
    height: 28px !important;
    padding: 0 8px !important;
    font-size: 10.5px !important;
  }

  .swarm-camera-controls {
    bottom: 54px;
    left: auto;
    right: 10px;
    padding: 3px 5px;
  }

  .swarm-cam-btn,
  .swarm-cam-zoom-readout,
  .swarm-cam-fit-btn {
    min-height: 28px !important;
    height: 28px !important;
  }
}
