:root {
  --bg: #090c15;
  --surface: rgba(18, 24, 38, 0.75);
  --surface-border: rgba(255, 255, 255, 0.08);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #6366f1;
  --accent-cyan: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  padding: 16px;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-tld {
  color: var(--accent-cyan);
}

.status-orb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

/* Badges & Pills */
.badge {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  color: var(--muted);
}

.badge-private { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border-color: rgba(99, 102, 241, 0.4); }
.badge-online { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.badge-accent { background: rgba(6, 182, 212, 0.2); color: #67e8f9; border-color: rgba(6, 182, 212, 0.4); }

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 20px;
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Cards */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.pulse-indicator {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--success);
  animation: pulse 2s infinite;
}

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

/* Metrics & Telemetry */
.metrics-list { display: flex; flex-direction: column; gap: 12px; }

.metric-item { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.metric-label { color: var(--muted); }
.metric-value { font-weight: 600; font-size: 0.82rem; }

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill { height: 100%; border-radius: 4px; }
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }

/* Agent Cards */
.agent-list { display: flex; flex-direction: column; gap: 10px; }

.agent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: white;
}

.agent-avatar.allen { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.agent-avatar.aleph { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.agent-avatar.codex { background: linear-gradient(135deg, #f59e0b, #d97706); }
.agent-avatar.atlas { background: linear-gradient(135deg, #10b981, #059669); }

.agent-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.agent-name { font-weight: 700; font-size: 0.88rem; }
.agent-role { font-weight: 400; font-size: 0.75rem; color: var(--muted); margin-left: 4px; }
.agent-status { font-size: 0.75rem; color: var(--muted); }

.status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.status-pill.active { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.status-pill.idle { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.status-pill.review { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Tabs & Tasks */
.task-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--surface-border); padding-bottom: 10px; }
.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.tab-btn.active { background: var(--accent); color: white; }

.task-feed { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.task-card-item {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-title-row { display: flex; justify-content: space-between; align-items: center; }
.task-title { font-weight: 700; font-size: 0.9rem; }
.task-assignee { font-size: 0.78rem; font-weight: 700; color: var(--accent-cyan); }
.task-desc { font-size: 0.8rem; color: var(--muted); }

/* Buttons */
.btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }

/* Prompt Box */
.prompt-box { display: flex; flex-direction: column; gap: 10px; }
#prompt-input {
  width: 100%;
  height: 70px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--surface-border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  resize: none;
}

.prompt-actions { display: flex; justify-content: space-between; gap: 10px; }
#agent-select {
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  border: 1px solid var(--surface-border);
}

/* QC Feed */
.qc-feed { display: flex; flex-direction: column; gap: 10px; }
.qc-card {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qc-badge { font-size: 0.7rem; font-weight: 700; width: fit-content; padding: 2px 6px; border-radius: 4px; }
.qc-badge.alert { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.qc-badge.success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.qc-title { font-weight: 700; font-size: 0.85rem; }
.qc-meta { font-size: 0.75rem; color: var(--muted); }
.qc-time { font-size: 0.7rem; color: var(--muted); text-align: right; }

/* Cloudflare Stats */
.cf-stats { display: flex; flex-direction: column; gap: 8px; font-size: 0.82rem; }
.cf-stat-row { display: flex; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.text-accent { color: var(--accent-cyan); }

/* ── Mobile: simplify & de-crowd ─────────────────────────────────────── */
@media (max-width: 640px) {
  body { padding: 10px; }

  /* Top bar: stack brand and profile, drop the redundant status pill */
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }
  .brand { flex-wrap: wrap; row-gap: 6px; }
  .brand-name { font-size: 1.15rem; }
  .badge-online { display: none; } /* redundant with the lock badge + operator tag */
  .user-profile { font-size: 0.78rem; gap: 8px; }

  .dashboard-grid { gap: 14px; }
  .grid-col { gap: 14px; }
  .glass-card { padding: 14px; gap: 12px; }
  .card-header h3 { font-size: 0.95rem; }
  .card-header { flex-wrap: wrap; gap: 6px; row-gap: 6px; }

  /* Task tabs: scroll instead of wrapping into a crowded stack */
  .task-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .task-tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; white-space: nowrap; }

  .task-title-row { flex-wrap: wrap; gap: 4px; }

  /* Prompt controls: full-width stacked instead of squeezed side by side */
  .prompt-actions { flex-direction: column; }
  #agent-select, .prompt-actions .btn { width: 100%; }

  .agent-card { padding: 8px; gap: 10px; }
}
