/* ═══════════════════════════════════════════════════════════════
   AARUNYA — AI Agents Demo Platform Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── SHARED HELPERS ──────────────────────────────────────────── */

/* Rate-limit banner */
.rate-limit-banner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 24px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 10px;
  margin: 16px 0;
}
.rate-limit-banner .rl-icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.rate-limit-banner strong { display: block; color: #fbbf24; font-size: 1rem; margin-bottom: 6px; }
.rate-limit-banner p { color: var(--text-secondary); font-size: 0.875rem; margin: 0 0 4px; line-height: 1.5; }
.rate-limit-banner .rl-hint { color: var(--text-muted); font-size: 0.8rem; }

.container-wide {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 24px;
}

.panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.btn-ghost-sm {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-ghost-sm:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* ── AGENTS HERO ─────────────────────────────────────────────── */
.agents-hero {
  position: relative;
  padding: 140px 24px 72px;
  overflow: hidden;
  text-align: center;
}

.agents-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgba(0,212,255,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 60%, rgba(123,97,255,0.06) 0%, transparent 70%);
}

.agents-hero-content { position: relative; z-index: 1; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 28px;
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: livePulse 1.5s ease infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

.agents-hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.agents-hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.agents-hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 32px;
  backdrop-filter: blur(12px);
}
.ah-stat { font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); padding: 0 20px; }
.ah-stat span { font-weight: 800; color: var(--grad-1); margin-right: 4px; }
.ah-divider { width: 1px; height: 20px; background: var(--border); }

/* ── RATE LIMIT MODAL ────────────────────────────────────────── */
@keyframes rateModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.rate-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 8, 20, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.rate-modal-overlay.hidden { display: none; }

.rate-modal {
  position: relative;
  background: linear-gradient(145deg, #0d1526, #0a1120);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 20px;
  padding: 36px 36px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  animation: rateModalIn 0.32s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* Ambient glow behind modal */
.rate-modal-glow {
  position: absolute;
  inset: -1px;
  border-radius: 21px;
  background: linear-gradient(135deg, rgba(0,212,255,0.08), rgba(123,97,255,0.06));
  pointer-events: none;
  z-index: -1;
}

.rate-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}
.rate-modal-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 14px;
}
.rate-modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.rate-modal-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.rate-modal-limits {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}
.rml-card {
  padding: 20px;
  text-align: center;
}
.rml-card-heavy { background: rgba(123,97,255,0.04); }
.rml-divider {
  width: 1px;
  background: var(--border);
  margin: 14px 0;
}
.rml-agents {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 10px;
}
.rml-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #00D4FF;
  line-height: 1;
}
.rml-card-heavy .rml-count { color: #a78bfa; }
.rml-count span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

.rate-modal-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 28px;
}

.rate-modal-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 10px;
  background: linear-gradient(135deg, #00D4FF, #7B61FF);
  border: none;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  font-family: 'Inter', sans-serif;
}
.rate-modal-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.rate-modal-btn:active { transform: translateY(0); }

@media (max-width: 520px) {
  .rate-modal { padding: 28px 20px 24px; }
  .rate-modal-title { font-size: 1.1rem; }
  .rml-count { font-size: 1.6rem; }
}

/* ── DEMO PLATFORM ───────────────────────────────────────────── */
.demo-platform {
  background: var(--bg-secondary);
  padding: 0 0 80px;
}

/* ── TAB BAR ─────────────────────────────────────────────────── */
.tab-bar-outer {
  position: sticky;
  top: 72px;
  z-index: 100;
  background: rgba(8, 15, 31, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

/* Centered inner row — same max-width as container-wide */
.tab-bar-inner {
  max-width: 1340px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

/* Left/right fade edges — relative to the inner wrapper */
.tab-bar-inner {
  position: relative;
}
.tab-bar-inner::before,
.tab-bar-inner::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.2s;
}
.tab-bar-inner::before {
  left: 60px;
  background: linear-gradient(to right, rgba(8,15,31,0.9), transparent);
}
.tab-bar-inner::after {
  right: 60px;
  background: linear-gradient(to left, rgba(8,15,31,0.9), transparent);
}
.tab-bar-outer.at-start .tab-bar-inner::before { opacity: 0; }
.tab-bar-outer.at-end   .tab-bar-inner::after  { opacity: 0; }

.agent-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
}

.agent-tabs::-webkit-scrollbar { display: none; }

/* ── Scroll arrow buttons ───────────────────────────────────── */
.tab-arr {
  flex-shrink: 0;
  width: 36px;
  height: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, opacity 0.2s;
  z-index: 3;
  padding: 0;
}
.tab-arr:hover { color: var(--text-primary); }
.tab-arr:disabled { opacity: 0.2; cursor: default; }

.agent-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.agent-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.04); }
.agent-tab.active {
  color: var(--grad-1);
  background: rgba(0,212,255,0.07);
  border-color: rgba(0,212,255,0.2);
}

/* ── TAB PANELS ──────────────────────────────────────────────── */
.tab-panel {
  display: none;
  padding: 32px 0 0;
  max-width: 1340px;
  margin: 0 auto;
}
.tab-panel.active { display: block; }

/* ── AGENT HEADER ────────────────────────────────────────────── */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  gap: 16px;
  flex-wrap: wrap;
}

.agent-identity { display: flex; align-items: center; gap: 14px; }

.agent-avatar {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}
.doc-avatar   { background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.15); }
.wf-avatar    { background: rgba(123,97,255,0.08); border: 1px solid rgba(123,97,255,0.15); }
.chat-avatar  { background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.15); }
.res-avatar   { background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.15); }
.mon-avatar   { background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.15); }
.infra-avatar { background: rgba(123,97,255,0.08); border: 1px solid rgba(123,97,255,0.15); }

.agent-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.agent-name em { font-style: normal; color: var(--grad-1); }
.agent-version { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

.agent-status-wrap { display: flex; align-items: center; }
.agent-status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 6px 14px; border-radius: 100px;
}
.status-ready  { background: rgba(100,116,139,0.12); border: 1px solid rgba(100,116,139,0.2); color: var(--text-muted); }
.status-online { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.25); color: #22c55e; }
.status-busy   { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.25); color: #fbbf24; }
.status-error  { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #ef4444; }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  animation: statusPulse 2s ease infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── PANEL LAYOUT ────────────────────────────────────────────── */
.panel-body { padding: 0 24px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 24px;
}

.panel-left, .panel-right {
  display: flex; flex-direction: column; gap: 0;
}

.input-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}

.action-row {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
}

/* ── DOCUMENT AGENT ──────────────────────────────────────────── */
.sample-btns { display: flex; gap: 6px; }
.sample-btn {
  font-size: 0.76rem; font-weight: 600; padding: 5px 12px;
  border-radius: 6px; border: 1px solid var(--border);
  background: none; color: var(--text-muted); cursor: pointer;
  transition: var(--transition); font-family: 'Inter', sans-serif;
}
.sample-btn.active, .sample-btn:hover {
  border-color: rgba(0,212,255,0.35); color: var(--grad-1);
  background: rgba(0,212,255,0.06);
}

.doc-textarea {
  width: 100%; min-height: 320px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  line-height: 1.7; padding: 16px; resize: vertical; outline: none;
  transition: var(--transition);
}
.doc-textarea:focus { border-color: rgba(0,212,255,0.35); background: rgba(0,212,255,0.02); }

/* Processing Stages */
.stages-block {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px;
}
.stage-title {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px;
}
.stage-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.83rem; color: var(--text-muted); padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04); transition: var(--transition);
}
.stage-item:last-child { border-bottom: none; }
.stage-item.running { color: var(--grad-1); }
.stage-item.done    { color: #22c55e; }

.stage-icon {
  font-size: 0.9rem; width: 18px; text-align: center;
  font-family: 'JetBrains Mono', monospace; flex-shrink: 0;
}

/* JSON Viewer */
.output-block { flex: 1; display: flex; flex-direction: column; }
.output-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.output-meta { font-size: 0.72rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.json-viewer {
  flex: 1; min-height: 280px;
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  line-height: 1.8; color: var(--text-secondary);
  overflow-y: auto; max-height: 440px;
}

.json-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; min-height: 200px;
  gap: 12px; color: var(--text-muted); text-align: center;
}
.json-placeholder p { font-size: 0.83rem; font-family: 'Inter', sans-serif; }

.json-key    { color: #7dd3fc; }
.json-str    { color: #86efac; }
.json-num    { color: #fbbf24; }
.json-bool   { color: #f472b6; }
.json-null   { color: #94a3b8; }
.json-punctuation { color: #64748b; }
.json-flag   { color: #f97316; }

.business-output {
  font-family: 'Inter', sans-serif;
  color: var(--text-secondary);
  line-height: 1.6;
}

.business-output h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.business-output h4 {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grad-1);
  margin: 20px 0 8px;
}

.business-output p {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.business-output ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.business-output li {
  position: relative;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.business-output li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grad-main);
}

.business-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 8px;
}

.business-kpi {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}

.business-kpi span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.business-kpi strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.business-alert {
  border: 1px solid rgba(251,191,36,0.24);
  background: rgba(251,191,36,0.06);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 14px;
  color: #fbbf24;
  font-size: 0.86rem;
}

@media (max-width: 600px) {
  .business-kpi-grid { grid-template-columns: 1fr; }
}

/* ── WORKFLOW AGENT ──────────────────────────────────────────── */
.wf-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }

.wf-templates { display: flex; flex-direction: column; gap: 8px; }
.wf-tmpl-btn {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.85rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); padding: 11px 14px; border-radius: 10px;
  cursor: pointer; transition: var(--transition); text-align: left;
  font-family: 'Inter', sans-serif; width: 100%;
}
.wf-tmpl-btn.active, .wf-tmpl-btn:hover {
  border-color: rgba(123,97,255,0.4); color: #7B61FF;
  background: rgba(123,97,255,0.07);
}

.wf-legend { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }
.legend-dot.ai     { background: var(--grad-1); }
.legend-dot.human  { background: #7B61FF; }
.legend-dot.system { background: #64748b; }

/* Workflow Steps */
.wf-main { display: flex; flex-direction: column; gap: 16px; }
.wf-steps-wrap { position: relative; }
.wf-steps { display: flex; flex-direction: column; gap: 8px; }

.wf-step {
  display: grid; grid-template-columns: 40px 1fr auto;
  align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 18px;
  transition: all 0.4s ease;
}
.wf-step.active  { border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.04); }
.wf-step.done    { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.04); }
.wf-step.skipped { opacity: 0.5; }

.wf-step-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); transition: var(--transition);
  font-family: 'JetBrains Mono', monospace;
}
.wf-step.active .wf-step-icon  { background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.3); }
.wf-step.done   .wf-step-icon  { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); }

.wf-step-info { min-width: 0; }
.wf-step-name  { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.wf-step-detail { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }

.wf-step-badge {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 4px; text-transform: uppercase; white-space: nowrap;
}
.badge-ai     { background: rgba(0,212,255,0.12); color: var(--grad-1); }
.badge-human  { background: rgba(123,97,255,0.12); color: #7B61FF; }
.badge-system { background: rgba(100,116,139,0.12); color: var(--text-muted); }
.badge-trigger { background: rgba(34,197,94,0.12); color: #22c55e; }
.badge-done   { background: rgba(34,197,94,0.12); color: #22c55e; }

/* Workflow log */
.wf-log-wrap { }
.wf-log {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px; height: 120px;
  overflow-y: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem;
}
.log-entry {
  display: flex; gap: 10px; padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.log-time  { color: var(--text-muted); flex-shrink: 0; }
.log-msg   { color: var(--text-secondary); }
.log-msg.ai { color: var(--grad-1); }
.log-msg.success { color: #22c55e; }
.log-msg.warn { color: #fbbf24; }
.log-placeholder { color: var(--text-muted); font-size: 0.78rem; font-family: 'Inter', sans-serif; }

/* ── CHAT AGENT ──────────────────────────────────────────────── */
.chat-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px;
}

.chat-window {
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  height: 520px;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: rgba(0,212,255,0.2) transparent;
}

.chat-msg {
  display: flex; gap: 10px; max-width: 80%;
  animation: msgSlide 0.3s ease;
}
@keyframes msgSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.chat-msg.user { margin-left: auto; flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0; align-self: flex-end;
}
.msg-avatar-agent { background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.2); color: var(--grad-1); }
.msg-avatar-user  { background: rgba(123,97,255,0.1); border: 1px solid rgba(123,97,255,0.2); color: #7B61FF; }

.chat-msg-content {}
.chat-bubble {
  padding: 11px 15px; border-radius: 12px;
  font-size: 0.87rem; line-height: 1.6;
}
.bubble-agent {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-primary); border-bottom-left-radius: 4px;
}
.bubble-user {
  background: rgba(123,97,255,0.12); border: 1px solid rgba(123,97,255,0.2);
  color: var(--text-primary); border-bottom-right-radius: 4px;
}
.chat-msg-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; padding: 0 4px; }
.chat-msg.user .chat-msg-time { text-align: right; }

/* Typing indicator */
.typing-indicator {
  display: flex; gap: 4px; align-items: center; padding: 12px 16px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 12px; border-bottom-left-radius: 4px; width: fit-content;
}
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: typingBounce 1.4s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-quick-chips {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-top: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; flex-shrink: 0;
}
.chat-quick-chips::-webkit-scrollbar { display: none; }
.chip-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.quick-chip {
  font-size: 0.75rem; font-weight: 500; padding: 5px 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 100px; cursor: pointer;
  transition: var(--transition); white-space: nowrap; font-family: 'Inter', sans-serif;
}
.quick-chip:hover { border-color: var(--border-hover); color: var(--text-primary); }

.chat-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input {
  flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-primary); font-family: 'Inter', sans-serif;
  font-size: 0.88rem; padding: 10px 14px; outline: none; transition: var(--transition);
}
.chat-input:focus { border-color: rgba(0,212,255,0.35); background: rgba(0,212,255,0.03); }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--grad-main); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: var(--transition); flex-shrink: 0;
}
.chat-send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(0,212,255,0.3); }

/* Intelligence Panel */
.intel-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  height: 520px; overflow-y: auto;
}
.intel-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.intel-label { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }
.intel-value { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); text-align: right; max-width: 55%; }

.confidence-bar-wrap { display: flex; align-items: center; gap: 8px; }
.confidence-bar {
  width: 80px; height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 3px; overflow: hidden;
}
.confidence-fill {
  height: 100%; background: var(--grad-main); border-radius: 3px;
  transition: width 0.6s ease;
}

.intel-divider { height: 1px; background: var(--border); margin: 10px 0; }
.intel-section-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; display: block; }

.intel-actions { display: flex; flex-direction: column; gap: 7px; }
.intel-action {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.79rem; color: var(--text-secondary);
}
.intel-action::before { content: '→'; color: var(--grad-1); font-weight: 700; }
.intel-action-placeholder { font-size: 0.79rem; color: var(--text-muted); font-style: italic; }

/* ── RESEARCH AGENT ──────────────────────────────────────────── */
.res-preset-btns { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.res-preset {
  font-size: 0.85rem; font-weight: 600; padding: 10px 14px; text-align: left;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: 10px; cursor: pointer;
  transition: var(--transition); font-family: 'Inter', sans-serif;
}
.res-preset.active, .res-preset:hover {
  border-color: rgba(0,212,255,0.35); color: var(--grad-1);
  background: rgba(0,212,255,0.06);
}

.res-custom-wrap { display: flex; gap: 8px; }
.res-custom-input {
  flex: 1; background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-family: 'Inter', sans-serif;
  font-size: 0.85rem; padding: 9px 12px; outline: none; transition: var(--transition);
}
.res-custom-input:focus { border-color: rgba(0,212,255,0.35); }

.res-params { }
.res-param-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; color: var(--text-secondary); padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.res-param-val { font-size: 0.78rem; color: var(--grad-1); font-weight: 600; }
.res-depth-btns { display: flex; gap: 4px; }
.depth-btn {
  font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: none; color: var(--text-muted);
  cursor: pointer; transition: var(--transition); font-family: 'Inter', sans-serif;
}
.depth-btn.active { border-color: rgba(0,212,255,0.3); color: var(--grad-1); background: rgba(0,212,255,0.06); }

/* Research Output */
.research-output {
  flex: 1; min-height: 420px;
  background: rgba(0,0,0,0.2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px; overflow-y: auto;
  max-height: 520px;
}

.report-title {
  font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}
.report-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 20px; font-family: 'JetBrains Mono', monospace; }
.report-section { margin-bottom: 20px; }
.report-section-title {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--grad-1); margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,212,255,0.15);
}
.report-text { font-size: 0.87rem; color: var(--text-secondary); line-height: 1.75; }
.report-bullets { margin: 8px 0 0 0; padding: 0; list-style: none; }
.report-bullets li {
  font-size: 0.85rem; color: var(--text-secondary); padding: 4px 0 4px 16px;
  position: relative; line-height: 1.6;
}
.report-bullets li::before { content: ''; position: absolute; left: 0; top: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--grad-main); }

.report-sources { font-size: 0.75rem; color: var(--text-muted); font-style: italic; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }

/* ── MONITORING AGENT ────────────────────────────────────────── */
.monitoring-layout { display: flex; flex-direction: column; gap: 20px; }

.metrics-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px; transition: var(--transition);
}
.metric-card.anomaly { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.04); animation: anomalyPulse 1s ease 3; }
@keyframes anomalyPulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 20px rgba(239,68,68,0.25); } }

.metric-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 10px; }
.metric-value { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 12px; }
.metric-unit { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); margin-left: 2px; }

.metric-bar-wrap { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
.metric-bar-fill { height: 100%; background: var(--grad-main); border-radius: 2px; transition: width 0.6s ease; }
.metric-bar-fill.green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.metric-bar-fill.red   { background: linear-gradient(90deg, #ef4444, #dc2626); }

.metric-status { font-size: 0.72rem; font-weight: 600; }
.metric-status.ok      { color: #22c55e; }
.metric-status.warning { color: #fbbf24; }
.metric-status.critical { color: #ef4444; }

.monitor-body {
  display: grid; grid-template-columns: 1fr 340px; gap: 20px;
}

.chart-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px;
}
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chart-legend { display: flex; gap: 16px; }
.cl-normal  { font-size: 0.75rem; color: var(--grad-1); font-family: 'JetBrains Mono', monospace; }
.cl-anomaly { font-size: 0.75rem; color: #ef4444; font-family: 'JetBrains Mono', monospace; }

#latencyChart { width: 100%; height: 180px; display: block; }

.alert-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px;
}
.alert-log { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.alert-entry { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; }
.alert-entry.info    { background: rgba(100,116,139,0.08); border: 1px solid rgba(100,116,139,0.15); }
.alert-entry.warn    { background: rgba(251,191,36,0.06); border: 1px solid rgba(251,191,36,0.2); }
.alert-entry.critical { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.2); }
.alert-entry.resolved { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.2); }
.alert-time { font-size: 0.68rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.alert-msg  { font-size: 0.79rem; color: var(--text-secondary); line-height: 1.5; }
.alert-entry.warn .alert-msg    { color: #fbbf24; }
.alert-entry.critical .alert-msg { color: #ef4444; }
.alert-entry.resolved .alert-msg { color: #22c55e; }

/* ── INFRASTRUCTURE ──────────────────────────────────────────── */
.endpoint-list { display: flex; flex-direction: column; gap: 6px; }
.endpoint-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; color: inherit; font: inherit; text-align: left;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: var(--transition);
}
.endpoint-item.active, .endpoint-item:hover { border-color: rgba(0,212,255,0.3); background: rgba(0,212,255,0.04); }

.ep-method {
  font-size: 0.65rem; font-weight: 800; padding: 2px 7px;
  border-radius: 4px; letter-spacing: 0.04em;
}
.ep-method.post { background: rgba(123,97,255,0.15); color: #7B61FF; }
.ep-method.get  { background: rgba(34,197,94,0.12); color: #22c55e; }
.ep-path { font-size: 0.78rem; font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.req-block {}
.code-block {
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.76rem;
  line-height: 1.8; color: var(--text-secondary); overflow-y: auto; max-height: 240px;
  white-space: pre-wrap; word-break: break-word;
}
.response-block { max-height: 300px; }

.res-stats { display: flex; gap: 12px; }
.res-stat-pill {
  font-size: 0.72rem; font-weight: 600; padding: 3px 10px;
  border-radius: 6px; font-family: 'JetBrains Mono', monospace;
}
.pill-green { background: rgba(34,197,94,0.1); color: #22c55e; border: 1px solid rgba(34,197,94,0.2); }
.pill-blue  { background: rgba(0,212,255,0.1); color: var(--grad-1); border: 1px solid rgba(0,212,255,0.2); }

.integrations-block {}
.integrations-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.integration-pill {
  font-size: 0.76rem; font-weight: 500; padding: 5px 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 100px; color: var(--text-secondary); transition: var(--transition); cursor: default;
}
.integration-pill:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* ── AGENTS CTA ──────────────────────────────────────────────── */
.agents-cta {
  background: var(--bg-primary);
  padding: 80px 24px; text-align: center;
  border-top: 1px solid var(--border);
}
.agents-cta-inner { max-width: 600px; margin: 0 auto; }
.agents-cta h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem); font-weight: 800;
  line-height: 1.15; margin-bottom: 16px;
}
.agents-cta p { font-size: 1rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 36px; }
.agents-cta-btns { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
  .wf-layout { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .monitor-body { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .metrics-row { grid-template-columns: repeat(2,1fr); }
  .agents-hero { padding: 110px 20px 52px; }
  .panel-body { padding: 0 16px; }
  .agent-header { padding: 16px; }
}

@media (max-width: 500px) {
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .agent-tabs { gap: 2px; padding: 10px 4px; }
  .tab-arr { width: 28px; min-height: 44px; }
}

@media (max-width: 380px) {
  .agent-tab span { display: none; }
  .agent-tab { padding: 10px 12px; }
}

@media (max-width: 768px) {
  .agent-tab,
  .btn-ghost-sm,
  .sample-btn,
  .wf-tmpl-btn,
  .quick-chip,
  .res-preset,
  .endpoint-item,
  .chat-send-btn {
    min-height: 44px;
  }
}
