/* ═══════════════════════════════════════════════════════════════════
   A2A Enterprise Gateway — Scripted Demo
   Chat + Interactive Graph with 30-second step animations
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-deep: #f8fafc;
  --bg-primary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-2: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.1);
  --border-active: rgba(99, 102, 241, 0.5);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --cyan: #06b6d4;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --blue: #3b82f6;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 12px;
}

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

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
}

/* ══════════════════════════════════════════════════════════════════
   CHAT PANEL
   ══════════════════════════════════════════════════════════════════ */
.chat-panel {
  width: 400px;
  min-width: 280px;
  max-width: 80vw;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  z-index: 10;
  position: relative;
}

/* ── Resize Handle (right edge drag strip) ────────────────────────── */
.resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
  transition: background 0.15s ease;
}

.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.15s ease;
}

.resize-handle:hover::after,
.resize-handle.active::after {
  background: var(--indigo);
}

.resize-handle:hover,
.resize-handle.active {
  background: rgba(99, 102, 241, 0.08);
}

/* Prevent text selection & iframe interference while dragging */
body.resizing {
  cursor: col-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

body.resizing iframe {
  pointer-events: none !important;
}

.chat-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-header__logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.logo-icon {
  font-size: 1.5rem;
}

.chat-header__title {
  font-size: 0.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-header__status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-dot {
  width: 5px;
  height: 5px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
  }
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-glass-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.user-badge__icon {
  font-size: 1.2rem;
}

.user-badge__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-badge__role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.message {
  max-width: 95%;
  animation: msgIn 0.4s ease-out;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  align-self: flex-end;
}

.message.system,
.message.assistant {
  align-self: flex-start;
}

.message__content {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.55;
}

.message.user .message__content {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: white;
  border-bottom-right-radius: 4px;
}

.message.system .message__content,
.message.assistant .message__content {
  background: var(--bg-glass-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-bottom-left-radius: 4px;
}

.message.assistant .message__content {
  color: var(--text-primary);
}

/* Typing dots */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 0.5rem 0.9rem;
  background: var(--bg-glass-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.typing-dots span {
  width: 5px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: dotBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Demo Controls */
.demo-controls {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.demo-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.demo-progress__label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.demo-progress__bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.demo-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.btn-next {
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: white;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-next.running {
  animation: pulseBtn 2s ease-in-out infinite;
}

@keyframes pulseBtn {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
  }
}

/* ══════════════════════════════════════════════════════════════════
   GRAPH PANEL
   ══════════════════════════════════════════════════════════════════ */
.graph-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(6, 182, 212, 0.03) 0%, transparent 50%),
    var(--bg-deep);
}

.graph-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.graph-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.graph-area.hidden {
  display: none !important;
}

/* ── Global View Toggle ───────────────────────────────────────────── */
.global-view-toggle {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 100px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.global-view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.global-view-btn:hover {
  color: var(--text-primary);
}

.global-view-btn.active {
  background: var(--primary-color, #6366f1);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* ── Mock Chrome Browser ──────────────────────────────────────────── */
.browser-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  margin: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 50;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.browser-container.hidden {
  display: none !important;
}

.browser-topbar {
  display: flex;
  align-items: center;
  background: #f1f3f4;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e0e0e0;
  gap: 1rem;
}

.browser-mac-buttons {
  display: flex;
  gap: 6px;
}

.mac-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mac-btn.close { background: #ff5f56; }
.mac-btn.close:hover { background: #e0443e; box-shadow: 0 0 5px rgba(255,95,86,0.5); }
.mac-btn.minimize { background: #ffbd2e; cursor: default; }
.mac-btn.expand { background: #27c93f; cursor: default; }

.browser-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #5f6368;
}

.browser-actions svg {
  cursor: pointer;
  transition: color 0.2s;
}

.browser-actions svg:hover {
  color: #202124;
}

.browser-address-bar {
  flex: 1;
  background: #ffffff;
  border-radius: 100px;
  padding: 0.35rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font);
  font-size: 0.75rem;
  color: #333;
  border: 1px solid #ddd;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.browser-address-bar .lock-icon {
  color: #5f6368;
}

.browser-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #ffffff;
}

.browser-iframe.hidden {
  display: none !important;
}

/* ── Google Search New Tab ────────────────────────────────────────── */
.browser-new-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.browser-new-tab.hidden {
  display: none !important;
}

.google-logo {
  font-size: 5.5rem;
  font-weight: 500;
  letter-spacing: -3px;
  margin-bottom: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  user-select: none;
}

.google-search-bar {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 580px;
  padding: 0.8rem 1.4rem;
  border-radius: 24px;
  border: 1px solid #dfe1e5;
  box-shadow: 0 1px 6px rgba(32,33,36,0.1);
  margin-bottom: 2rem;
  transition: box-shadow 0.2s;
}

.google-search-bar:hover, .google-search-bar:focus-within {
  box-shadow: 0 1px 6px rgba(32,33,36,0.28);
  border-color: transparent;
}

.search-icon {
  color: #9aa0a6;
}

.google-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  margin-left: 0.8rem;
  color: rgba(0,0,0,0.87);
}

.google-buttons {
  display: flex;
  gap: 1rem;
}

.google-buttons button {
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  background: #f8f9fa;
  border-radius: 4px;
  color: #3c4043;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.google-buttons button:hover {
  border: 1px solid #dadce0;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  color: #202124;
}

.graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.graph-nodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ── Graph Nodes ──────────────────────────────────────────────────── */
.graph-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: default;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
}

.node-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  transition: all 0.5s ease;
  position: relative;
}

.node-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.4s;
}

.node-sublabel {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.4s;
}

/* Master Router — bigger circle */
.node-master .node-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  font-size: 2rem;
  border-width: 2px;
}

.node-master .node-label {
  font-size: 0.85rem;
  font-weight: 700;
}

.node-ring {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px dashed rgba(99, 102, 241, 0.12);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -65%);
  pointer-events: none;
  animation: ringRotate 25s linear infinite;
}

@keyframes ringRotate {
  to {
    transform: translate(-50%, -65%) rotate(360deg);
  }
}

/* User node */
.node-user .node-icon {
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
}

/* ── Node Positions (7 agents) ────────────────────────────────────── */
.node-user {
  top: 4%;
  left: 50%;
  transform: translateX(-50%);
}

.node-master {
  top: 27%;
  left: 50%;
  transform: translateX(-50%);
}

.node-context {
  top: 16%;
  left: 17%;
  transform: translateX(-50%);
}

.node-personalization {
  top: 38%;
  left: 17%;
  transform: translateX(-50%);
}

.node-tagger {
  top: 16%;
  left: 83%;
  transform: translateX(-50%);
}

.node-registry {
  top: 52%;
  left: 50%;
  transform: translateX(-50%);
}

/* 8 agents spread evenly */
.node-gong {
  top: 78%;
  left: 6%;
  transform: translateX(-50%);
}

.node-salesforce {
  top: 78%;
  left: 18%;
  transform: translateX(-50%);
}

.node-calendar {
  top: 78%;
  left: 31%;
  transform: translateX(-50%);
}

.node-rag {
  top: 78%;
  left: 44%;
  transform: translateX(-50%);
}

.node-mindtickle {
  top: 78%;
  left: 56%;
  transform: translateX(-50%);
}

.node-webex {
  top: 78%;
  left: 69%;
  transform: translateX(-50%);
}

.node-seismic {
  top: 78%;
  left: 82%;
  transform: translateX(-50%);
}

.node-research {
  top: 78%;
  left: 94%;
  transform: translateX(-50%);
}

/* ── Node States ──────────────────────────────────────────────────── */
.graph-node.active .node-icon {
  border-color: var(--indigo);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.4), 0 0 70px rgba(99, 102, 241, 0.15);
  transform: scale(1.15);
}

.graph-node.active .node-label {
  color: var(--text-primary);
}

.graph-node.completed .node-icon {
  border-color: var(--emerald);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.25);
}

.graph-node.completed .node-label {
  color: var(--emerald);
}

/* Agent-specific glow */
.node-gong.active .node-icon {
  border-color: var(--amber);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.node-salesforce.active .node-icon {
  border-color: var(--blue);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.node-calendar.active .node-icon {
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.4);
}

.node-rag.active .node-icon {
  border-color: var(--violet);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

.node-mindtickle.active .node-icon {
  border-color: var(--emerald);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

.node-webex.active .node-icon {
  border-color: var(--blue);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.node-seismic.active .node-icon {
  border-color: var(--amber);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.node-research.active .node-icon {
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.4);
}

.graph-node.dimmed {
  opacity: 0.18;
}

/* ── SVG Edges ────────────────────────────────────────────────────── */
.graph-svg line {
  stroke: rgba(0, 0, 0, 0.08);
  stroke-width: 1.5;
  fill: none;
  transition: stroke 0.5s ease, stroke-width 0.4s ease, opacity 0.5s ease;
}

.graph-svg .edge-active {
  stroke: var(--indigo);
  stroke-width: 2.5;
  filter: url(#glow);
  opacity: 1;
}

.graph-svg .edge-completed {
  stroke: var(--emerald);
  stroke-width: 1.5;
  opacity: 0.45;
}

/* ── Info Card ────────────────────────────────────────────────────── */
.info-card {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  padding: 0.8rem 1rem;
  min-width: 210px;
  max-width: 300px;
  z-index: 20;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.35s ease;
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.55);
}

.info-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.info-card__header {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--indigo);
  margin-bottom: 0.45rem;
}

.info-card__body {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.info-card__body strong {
  color: var(--text-primary);
}

.info-card__body .tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  margin: 0.1rem 0.12rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-family: var(--mono);
  background: rgba(99, 102, 241, 0.12);
  color: var(--indigo);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.info-card__body .tag.entity {
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.12);
}

.info-card__body .tag.domain {
  background: rgba(139, 92, 246, 0.1);
  color: var(--violet);
  border-color: rgba(139, 92, 246, 0.12);
}

.info-card__body .row {
  display: flex;
  justify-content: space-between;
  padding: 0.18rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
}

.info-card__body .row:last-child {
  border: none;
}

.info-card__body .val {
  font-family: var(--mono);
  color: var(--emerald);
  font-weight: 600;
  font-size: 0.68rem;
}

/* ── Step Indicator ───────────────────────────────────────────────── */
.step-indicator {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  backdrop-filter: blur(12px);
  z-index: 10;
}

.step-indicator__label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.step-indicator.active .step-indicator__label {
  color: var(--indigo);
}

.step-indicator.done .step-indicator__label {
  color: var(--emerald);
}

/* ── Chat response formatting ─────────────────────────────────────── */
.response-block {
  margin-top: 0.3rem;
}

.response-block strong {
  color: var(--indigo);
  font-size: 0.78rem;
}

.response-block p {
  margin: 0.15rem 0;
  font-size: 0.78rem;
  line-height: 1.5;
}

.response-block .detail {
  margin: 0.35rem 0;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border-left: 2px solid var(--indigo);
  font-size: 0.75rem;
}

.response-block .detail-title {
  font-weight: 600;
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
}

.response-block .detail p {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════════════
   LOGIN OVERLAY
   ══════════════════════════════════════════════════════════════════ */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 30% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.login-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

.login-card {
  width: 400px;
  padding: 2.5rem;
  background: rgba(15, 20, 35, 0.8);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  text-align: center;
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(99, 102, 241, 0.08);
  animation: loginSlideUp 0.6s ease-out;
}

@keyframes loginSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  font-size: 3rem;
  margin-bottom: 0.8rem;
  animation: loginPulse 3s ease-in-out infinite;
}

@keyframes loginPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.login-btn {
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: white;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 0.3rem;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.35);
}

.login-btn:active {
  transform: translateY(0);
}

.login-footer {
  margin-top: 1.5rem;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

.shake {
  animation: shake 0.4s ease;
}

/* ══════════════════════════════════════════════════════════════════
   CHAT INPUT BAR
   ══════════════════════════════════════════════════════════════════ */

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.chat-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.chat-input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════════
   STREAMING MESSAGE CURSOR
   ══════════════════════════════════════════════════════════════════ */

.message__content.streaming::after {
  content: "▊";
  color: var(--indigo);
  animation: cursor-blink 0.8s step-end infinite;
  margin-left: 1px;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

.message__content code {
  padding: 0.12rem 0.35rem;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--indigo);
}

/* ══════════════════════════════════════════════════════════════════
   CONNECTION STATUS
   ══════════════════════════════════════════════════════════════════ */

.status-connected {
  background: var(--emerald) !important;
}

.status-connecting {
  background: var(--amber) !important;
  animation: pulse 1s ease-in-out infinite !important;
}

.status-error {
  background: var(--rose) !important;
}

/* ══════════════════════════════════════════════════════════════════
   ACTIVITY PANEL (Right Side)
   ══════════════════════════════════════════════════════════════════ */

.activity-panel {
  height: 220px;
  min-height: 180px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: rgba(6, 10, 20, 0.95);
}

.activity-header-bar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.activity-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.activity-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.activity-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.activity-entry {
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  animation: activitySlideIn 0.3s ease-out;
  transition: all 0.3s ease;
}

.activity-entry.completed {
  border-color: rgba(16, 185, 129, 0.15);
  background: rgba(16, 185, 129, 0.03);
}

@keyframes activitySlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.activity-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.activity-agent {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.activity-status {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.4rem;
  border-radius: 100px;
  flex-shrink: 0;
}

.activity-status.status-dispatched {
  color: var(--indigo);
  background: rgba(99, 102, 241, 0.12);
}

.activity-status.status-working {
  color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
}

.activity-status.status-completed {
  color: var(--emerald);
  background: rgba(16, 185, 129, 0.12);
}

.activity-message {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════
   EXPAND / COLLAPSE BUTTON
   ══════════════════════════════════════════════════════════════════ */

.chat-header__top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-expand {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-glass-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-expand:hover {
  color: var(--text-primary);
  border-color: var(--indigo);
  background: rgba(99, 102, 241, 0.1);
}

/* ══════════════════════════════════════════════════════════════════
   EXPANDED (FULLSCREEN CHAT) MODE
   ══════════════════════════════════════════════════════════════════ */

.app.chat-expanded .chat-panel {
  width: 100%;
  min-width: 100%;
}

.app.chat-expanded .graph-panel {
  display: none;
}

.app.chat-expanded .message {
  max-width: 75%;
}

/* ══════════════════════════════════════════════════════════════════
   MARKDOWN RENDERING STYLES
   ══════════════════════════════════════════════════════════════════ */

.message__content .md-h1 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0.6rem 0 0.3rem 0;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.message__content .md-h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.5rem 0 0.25rem 0;
}

.message__content .md-h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.4rem 0 0.2rem 0;
}

.message__content .md-h4,
.message__content .md-h5,
.message__content .md-h6 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0.35rem 0 0.15rem 0;
}

.message__content .md-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

.message__content .md-blockquote {
  padding: 0.4rem 0.7rem;
  margin: 0.35rem 0;
  border-left: 3px solid var(--indigo);
  background: rgba(99, 102, 241, 0.06);
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.5;
}

.message__content .md-list {
  margin: 0.3rem 0;
  padding-left: 1.3rem;
}

.message__content .md-list li {
  margin: 0.15rem 0;
  line-height: 1.5;
}

.message__content .md-table-wrapper {
  margin: 0.5rem 0;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.message__content .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}

.message__content .md-table th,
.message__content .md-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.message__content .md-table th {
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.message__content .md-table tr:last-child td {
  border-bottom: none;
}

.message__content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.message__content em {
  color: var(--text-secondary);
  font-style: italic;
}

.dynamic-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  word-break: break-all;
  border-bottom: 1px dashed rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.dynamic-link:hover {
  color: #1d4ed8;
  border-bottom: 1px solid #1d4ed8;
  background: rgba(37, 99, 235, 0.05);
}

/* ══════════════════════════════════════════════════════════════════
   AESTHETIC ENHANCEMENTS
   ══════════════════════════════════════════════════════════════════ */

.node-icon {
  background: rgba(15, 20, 35, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.graph-node.active .node-icon {
  background: rgba(15, 20, 35, 0.85);
}

.message {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chat-input {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVENESS (Media Queries)
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 950px) {

  /* Switch from row split to column split */
  .app {
    flex-direction: column;
  }

  .chat-panel {
    width: 100%;
    min-width: 100%;
    height: 45vh;
    /* Take up top 45% */
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .chat-messages {
    flex: 1;
  }

  /* When expanded on mobile, take 100% height */
  .app.chat-expanded .chat-panel {
    height: 100vh;
  }

  .graph-panel {
    flex: 1;
    height: 55vh;
    /* Take up bottom 55% */
  }

  .node-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 8px;
  }

  .node-master .node-icon {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  .node-user .node-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .node-ring {
    width: 60px;
    height: 60px;
  }

  .node-label {
    font-size: 0.55rem;
  }

  .node-sublabel {
    font-size: 0.45rem;
  }

  .step-indicator {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
  }

  /* Shrink overlay on very small screens */
  .login-card {
    width: 90%;
    padding: 1.5rem;
  }
}

@media (max-height: 700px) {

  /* Shrink vertically if height is constrained */
  .chat-panel {
    height: 50vh;
  }

  .graph-panel {
    height: 50vh;
  }

  .activity-panel {
    height: 100px;
    /* Keep activity log smaller on short screens */
  }
}