:root {
  --bg-primary: #080b11;
  --bg-secondary: #0e131f;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(26, 35, 54, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-main: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Glass panel utility */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Top Navigation Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(14, 19, 31, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.logo-icon {
  color: white;
  font-weight: 800;
}

.brand-text h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: block;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mesh-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.mesh-status-indicator.active .status-dot {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Buttons */
.btn {
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  color: white;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-pane.active {
  display: flex;
}

/* Query Section */
.query-section {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.query-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem 0.5rem 1.25rem;
  transition: var(--transition);
}

.query-input-wrap:focus-within {
  border-color: var(--accent-violet);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  font-size: 1.2rem;
  opacity: 0.6;
}

.query-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.05rem;
  outline: none;
}

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

.quick-prompts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.quick-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prompt-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.prompt-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.execution-options {
  display: flex;
  align-items: center;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  position: relative;
  transition: var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-control input:checked + .toggle-slider {
  background: var(--accent-cyan);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

.toggle-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Pipeline Flow DAG */
.pipeline-section {
  padding: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.pipeline-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.pipeline-status.running {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-violet);
  border-color: rgba(139, 92, 246, 0.3);
  animation: pulse 1.5s infinite;
}

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

.pipeline-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.agent-node {
  flex: 1;
  min-width: 180px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  transition: var(--transition);
}

.agent-node.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
  background: rgba(6, 182, 212, 0.06);
}

.agent-node.done {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.05);
}

.node-icon {
  font-size: 1.4rem;
}

.node-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.node-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.node-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  opacity: 0.4;
}

/* Metrics Strip */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.metric-card {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.metric-success .metric-value { color: var(--accent-emerald); }
.metric-danger .metric-value { color: var(--accent-rose); }
.metric-highlight .metric-value { color: var(--accent-cyan); }
.metric-info .metric-value { color: var(--accent-violet); }

/* Workspace Grid (Report & Inspector) */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  min-height: 550px;
}

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

.report-panel, .inspector-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.header-left h3 {
  font-size: 1rem;
  font-weight: 700;
}

.report-run-id, .inspector-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.report-body, .inspector-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  max-height: 700px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state h4 {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 420px;
  line-height: 1.6;
}

/* Report Content Styles */
.report-content h1 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: #fff;
}

.report-content h2 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  color: var(--accent-cyan);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.4rem;
}

.report-content blockquote {
  background: rgba(139, 92, 246, 0.08);
  border-left: 3px solid var(--accent-violet);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.report-content ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.report-content li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.6;
}

.report-content li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-emerald);
  font-weight: 800;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  margin-left: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.citation-chip:hover {
  background: rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* Inspector Evidence Card */
.inspector-card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.evidence-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.evidence-id-badge {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

.source-quality-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quality-meter {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.quality-fill {
  height: 100%;
  background: var(--accent-emerald);
  border-radius: var(--radius-full);
}

.verdict-banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border: 1px solid transparent;
}

.verdict-banner.supported {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.verdict-banner.rejected {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
}

.verdict-banner.unverified {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

.verdict-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.supported .verdict-title { color: var(--accent-emerald); }
.rejected .verdict-title { color: var(--accent-rose); }
.unverified .verdict-title { color: var(--accent-amber); }

.verdict-reason {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.quote-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.box-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  display: block;
}

.quote-text {
  font-style: italic;
  font-size: 0.9rem;
  color: #fff;
  border-left: 2px solid var(--accent-cyan);
  padding-left: 0.75rem;
}

.source-excerpt-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.excerpt-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-height: 250px;
  overflow-y: auto;
  line-height: 1.6;
  white-space: pre-wrap;
}

.highlighted-quote {
  background: rgba(6, 182, 212, 0.25);
  color: #fff;
  font-weight: 600;
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
}

/* Audit Tab */
.audit-container, .history-container, .eval-container {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.audit-controls {
  display: flex;
  gap: 0.75rem;
}

.select-control {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  outline: none;
}

.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-event {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
}

.timeline-event:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
}

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

.event-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.event-tag.plan { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.event-tag.search { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.event-tag.evidence { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.event-tag.verification { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.event-tag.research_retry { background: rgba(245, 158, 11, 0.2); color: #fde68a; }
.event-tag.completed { background: rgba(16, 185, 129, 0.3); color: #34d399; }

.event-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.event-payload {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* History List */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.history-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.history-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.history-q {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Benchmark Grid */
.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.benchmark-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bench-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.bench-q {
  font-size: 0.9rem;
  color: #fff;
  font-weight: 600;
}

.code-box {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  max-height: 350px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: #0e1422;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-violet);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.static-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Follow-up Section */
.followup-section {
  margin-top: 1rem;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.followup-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.followup-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.followup-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.followup-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.followup-input-wrap input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
}

.followup-input-wrap input:focus {
  border-color: var(--accent-cyan);
}

.followup-answer {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.answer-text {
  font-size: 0.88rem;
  color: #f1f5f9;
  line-height: 1.6;
}

.cited-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Print / PDF Export Media Styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .topbar, .query-section, .pipeline-section, .inspector-panel, .followup-section, .header-actions, .nav-tabs {
    display: none !important;
  }
  .workspace-grid {
    grid-template-columns: 1fr !important;
  }
  .report-panel {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .report-body {
    max-height: none !important;
    overflow: visible !important;
  }
  .report-content h1, .report-content h2, .report-content h3 {
    color: #000 !important;
  }
  .citation-chip {
    border: 1px solid #999 !important;
    color: #333 !important;
    background: #eee !important;
  }
}

/* Editorial demo identity — visual direction generated with Higgsfield/Recraft. */
.editorial-hero {
  position: relative;
  min-height: 520px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(235, 229, 214, 0.16);
  border-radius: 2px 2px 28px 2px;
  background: #090e13;
  isolation: isolate;
}

.editorial-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(7, 11, 16, .98) 0%, rgba(7, 11, 16, .94) 38%, rgba(7, 11, 16, .18) 72%, rgba(7, 11, 16, .04) 100%);
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url('/static/evidence-constellation.webp') center / cover no-repeat;
  transform: scale(1.01);
}

.hero-copy {
  width: min(610px, 64%);
  padding: clamp(3rem, 6vw, 6rem);
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 2rem;
  color: #77ddd4;
  font: 600 .69rem/1 var(--font-mono);
  letter-spacing: .15em;
  text-transform: uppercase;
}

.hero-kicker span {
  width: 28px;
  height: 1px;
  background: #77ddd4;
}

.hero-copy h2 {
  max-width: 680px;
  color: #f2ede2;
  font: 400 clamp(3.5rem, 7.2vw, 7.2rem)/.85 var(--font-display);
  letter-spacing: -.055em;
}

.hero-copy h2 em {
  color: #77ddd4;
  font-weight: 400;
}

.hero-copy > p {
  max-width: 520px;
  margin: 2rem 0 2.5rem;
  color: #a9b4ba;
  font-size: clamp(.95rem, 1.25vw, 1.15rem);
  line-height: 1.7;
}

.hero-proof {
  display: flex;
  gap: clamp(1.25rem, 3vw, 3rem);
  padding-top: 1.4rem;
  border-top: 1px solid rgba(235, 229, 214, .14);
}

.hero-proof div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: .65rem;
}

.hero-proof strong {
  color: #f3aa3d;
  font: 500 1.5rem/1 var(--font-display);
}

.hero-proof span {
  color: #7e8d95;
  font: 500 .61rem/1.45 var(--font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.hero-caption {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  width: min(270px, 28vw);
  padding: 1rem 1.1rem;
  border-left: 2px solid #f3aa3d;
  background: rgba(8, 13, 18, .86);
  backdrop-filter: blur(14px);
}

.hero-caption span {
  color: #f3aa3d;
  font: 600 .6rem/1 var(--font-mono);
  letter-spacing: .14em;
}

.hero-caption p {
  margin-top: .6rem;
  color: #b8c1c5;
  font-size: .72rem;
  line-height: 1.5;
}

/* Replace the common neon-dashboard treatment with a research-editorial system. */
.glass-panel {
  border-radius: 3px 3px 18px 3px;
  background: rgba(14, 20, 27, .88);
  backdrop-filter: blur(12px);
}

.logo-mark {
  border-radius: 2px 2px 12px 2px;
  background: #77ddd4;
  box-shadow: none;
}

.logo-icon { color: #071116; }
.brand-text h1 { background: none; -webkit-text-fill-color: #f2ede2; }
.nav-tabs, .nav-tab, .btn { border-radius: 3px 3px 10px 3px; }
.nav-tab.active { background: #eae4d8; color: #10171d; box-shadow: none; }
.btn-primary { background: #77ddd4; color: #071116; box-shadow: none; }
.btn-primary:hover { background: #9aeee6; box-shadow: none; }
.metric-card { border-top: 2px solid rgba(119, 221, 212, .58); }

.architecture-feature {
  margin: 1.25rem 0;
  padding: clamp(1.2rem, 2.5vw, 2.25rem);
  border: 1px solid rgba(235, 229, 214, .12);
  border-radius: 3px 3px 22px 3px;
  background: #0d141b;
}

.architecture-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.section-index {
  color: #f3aa3d;
  font: 600 .63rem/1 var(--font-mono);
  letter-spacing: .15em;
}

.architecture-intro h3 {
  margin-top: .8rem;
  color: #f2ede2;
  font: 400 clamp(2rem, 4vw, 4.5rem)/.95 var(--font-display);
  letter-spacing: -.035em;
}

.architecture-intro p {
  color: #93a0a8;
  font-size: .84rem;
  line-height: 1.7;
}

.architecture-frame-wrap {
  overflow: hidden;
  border: 1px solid rgba(119, 221, 212, .18);
  border-radius: 2px 2px 14px 2px;
  background: #f6f7f8;
}

.diagram-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-bottom: .85rem;
}

.diagram-tab {
  appearance: none;
  padding: .7rem .9rem;
  border: 1px solid rgba(235, 229, 214, .14);
  border-radius: 2px 2px 9px 2px;
  background: transparent;
  color: #93a0a8;
  font: 600 .62rem/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

.diagram-tab:hover,
.diagram-tab.active {
  border-color: #77ddd4;
  background: rgba(119, 221, 212, .1);
  color: #f2ede2;
}

.architecture-frame {
  display: block;
  width: 100%;
  height: min(76vh, 820px);
  min-height: 640px;
  border: 0;
}

@media (max-width: 820px) {
  .editorial-hero { min-height: 620px; }
  .editorial-hero::after { background: linear-gradient(180deg, rgba(7,11,16,.98) 0%, rgba(7,11,16,.86) 62%, rgba(7,11,16,.18) 100%); }
  .hero-art { background-position: 62% center; opacity: .72; }
  .hero-copy { width: 100%; padding: 3rem 1.5rem; }
  .hero-copy h2 { font-size: clamp(3.4rem, 17vw, 5.5rem); }
  .hero-proof { flex-wrap: wrap; }
  .hero-caption { width: calc(100% - 3rem); right: 1.5rem; }
  .architecture-intro { grid-template-columns: 1fr; }
  .architecture-frame { min-height: 720px; }
}

.hidden {
  display: none !important;
}

.demo-film{display:grid;grid-template-columns:minmax(240px,.34fr) minmax(0,1fr);gap:clamp(1.5rem,3vw,3rem);align-items:center;padding:clamp(1.2rem,2vw,2rem);border:1px solid rgba(235,229,214,.1);background:#10151a}
.demo-film h3{margin-top:1rem;color:#f2ede2;font:400 clamp(1.8rem,3vw,3.2rem)/1 var(--font-display);letter-spacing:-.035em}
.demo-film p{margin-top:1rem;color:#8f9ba1;font-size:.84rem;line-height:1.7}
.demo-film video{display:block;width:100%;border:1px solid rgba(119,221,212,.2);background:#080c10}
@media(max-width:980px){.demo-film{grid-template-columns:1fr}}

/* Product workspace — restrained, application-first presentation. */
body {
  background: #0a0d10;
}

.topbar {
  min-height: 72px;
  padding: .85rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(10, 13, 16, .94);
  border-color: rgba(235, 229, 214, .11);
}

.logo-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(119, 221, 212, .45);
  background: transparent;
}

.logo-icon {
  color: #77ddd4;
  font-size: 1rem;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 600;
}

.brand-subtitle {
  margin-top: .12rem;
  color: #77838b;
  font-size: .58rem;
  letter-spacing: .1em;
}

.nav-tabs {
  gap: .1rem;
  padding: .2rem;
  border: 0;
  background: transparent;
}

.nav-tab {
  padding: .55rem .85rem;
  border: 0;
  color: #7f8b92;
  font-size: .76rem;
  font-weight: 500;
}

.nav-tab.active {
  border: 1px solid rgba(235, 229, 214, .12);
  background: #171c21;
  color: #f2ede2;
}

.topbar-actions {
  gap: .65rem;
}

.mesh-status-indicator {
  background: transparent;
  border-color: rgba(235, 229, 214, .1);
}

.main-content {
  max-width: 1480px;
  padding: clamp(1.25rem, 3vw, 3rem);
}

.workspace-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: end;
  padding: clamp(1.5rem, 3vw, 3rem) 0 clamp(2rem, 4vw, 4rem);
  border-bottom: 1px solid rgba(235, 229, 214, .12);
}

.eyebrow {
  color: #77ddd4;
  font: 600 .65rem/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.workspace-intro h2 {
  max-width: 850px;
  margin-top: 1.2rem;
  color: #f2ede2;
  font: 400 clamp(3rem, 6.5vw, 6.6rem)/.9 var(--font-display);
  letter-spacing: -.05em;
}

.workspace-intro h2 em {
  color: #77ddd4;
  font-weight: 400;
}

.workspace-intro-copy {
  padding-bottom: .4rem;
}

.workspace-intro-copy p {
  color: #9aa5aa;
  font-size: .95rem;
  line-height: 1.75;
}

.text-link {
  display: inline-flex;
  gap: .45rem;
  margin-top: 1.3rem;
  color: #d7d3ca;
  font: 600 .69rem/1 var(--font-mono);
  letter-spacing: .07em;
  text-decoration: none;
  text-transform: uppercase;
}

.text-link:hover {
  color: #77ddd4;
}

.glass-panel {
  border-color: rgba(235, 229, 214, .1);
  background: #10151a;
  box-shadow: none;
}

.query-section {
  gap: 1.15rem;
  margin-top: .5rem;
  padding: clamp(1.1rem, 2vw, 1.6rem);
}

.query-input-wrap {
  min-height: 62px;
  padding: .45rem .45rem .45rem 1.15rem;
  border-color: rgba(235, 229, 214, .16);
  background: #0b0f13;
}

.query-input-wrap:focus-within {
  border-color: #77ddd4;
  box-shadow: 0 0 0 3px rgba(119, 221, 212, .08);
}

.search-icon {
  width: 9px;
  height: 9px;
  border: 1.5px solid #718087;
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 1px;
  right: -4px;
  bottom: -2px;
  background: #718087;
  transform: rotate(45deg);
}

.query-input-wrap input {
  font-size: .94rem;
}

.btn-primary {
  min-height: 42px;
  padding-inline: 1.15rem;
  background: #77ddd4;
  color: #071116;
}

.btn-primary:hover {
  background: #9aeee6;
  transform: translateY(-1px);
}

.prompt-chip {
  border-radius: 4px;
  background: transparent;
  font-size: .74rem;
}

.quick-label {
  font: 600 .62rem/1 var(--font-mono);
  letter-spacing: .1em;
}

.pipeline-section {
  padding: 1.35rem;
}

.section-header h3,
.header-left h3 {
  color: #e7e2d9;
  font-weight: 600;
}

.pipeline-flow {
  gap: 0;
}

.agent-node {
  min-width: 172px;
  border-radius: 3px;
  background: #0b0f13;
}

.node-icon {
  color: #77ddd4;
  font: 600 .62rem/1 var(--font-mono);
  letter-spacing: .08em;
}

.node-title {
  font-size: .78rem;
  font-weight: 600;
}

.flow-arrow {
  width: 24px;
  height: 1px;
  flex: 0 0 24px;
  background: rgba(119, 221, 212, .28);
}

.metric-card {
  border-top: 1px solid rgba(119, 221, 212, .36);
}

.metric-label,
.metric-sub {
  letter-spacing: .04em;
}

.empty-state {
  max-width: 440px;
  margin-inline: auto;
}

.empty-state h4 {
  color: #d8d3ca;
  font-weight: 500;
}

.modal-close {
  width: auto;
  padding: .35rem .55rem;
  color: #9aa5aa;
  font: 500 .7rem/1 var(--font-main);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .workspace-intro {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .workspace-intro h2 {
    font-size: clamp(3rem, 12vw, 5.5rem);
  }
}

@media (max-width: 640px) {
  .brand-subtitle,
  .mesh-status-indicator {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .workspace-intro {
    padding-top: 1rem;
  }

  .query-input-wrap {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .query-input-wrap input {
    min-width: calc(100% - 36px);
  }

  .query-input-wrap .btn {
    width: 100%;
  }
}

