:root {
  --bg-primary: #080C14;
  --bg-surface: #0E1524;
  --bg-card: #141C30;
  --bg-card-hover: #1A243D;
  --border-subtle: #1E293B;
  --border-focus: #4F46E5;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent-indigo: #6366F1;
  --accent-purple: #8B5CF6;
  --accent-cyan: #06B6D4;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

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

/* Header */
.app-header {
  height: 64px;
  background: rgba(14, 21, 36, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.brand h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.brand h1 span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.phase-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.phase-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.phase-value {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-cyan);
}

.depth-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gauge-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.gauge-bar {
  width: 100px;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-emerald));
  transition: width 0.4s ease;
}

/* Split-Pane Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow: hidden;
}

.pane:last-child {
  border-right: none;
}

.pane-header {
  height: 48px;
  padding: 0 20px;
  background: rgba(20, 28, 48, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pane-header h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.scenario-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.scenario-selector select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
}

.live-status-pill {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-emerald);
  letter-spacing: 0.5px;
}

/* Chat History */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-card {
  border-radius: var(--radius-md);
  padding: 16px;
  max-width: 90%;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-card {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.agent-card {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.intro-card {
  border-left: 3px solid var(--accent-indigo);
}

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

.sender-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-indigo);
  letter-spacing: 0.5px;
}

.user-card .sender-tag {
  color: var(--accent-purple);
}

.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-subtle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.badge-pattern {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-deepen {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.message-body {
  font-size: 13.5px;
  line-height: 1.6;
}

.message-body p {
  margin-bottom: 8px;
}

.message-body p:last-child {
  margin-bottom: 0;
}

.bedrock-hint {
  color: var(--text-secondary);
  border-left: 2px solid var(--accent-cyan);
  padding-left: 10px;
  margin: 8px 0;
}

/* Input Area */
.input-area {
  padding: 16px 20px;
  background: rgba(14, 21, 36, 0.9);
  border-top: 1px solid var(--border-subtle);
}

.input-area textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.input-area textarea:focus {
  border-color: var(--accent-indigo);
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.hint-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-indigo);
  color: #fff;
}

.btn-primary:hover {
  background: #4F46E5;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Tab Contents */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tab-content.active {
  display: block;
}

/* Markdown ADR Canvas */
.adr-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  font-size: 13.5px;
  line-height: 1.7;
}

.adr-container h1 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #fff;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.adr-container h2 {
  font-size: 15px;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--accent-cyan);
}

.adr-container ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.adr-container li {
  margin-bottom: 6px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .sub {
  font-size: 12px;
  margin-top: 6px;
}

/* Graph Stats */
.graph-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-box .num {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-indigo);
}

.stat-box span:last-child {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.node-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.node-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.node-card.resolved {
  border-left: 3px solid var(--accent-emerald);
}

.node-card.pending {
  border-left: 3px solid var(--accent-amber);
}

/* Diff View */
.diff-container {
  background: #05080F;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
}

.diff-view {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
