:root {
  --bg-primary: #0d1117;
  --bg-secondary: #151b24;
  --bg-card: #1c2333;
  --bg-card-hover: #232b3e;
  --bg-input: #0d1117;
  --border: #293042;
  --border-hover: #4a5280;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #5d6570;
  --accent: #6c5ce7;
  --accent-light: #8b7cf7;
  --accent-glow: rgba(108, 92, 231, 0.25);
  --green: #00d4aa;
  --green-dim: rgba(0, 212, 170, 0.15);
  --red: #ff4757;
  --red-dim: rgba(255, 71, 87, 0.15);
  --yellow: #ffa502;
  --yellow-dim: rgba(255, 165, 2, 0.15);
  --blue: #45aaf2;
  --blue-dim: rgba(69, 170, 242, 0.15);
  --pink: #fd79a8;
  --purple: #a29bfe;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --sidebar-width: 260px;
}

[data-theme="light"] {
  --bg-primary: #f0f2f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f7fe;
  --bg-input: #f0f2f8;
  --border: #e2e5f0;
  --border-hover: #6c5ce7;
  --text-primary: #1a1d2e;
  --text-secondary: #6b7194;
  --text-muted: #9ea3c0;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.08);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-glow); color: white; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 2px 0 24px rgba(0,0,0,0.08);
}

.sidebar.collapsed {
  width: 68px;
  min-width: 68px;
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .agent-status-text,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  margin: 1px 6px;
}
.sidebar.collapsed .nav-item .nav-icon {
  width: auto;
  font-size: 18px;
}
.sidebar.collapsed .nav-item.active::before { left: -6px; }
.sidebar.collapsed .sidebar-section { padding: 4px 0; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; gap: 0; }
.sidebar.collapsed .sidebar-toggle { position: absolute; right: -18px; top: 18px; background: var(--bg-secondary); border: 1px solid var(--border); border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; width: 24px; height: 36px; opacity: 0.9; z-index: 200; cursor: pointer; box-shadow: 3px 0 8px rgba(0,0,0,0.15); transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.sidebar.collapsed .sidebar-toggle:hover { opacity: 1; width: 28px; }
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 12px 0; flex-direction: column; gap: 8px; align-items: center; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-svg { flex-shrink: 0; filter: drop-shadow(0 2px 8px rgba(108, 92, 231, 0.3)); }
.logo-text {
  font-weight: 700; font-size: 16px; white-space: nowrap;
  background: linear-gradient(135deg, var(--accent-light), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px;
  border-radius: var(--radius-sm); transition: var(--transition);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  opacity: 0.6;
}
.sidebar-toggle:hover { background: var(--bg-card); color: var(--text-primary); opacity: 1; }
.toggle-icon { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.sidebar-section { padding: 8px 12px 4px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  padding: 8px 8px 4px; white-space: nowrap;
}

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 8px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 1px 0;
  color: var(--text-secondary); text-decoration: none;
  border-radius: var(--radius); font-size: 13px; font-weight: 500;
  transition: var(--transition); cursor: pointer; white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-glow); color: var(--accent-light);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; 
  background: var(--accent-glow); color: var(--accent-light);
  line-height: 1.2; white-space: nowrap; min-width: 18px;
  text-align: center; flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.agent-status-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.agent-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.agent-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green-dim); animation: pulseDot 2s ease-in-out infinite; }
.agent-dot.offline { background: var(--red); box-shadow: 0 0 8px var(--red-dim); }
.agent-dot.warning { background: var(--yellow); box-shadow: 0 0 8px var(--yellow-dim); animation: pulseDot 3s ease-in-out infinite; }

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 4px var(--green-dim); }
  50% { box-shadow: 0 0 16px var(--green-dim), 0 0 32px var(--green-dim); }
}
@keyframes pulseDotWarning {
  0%, 100% { box-shadow: 0 0 4px var(--yellow-dim); }
  50% { box-shadow: 0 0 16px var(--yellow-dim), 0 0 32px var(--yellow-dim); }
}
.agent-dot.warning { animation: pulseDotWarning 3s ease-in-out infinite; }
.agent-status-text { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.theme-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: var(--transition);
  flex-shrink: 0;
}
.theme-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.sidebar.collapsed .theme-btn { width: 34px; height: 34px; font-size: 16px; border-color: var(--accent-glow); }

/* ─── Main Content ─── */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; border-bottom: 1px solid var(--border);
  min-height: 56px; background: var(--bg-secondary);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  color: var(--text-muted); font-size: 13px;
  transition: var(--transition);
}
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.topbar-search input {
  background: none; border: none; color: var(--text-primary);
  font-size: 13px; outline: none; width: 180px;
}
.topbar-search input::placeholder { color: var(--text-muted); }

.page-content {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto; padding: 24px 28px;
  min-height: 0;
}

/* ─── Page Header ─── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header-left {}
.page-title { font-size: 22px; font-weight: 700; background: linear-gradient(135deg, var(--text-primary), var(--accent-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
}
.card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(135deg, rgba(108,92,231,0.03), transparent 50%);
  pointer-events: none;
}
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
.card:active { transform: translateY(0); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }

.stat-card {
  position: relative; overflow: hidden;
  padding: 20px;
}
.stat-card::after {
  content: ''; position: absolute; top: -20%; right: -10%;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(108,92,231,0.06) 0%, transparent 70%);
  border-radius: 50%;
}
.stat-card:hover::after { opacity: 0.8; }
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
  position: relative;
}
.stat-icon.purple { background: var(--accent-glow); color: var(--accent-light); box-shadow: 0 0 20px rgba(108,92,231,0.1); }
.stat-icon.green { background: var(--green-dim); color: var(--green); box-shadow: 0 0 20px rgba(0,212,170,0.1); }
.stat-icon.blue { background: var(--blue-dim); color: var(--blue); box-shadow: 0 0 20px rgba(69,170,242,0.1); }
.stat-icon.yellow { background: var(--yellow-dim); color: var(--yellow); box-shadow: 0 0 20px rgba(255,165,2,0.1); }
.stat-icon.red { background: var(--red-dim); color: var(--red); box-shadow: 0 0 20px rgba(255,71,87,0.1); }
.stat-value {
  font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-change {
  font-size: 11px; font-weight: 600; margin-top: 6px;
  display: inline-flex; align-items: center; gap: 3px;
}
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ─── Grid ─── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap; font-family: var(--font);
  user-select: none; line-height: 1.2;
}
.btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5a4bd1);
  color: white; border-color: transparent; position: relative; overflow: hidden;
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.btn-primary:hover { 
  background: linear-gradient(135deg, #7b6df7, #6c5ce7);
  box-shadow: 0 4px 20px var(--accent-glow); border-color: transparent;
}
.btn-primary:hover::before { opacity: 1; }
.btn-danger { background: var(--red); color: white; border-color: transparent; }
.btn-danger:hover { box-shadow: 0 4px 16px var(--red-dim); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-group { display: flex; gap: 6px; }

/* ─── Tables ─── */
.table-wrapper {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 14px; text-align: left; font-size: 13px; }
th {
  background: var(--bg-secondary);
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
td { border-top: 1px solid var(--border); }
tr:first-child td { border-top: none; }
tr:hover td { background: var(--bg-card-hover); }
tr { transition: background 0.15s; }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); color: var(--text-primary);
  font-size: 13px; font-family: var(--font);
  transition: var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea { min-height: 100px; resize: vertical; font-family: var(--font-mono); font-size: 12px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--red); font-size: 12px; margin-top: 3px; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
}
.badge-success { background: var(--green-dim); color: var(--green); }
.badge-warning { background: var(--yellow-dim); color: var(--yellow); }
.badge-danger { background: var(--red-dim); color: var(--red); }
.badge-info { background: var(--blue-dim); color: var(--blue); }
.badge-accent { background: var(--accent-glow); color: var(--accent-light); }

/* ─── Skill Card ─── */
.skill-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: var(--transition); cursor: pointer;
  display: flex; flex-direction: column;
}
.skill-card:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(108, 92, 231, 0.15);
}
.skill-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.skill-card-icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  background: var(--accent-glow); color: var(--accent-light);
}
.skill-card-name { font-weight: 600; font-size: 14px; }
.skill-card-desc { font-size: 12px; color: var(--text-secondary); flex: 1; line-height: 1.4; }
.skill-card-footer {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ─── Chart ─── */
.chart-container {
  position: relative; height: 240px; width: 100%;
  margin: 12px 0;
}

/* ─── Loading ─── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--text-muted); gap: 10px;
  flex-direction: column;
}
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Toast ─── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  animation: toastSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
  backdrop-filter: blur(12px);
}
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--yellow); }
@keyframes toastSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 560px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
@keyframes modalSlideUp { from { transform: translateY(20px) scale(0.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Empty State ─── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state-icon { font-size: 48px; opacity: 0.4; }
.empty-state-title { font-size: 16px; font-weight: 600; }
.empty-state-desc { font-size: 13px; max-width: 360px; }

/* ─── Code / Pre ─── */
code, pre { font-family: var(--font-mono); font-size: 12px; }
pre {
  background: var(--bg-primary);
  padding: 14px; border-radius: var(--radius);
  overflow-x: auto; border: 1px solid var(--border);
  line-height: 1.5; color: var(--text-secondary);
}

/* ─── Tabs ─── */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--border);
  margin-bottom: 16px; overflow-x: auto;
}
.tab {
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: var(--transition);
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-light); border-bottom-color: var(--accent); }

/* ─── Event / Activity Items ─── */
.event-list { display: flex; flex-direction: column; gap: 0; }
.event-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }
.event-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; flex-shrink: 0;
}
.event-content { flex: 1; }
.event-title { font-size: 13px; font-weight: 500; }
.event-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.event-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ─── Status Indicators ─── */
.status-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.status-indicator.online { background: var(--green-dim); color: var(--green); }
.status-indicator.offline { background: var(--red-dim); color: var(--red); }
.status-indicator.warning { background: var(--yellow-dim); color: var(--yellow); }

/* ─── Agent Status Cards ─── */
.agent-card-list { display: flex; gap: 10px; flex-wrap: wrap; }
.agent-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  flex: 1; min-width: 140px; transition: var(--transition);
}
.agent-card:hover { border-color: var(--border-hover); }

/* ─── Top Loading Bar ─── */
#topLoadingBar {
  position: fixed; top: 0; left: 0; width: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--pink), var(--accent));
  z-index: 99999;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
  opacity: 0;
  background-size: 200% 100%;
  animation: loadingBarShimmer 1s linear infinite;
}
#topLoadingBar.active { opacity: 1; }
@keyframes loadingBarShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Page Transitions ─── */
.page-enter {
  animation: pageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .topbar-search { display: none; }
  .page-content { padding: 16px; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── Quick Run Input ─── */
.quick-run {
  display: flex; gap: 8px; align-items: center;
}
.quick-run input { flex: 1; }

/* ─── Progress Bar ─── */
.progress-bar {
  width: 100%; height: 4px; background: var(--bg-primary);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--pink));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Switch / Toggle ─── */
.switch {
  position: relative; width: 40px; height: 22px; flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-input); border-radius: 11px;
  border: 1px solid var(--border); transition: var(--transition);
}
.switch-slider::before {
  content: ''; position: absolute; width: 16px; height: 16px;
  left: 2px; bottom: 2px; background: var(--text-muted);
  border-radius: 50%; transition: var(--transition);
}
.switch input:checked + .switch-slider { background: var(--accent-glow); border-color: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); background: var(--accent); }

/* ─── Divider ─── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ─── Flex helpers ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Chat Interface ─── */
.chat-layout {
  display: flex; gap: 0;
  flex: 1;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-sidebar {
  width: 200px; min-width: 200px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg-secondary);
  padding: 8px;
}
.chat-agents-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  padding: 10px 8px 6px; margin-bottom: 4px;
}
.chat-agent {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; transition: all 0.2s;
  margin-bottom: 2px; position: relative;
}
.chat-agent:hover { background: var(--bg-card); transform: translateX(2px); }
.chat-agent.active { background: var(--accent-glow); }
.chat-agent.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.chat-agent-name { font-size: 13px; font-weight: 600; }
.chat-agent-desc { font-size: 11px; color: var(--text-muted); }
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%;
  text-align: center; color: var(--text-muted);
  gap: 8px; padding: 20px;
}
.chat-welcome-icon {
  font-size: 48px; opacity: 0.3;
  filter: drop-shadow(0 4px 20px rgba(108,92,231,0.2));
}
.chat-welcome-title { font-size: 18px; font-weight: 700; color: var(--text-secondary); }
.chat-welcome-desc { font-size: 13px; max-width: 400px; line-height: 1.5; }
.chat-message {
  display: flex; gap: 12px; max-width: 80%;
  animation: chatIn 0.25s cubic-bezier(0.4,0,0.2,1);
}
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.assistant { align-self: flex-start; }
@keyframes chatIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-message-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.chat-message-body {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 16px;
  min-width: 60px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.chat-message.user .chat-message-body {
  background: linear-gradient(135deg, rgba(108,92,231,0.15), rgba(108,92,231,0.08));
  border-color: rgba(108,92,231,0.3);
}
.chat-message-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.chat-message-agent { font-size: 12px; font-weight: 600; }
.chat-message-time { font-size: 10px; color: var(--text-muted); margin-left: auto; }
.chat-message-content { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.chat-input-area {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.chat-agent-indicator {
  font-size: 11px; font-weight: 700; color: var(--accent-light);
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--accent-glow); white-space: nowrap;
  flex-shrink: 0; margin-bottom: 4px;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px; font-family: var(--font);
  outline: none; resize: none;
  max-height: 150px; line-height: 1.4;
  transition: var(--transition);
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.chat-input::placeholder { color: var(--text-muted); }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 4px 0; }
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@media (max-width: 700px) {
  .chat-sidebar { display: none; }
  .chat-message { max-width: 95%; }
}
