:root {
  --bg: #05070f;
  --panel: rgba(13, 18, 37, 0.64);
  --line: rgba(102, 255, 220, 0.26);
  --text: #e8f4ff;
  --muted: #95a4c8;
  --neon-cyan: #43ffd1;
  --neon-blue: #4da5ff;
  --neon-pink: #ff56c9;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Space Grotesk", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100vh; position: relative; overflow-x: hidden; }

.bg-glow { position: fixed; width: 42vw; height: 42vw; filter: blur(74px); border-radius: 50%; z-index: 0; opacity: 0.34; }
.bg-glow-a { background: var(--neon-blue); top: -12vw; right: -8vw; }
.bg-glow-b { background: var(--neon-pink); bottom: -14vw; left: -10vw; }

.app-shell { position: relative; z-index: 2; max-width: 980px; margin: 0 auto; padding: 14px; display: grid; grid-template-columns: 1fr; gap: 12px; }

.glass { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(16px); box-shadow: 0 0 0 1px rgba(255,255,255,0.02), 0 18px 40px rgba(0,0,0,0.35); }

.topbar { padding: 14px; display: flex; justify-content: space-between; align-items: center; }
h1 { margin: 2px 0 0; font-size: 1.4rem; }
.label { margin: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; }

.pipeline, .agents, .chat, .memory { padding: 14px; }

.pipeline-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pipeline-form .textarea {
  min-height: 84px;
  resize: vertical;
}

.pipeline-form button {
  grid-column: 1 / -1;
}

.status {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pipeline-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pipeline-output {
  margin-top: 10px;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  background: rgba(8, 12, 24, 0.72);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
}

.agent-list { margin-top: 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.agent-card { padding: 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08); background: rgba(10, 14, 28, 0.8); color: var(--text); cursor: pointer; transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.agent-card:hover { transform: translateY(-1px); border-color: rgba(67,255,209,0.52); }
.agent-card.active { border-color: var(--neon-cyan); box-shadow: 0 0 18px rgba(67,255,209,0.25); }
.handoff-row { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.messages { max-height: 44vh; overflow: auto; padding: 6px 2px 2px; display: flex; flex-direction: column; gap: 8px; }
.msg { border-radius: 12px; padding: 10px 12px; font-size: 0.95rem; line-height: 1.4; white-space: pre-wrap; }
.msg.user { background: rgba(77,165,255,0.22); border: 1px solid rgba(77,165,255,0.48); }
.msg.assistant { background: rgba(67,255,209,0.16); border: 1px solid rgba(67,255,209,0.34); }
.msg.system { background: rgba(255,86,201,0.16); border: 1px solid rgba(255,86,201,0.34); }
.composer { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.memory-list { max-height: 24vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.memory-item { padding: 8px 10px; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; color: var(--muted); font-size: 0.84rem; }
.input, .select, .btn { border-radius: 10px; border: 1px solid rgba(255,255,255,0.16); background: rgba(8, 12, 24, 0.9); color: var(--text); padding: 10px 12px; width: 100%; }
.btn { cursor: pointer; }
.btn-primary { border-color: rgba(67,255,209,0.65); box-shadow: 0 0 14px rgba(67,255,209,0.25); }
.btn-ghost { border-color: rgba(255,255,255,0.18); }

@media (max-width: 760px) {
  .pipeline-form { grid-template-columns: 1fr; }
  .composer, .handoff-row, .pipeline-actions { grid-template-columns: 1fr; }
}
