/* ============================================================
   Agent Orchestration Pipeline - Visual Demo
   Dark, cinematic aesthetic inspired by jungheonlee.com
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #080c14;
  --text: #f8f9fb;
  --text-dim: #dce0e8;
  --text-faint: #a0a8b8;
  --accent: #7ae0ff;
  --chat-bg: #0e1420;
  --chat-border: rgba(255,255,255,0.2);
  --chat-msg-bg: rgba(255,255,255,0.08);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Agent colors */
  --c-orchestrator: #4FC3F7;
  --c-strategist: #81C784;
  --c-architect: #7986CB;
  --c-researcher: #4DB6AC;
  --c-ciso: #FFB74D;
  --c-executor: #CE93D8;
  --c-qa: #FF8A65;
  --c-librarian: #F06292;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* --- Disclaimer (removed by user request) --- */
#disclaimer {
  display: none;
}

/* --- Intro Overlay --- */
#introOverlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 1.2s var(--ease-out), visibility 1.2s;
}

#introOverlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

.intro-content {
  text-align: center;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
}

.intro-glow {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(106,216,255,0.18) 0%, transparent 70%);
  border-radius: 50%;
  animation: intro-glow-pulse 4s ease-in-out infinite;
}

@keyframes intro-glow-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.intro-title {
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 0.5rem;
  position: relative;
  text-shadow: 0 0 60px rgba(106,216,255,0.25), 0 0 120px rgba(106,216,255,0.08);
}

.intro-subtitle {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 2rem;
  text-shadow: 0 0 20px rgba(106,216,255,0.1);
}

/* "The one prompt" section on intro page */
.intro-prompt-section {
  max-width: 640px;
  margin: 0 auto 2.5rem;
  text-align: left;
}

.intro-prompt-label {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  opacity: 1;
}

.intro-prompt-text {
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.75;
  color: #e4e8f0;
  border-left: 2px solid rgba(122,224,255,0.55);
  padding: 1.2rem 1.5rem;
  margin: 0;
  font-style: normal;
  background: rgba(255,255,255,0.05);
  border-radius: 0 6px 6px 0;
}

/* Highlighted site reference inside prompt */
.prompt-site-ref {
  color: var(--accent);
  background: rgba(79,195,247,0.08);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(79,195,247,0.3);
}

/* Attachment chip (mimics VS Code agent chat) */
.prompt-attachment {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 4px 10px 4px 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.65);
  cursor: default;
  width: fit-content;
}

.prompt-attachment-x {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.4);
  line-height: 1;
}

.prompt-attachment-thumb {
  display: inline-block;
  width: 18px;
  height: 14px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.15);
}

.prompt-attachment-label {
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.01em;
}

.play-button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: transform 0.4s var(--ease-out), opacity 0.3s;
  opacity: 0.85;
}

.play-button:hover {
  transform: scale(1.08);
  opacity: 1;
}

.play-button svg circle {
  transition: stroke 0.4s;
}

.play-button:hover svg circle {
  stroke: rgba(106,216,255,0.7);
}

.play-label {
  color: var(--text);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.intro-hint {
  margin-top: 2rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

/* --- Main Layout --- */
#app {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  width: 100vw;
  height: calc(100vh - 48px); /* room for transport controls at bottom */
  padding-bottom: 0;
}

/* --- Left Pane: Visualization --- */
#vizPane {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  min-height: 0; /* allow shrink below content size in grid */
}

#vizCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* Vignette overlay */
#vizPane::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(8,12,20,0.25) 100%),
    linear-gradient(to bottom, rgba(8,12,20,0.15) 0%, transparent 6%, transparent 92%, rgba(8,12,20,0.2) 100%);
}

/* Guide text overlay (sits above vignette and transport controls) */
#guideOverlay {
  position: absolute;
  bottom: 70px;
  left: 40px;
  right: 40px;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(to top, rgba(8,12,20,0.85) 0%, rgba(8,12,20,0.6) 60%, transparent 100%);
  padding: 24px 20px 16px;
  border-radius: 8px 8px 0 0;
}

.guide-stage {
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #7ad8ff;
  font-weight: 500;
  margin-bottom: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.guide-stage.visible {
  opacity: 1;
  transform: translateY(0);
}

.guide-title {
  font-size: 1.6rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: #ffffff;
  margin-bottom: 10px;
  text-shadow: 0 0 40px rgba(106,216,255,0.35), 0 0 10px rgba(106,216,255,0.15), 0 1px 3px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1s var(--ease-out) 0.15s, transform 1s var(--ease-out) 0.15s;
}

.guide-title.visible {
  opacity: 1;
  transform: translateY(0);
}

.guide-text {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.75;
  color: #f0f2f6;
  max-width: 560px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1s var(--ease-out) 0.3s, transform 1s var(--ease-out) 0.3s;
}

.guide-text.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Node labels (HTML overlay for sharp text) */
#nodeLabels {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.node-label {
  position: absolute;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8ecf2;
  transform: translate(-50%, -50%);
  transition: color 0.6s, text-shadow 0.6s, opacity 0.6s;
  opacity: 0;
  text-shadow: 0 0 16px rgba(0,0,0,1), 0 0 8px rgba(0,0,0,0.9), 0 0 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.node-label-name {
  display: block;
}

.node-token-counter {
  font-size: 0.65rem;
  font-weight: 500;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--node-color, #7ae0ff);
  opacity: 0;
  transition: opacity 0.6s;
  text-shadow: 0 0 12px var(--node-color, rgba(122,224,255,0.5)),
               0 0 4px rgba(0,0,0,0.8);
}

.node-token-counter.visible {
  opacity: 1;
}

.node-label.visible {
  opacity: 1;
}

.node-label.active {
  color: #ffffff;
  text-shadow: 0 0 36px var(--node-color, rgba(255,255,255,0.7)), 0 0 16px var(--node-color, rgba(255,255,255,0.5)), 0 0 4px rgba(0,0,0,0.5);
}

.node-label.active .node-token-counter {
  color: #ffffff;
  text-shadow: 0 0 16px var(--node-color, rgba(122,224,255,0.6)),
               0 0 6px var(--node-color, rgba(122,224,255,0.4));
}

/* Token total bar (top of viz pane) */
#tokenTotalBar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 1s var(--ease-out);
  pointer-events: none;
}

#tokenTotalBar.visible {
  opacity: 1;
  pointer-events: auto;
}

.token-total-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-rot-info-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(122,224,255,0.6);
  background: rgba(122,224,255,0.1);
  color: #7ae0ff;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 0 8px rgba(122,224,255,0.2);
  padding: 0;
  line-height: 1;
}

.context-rot-info-btn:hover {
  background: rgba(122,224,255,0.25);
  border-color: #7ae0ff;
  box-shadow: 0 0 16px rgba(122,224,255,0.5), 0 0 32px rgba(122,224,255,0.2);
  transform: scale(1.15);
}

/* Context rot overlay */
.context-rot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.context-rot-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.context-rot-card {
  position: relative;
  max-width: 680px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  background: linear-gradient(145deg, #111828 0%, #0c1220 100%);
  border: 1px solid rgba(122,224,255,0.25);
  border-radius: 16px;
  padding: 40px 44px;
  box-shadow: 0 0 40px rgba(122,224,255,0.12), 0 8px 32px rgba(0,0,0,0.6);
  transform: translateY(20px);
  transition: transform 0.4s ease;
}

.context-rot-overlay.visible .context-rot-card {
  transform: translateY(0);
}

.context-rot-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: #a0a8b8;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s ease;
  line-height: 1;
}

.context-rot-close:hover {
  color: #f8f9fb;
}

.context-rot-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #7ae0ff;
  margin: 0 0 24px 0;
  text-shadow: 0 0 16px rgba(122,224,255,0.3);
}

.context-rot-body p {
  color: #dce0e8;
  font-size: 0.92rem;
  line-height: 1.75;
  margin: 0 0 18px 0;
}

.context-rot-body p:last-child {
  margin-bottom: 0;
}

.token-total-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a0a8b8;
  text-shadow: 0 0 8px rgba(0,0,0,0.8);
}

.token-total-value {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: #7ae0ff;
  text-shadow: 0 0 24px rgba(122,224,255,0.5),
               0 0 8px rgba(122,224,255,0.3),
               0 0 4px rgba(0,0,0,0.6);
  letter-spacing: 0.05em;
}

/* Summary overlay */
#summaryOverlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 1.5s var(--ease-out);
}

#summaryOverlay.visible {
  opacity: 1;
}

.summary-content {
  text-align: center;
  max-width: 450px;
}

.summary-content h2 {
  font-size: 1.8rem;
  font-weight: 200;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.summary-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--text-dim);
}

.summary-stat .stat-num {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent);
  min-width: 32px;
  text-align: right;
}

/* --- Right Pane: Chat Simulation --- */
#chatPane {
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  border-left: 1px solid var(--chat-border);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  min-height: 0; /* allow shrink below content size in grid */
  overflow: hidden; /* prevent content from expanding grid row */
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--chat-border);
  background: rgba(255,255,255,0.03);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-icon {
  color: var(--accent);
  font-size: 14px;
}

.chat-header-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
}

.chat-status {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.chat-status.active {
  color: var(--c-orchestrator);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
  scroll-behavior: smooth;
  min-height: 0;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Chat message types */
.chat-msg {
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.chat-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

/* User message */
.chat-msg.user-msg {
  background: rgba(79, 195, 247, 0.06);
  border: 1px solid rgba(79, 195, 247, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
}

.msg-role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-role.user { color: var(--accent); }
.msg-role.agent { color: var(--text-dim); }

.msg-body {
  color: var(--text);
  line-height: 1.65;
}

.msg-body .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Agent message */
.chat-msg.agent-msg {
  padding: 8px 14px;
  border-left: 2px solid rgba(255,255,255,0.16);
  margin-left: 4px;
}

.chat-msg.agent-msg .msg-body {
  color: #e8ecf4;
}

/* Subagent invocation */
.chat-msg.subagent-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 6px 4px 6px 0;
  color: #e8ecf4;
  font-size: 12px;
  background: rgba(122,224,255,0.08);
  border-left: 3px solid rgba(122,224,255,0.6);
  border-radius: 0 6px 6px 0;
  animation: subagentPulse 3s ease-in-out infinite;
}

@keyframes subagentPulse {
  0%, 100% { background: rgba(122,224,255,0.08); border-left-color: rgba(122,224,255,0.6); }
  50% { background: rgba(122,224,255,0.15); border-left-color: rgba(122,224,255,0.9); }
}

.subagent-diamond {
  width: 10px; height: 10px;
  border: 2px solid;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.subagent-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 13px;
}

.subagent-model {
  color: #a0aab8;
  font-size: 11px;
}

/* Tool usage */
.chat-msg.tool-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  margin-left: 4px;
  color: #b8c0d0;
  font-size: 11.5px;
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

.tool-msg .tool-icon {
  font-style: normal;
  color: #98a4b8;
}

.tool-msg .tool-name {
  color: #d8dde8;
}

.tool-msg .tool-source {
  color: #98a4b8;
}

/* Edit notification */
.chat-msg.edit-msg {
  padding: 4px 14px;
  margin-left: 4px;
  color: #b8c0d0;
  font-size: 11.5px;
}

.edit-msg .filename {
  color: #e0e4f0;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* Status message */
.chat-msg.status-msg {
  padding: 10px 14px;
  margin: 16px 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-msg.pass {
  background: rgba(129, 199, 132, 0.08);
  border: 1px solid rgba(129, 199, 132, 0.15);
  color: rgba(129, 199, 132, 0.9);
}

.status-msg.fail {
  background: rgba(255, 138, 101, 0.08);
  border: 1px solid rgba(255, 138, 101, 0.15);
  color: rgba(255, 138, 101, 0.9);
}

.status-msg.warn {
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.15);
  color: rgba(255, 183, 77, 0.9);
}

.status-msg.info {
  background: rgba(79, 195, 247, 0.06);
  border: 1px solid rgba(79, 195, 247, 0.12);
  color: rgba(79, 195, 247, 0.85);
}

.status-msg.complete {
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.2);
  color: rgba(79, 195, 247, 0.95);
}

/* Separator */
.chat-msg.separator-msg {
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 20px 0 12px;
  padding-top: 12px;
}

/* --- Transport Controls --- */
#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.85);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
}

#controls button {
  background: none;
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--text-dim);
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}

#controls button:hover {
  border-color: var(--accent);
  color: #ffffff;
  background: rgba(106,216,255,0.06);
}

#progressBar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

#progressFill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s linear;
}

#timeDisplay {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  min-width: 85px;
  text-align: right;
  letter-spacing: 0.03em;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .intro-glow { animation: none; opacity: 0.6; }
  .msg-body .cursor { animation: none; opacity: 1; }
}

/* --- Audit Trail Overlay --- */
#auditOverlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: rgba(8,12,20,0.96);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 1.8s var(--ease-out);
  overflow-y: auto;
  padding: 2rem 2rem 3rem;
}

#auditOverlay.visible {
  opacity: 1;
}

.audit-content {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.audit-header {
  margin-bottom: 1.5rem;
}

.audit-header h2 {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 1rem;
  text-shadow: 0 0 20px rgba(106,216,255,0.1);
}

/* Metadata block */
.audit-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  font-size: 0.78rem;
  line-height: 1.6;
}

.audit-meta-row {
  display: flex;
  gap: 6px;
}

.audit-meta-label {
  color: var(--text-faint);
  font-weight: 500;
  white-space: nowrap;
}

.audit-meta-value {
  color: var(--text-dim);
}

.audit-meta-value.audit-mono {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.72rem;
}

.audit-meta-value.audit-status-badge {
  color: #81C784;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* Main event table */
.audit-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.5;
}

.audit-table thead th {
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}

.audit-row {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.audit-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.audit-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.audit-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.audit-table td {
  padding: 7px 10px;
  color: var(--text-dim);
  vertical-align: top;
}

.audit-cell-num {
  color: var(--text-faint);
  text-align: center;
  width: 30px;
}

.audit-cell-ts {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.65rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.audit-cell-phase {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.audit-agent-name { font-weight: 500; }
.audit-agent-name.ac-orchestrator { color: #7ae0ff; }
.audit-agent-name.ac-strategist { color: #66ff88; }
.audit-agent-name.ac-architect { color: #a0a0ff; }
.audit-agent-name.ac-researcher { color: #5eecd5; }
.audit-agent-name.ac-ciso { color: #ffc855; }
.audit-agent-name.ac-executor { color: #e0a0ff; }
.audit-agent-name.ac-qa { color: #ff9966; }
.audit-agent-name.ac-librarian { color: #ff70a0; }

.audit-cell-action {
  color: var(--text-dim);
}

/* Verdict badges */
.audit-verdict-badge {
  display: inline-block;
  font-size: 0.62rem;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.verdict-pass { background: rgba(76,175,80,0.15); color: #81C784; }
.verdict-fail { background: rgba(239,83,80,0.15); color: #EF5350; }
.verdict-pending { background: rgba(255,255,255,0.06); color: var(--text-faint); }
.verdict-info { background: rgba(79,195,247,0.1); color: #6ad8ff; }
.verdict-default { background: rgba(255,255,255,0.06); color: var(--text-dim); }

.audit-cell-duration {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.65rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.audit-cell-notes {
  color: var(--text-dim);
  font-size: 0.7rem;
  max-width: 280px;
}

/* Tool usage sections */
.audit-tools-section {
  margin-top: 1.5rem;
}

.audit-tool-block {
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.audit-tool-block.visible {
  opacity: 1;
  transform: translateY(0);
}

.audit-tool-heading {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.audit-tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
  margin-bottom: 4px;
}

.audit-tool-table thead th {
  color: var(--text-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.58rem;
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.audit-tool-table td {
  padding: 4px 8px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.02);
  vertical-align: top;
}

.audit-tool-name {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: var(--accent);
  font-size: 0.66rem;
  white-space: nowrap;
}

.audit-tool-detail {
  color: var(--text-dim);
  max-width: 500px;
}

.audit-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.audit-footer p {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-style: italic;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  #chatPane { border-left: none; border-top: 1px solid var(--chat-border); }
  .guide-title { font-size: 1.2rem; }
  .intro-title { font-size: 2rem; }
}
