/* ==========================================================================
   NEURALIS // SYSTEM DESIGN SYSTEM & PREMIUM VISUAL SPECIFICATION
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Base Settings
   -------------------------------------------------------------------------- */
:root {
  /* Fonts */
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', monospace;

  /* Theme: Premium Slate-Dark (Default) */
  --bg-core: #030303;                  /* True Deep OLED Black */
  --bg-panel: rgba(9, 10, 15, 0.85);    /* Dark Slate panel */
  --bg-card: rgba(17, 18, 24, 0.55);   /* Clean card body */
  --bg-card-hover: rgba(26, 27, 36, 0.85);
  --border-glow: rgba(99, 102, 241, 0.05); /* Extremely subtle brand tint */
  --border-dim: rgba(255, 255, 255, 0.045); /* Hairline crisp grey border */
  --border-focus: rgba(99, 102, 241, 0.6);
  
  --accent-color: #6366F1;             /* Designer Indigo Accent */
  --accent-glow: rgba(99, 102, 241, 0.2);
  --arrow-color: #4F46E5;

  --color-text-main: #F9FAFB;          /* Crisp Off-White */
  --color-text-muted: #8A8F98;         /* Neutral Muted Grey */
  --color-text-dim: #4B5563;           /* Dark slate label grey */

  /* State Colors */
  --state-idle: #6B7280;
  --state-thinking: #D97706;
  --state-planning: #7C3AED;
  --state-executing: #2563EB;
  --state-success: #059669;
  --state-failure: #DC2626;

  --state-idle-glow: rgba(107, 114, 128, 0.1);
  --state-thinking-glow: rgba(217, 119, 6, 0.15);
  --state-planning-glow: rgba(124, 58, 237, 0.15);
  --state-executing-glow: rgba(37, 99, 235, 0.15);
  --state-success-glow: rgba(5, 150, 105, 0.15);
  --state-failure-glow: rgba(220, 38, 38, 0.15);
  
  /* Scrollbar Settings */
  --scrollbar-track: rgba(0, 0, 0, 0.1);
  --scrollbar-thumb: rgba(255, 255, 255, 0.06);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.12);

  /* Element Styling Variables */
  --bg-terminal: #050508;
  --panel-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.6);
  --panel-shadow-hover: 0 6px 30px 0 rgba(0, 0, 0, 0.7);
}

/* Explicit Slate theme selector (matches default root variables) */
body.theme-slate {
  --bg-core: #030303;
  --bg-panel: rgba(9, 10, 15, 0.85);
  --bg-card: rgba(17, 18, 24, 0.55);
  --bg-card-hover: rgba(26, 27, 36, 0.85);
  --border-glow: rgba(99, 102, 241, 0.05);
  --border-dim: rgba(255, 255, 255, 0.045);
  --border-focus: rgba(99, 102, 241, 0.6);
  --accent-color: #6366F1;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --arrow-color: #4F46E5;
  --color-text-main: #F9FAFB;
  --color-text-muted: #8A8F98;
  --color-text-dim: #4B5563;
  --bg-terminal: #050508;
  --panel-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.6);
  --panel-shadow-hover: 0 6px 30px 0 rgba(0, 0, 0, 0.7);
}

/* Theme: Oceanic Navy */
body.theme-oceanic {
  --bg-core: #050811;                  /* Midnight ocean black */
  --bg-panel: rgba(11, 19, 36, 0.85);   /* Dark slate-blue panel */
  --bg-card: rgba(18, 30, 56, 0.55);    /* Muted navy card */
  --bg-card-hover: rgba(28, 45, 82, 0.85);
  --border-glow: rgba(14, 165, 233, 0.05);
  --border-dim: rgba(255, 255, 255, 0.045);
  --border-focus: rgba(14, 165, 233, 0.6);
  
  --accent-color: #0ea5e9;             /* Sky Blue Accent */
  --accent-glow: rgba(14, 165, 233, 0.2);
  --arrow-color: #0284c7;

  --color-text-main: #F3F4F6;
  --color-text-muted: #9CA3AF;
  --color-text-dim: #4B5563;

  --bg-terminal: #070a14;
  --panel-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.75);
  --panel-shadow-hover: 0 6px 30px 0 rgba(0, 0, 0, 0.85);
}

/* Theme: Amber Gold */
body.theme-amber {
  --bg-core: #0c0a09;                  /* Warm stone black */
  --bg-panel: rgba(28, 25, 23, 0.85);   /* Dark clay panel */
  --bg-card: rgba(41, 37, 36, 0.55);    /* Warm brown-stone card */
  --bg-card-hover: rgba(68, 64, 60, 0.85);
  --border-glow: rgba(245, 158, 11, 0.05);
  --border-dim: rgba(255, 255, 255, 0.045);
  --border-focus: rgba(245, 158, 11, 0.6);
  
  --accent-color: #f59e0b;             /* Amber Gold Accent */
  --accent-glow: rgba(245, 158, 11, 0.2);
  --arrow-color: #d97706;

  --color-text-main: #FAFAF9;
  --color-text-muted: #A8A29E;
  --color-text-dim: #57534E;

  --bg-terminal: #0f0d0c;
  --panel-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.7);
  --panel-shadow-hover: 0 6px 30px 0 rgba(0, 0, 0, 0.8);
}

/* Theme: Light Opal */
body.theme-light {
  --bg-core: #fafafa;                  /* Premium clean off-white */
  --bg-panel: rgba(255, 255, 255, 0.95); /* Pure white panels */
  --bg-card: rgba(244, 244, 245, 0.85); /* Cool grey cards */
  --bg-card-hover: rgba(228, 228, 231, 0.95);
  --border-glow: rgba(79, 70, 229, 0.03);
  --border-dim: rgba(0, 0, 0, 0.065);   /* Hairline dark grey borders */
  --border-focus: rgba(79, 70, 229, 0.5);
  
  --accent-color: #4f46e5;             /* Indigo accent */
  --accent-glow: rgba(79, 70, 229, 0.1);
  --arrow-color: #6366f1;

  --color-text-main: #09090b;          /* Dark Charcoal Text */
  --color-text-muted: #71717a;         /* Muted Slate Grey */
  --color-text-dim: #a1a1aa;           /* Dim placeholder/disabled grey */

  --bg-terminal: #f4f4f5;
  
  --scrollbar-track: rgba(0, 0, 0, 0.03);
  --scrollbar-thumb: rgba(0, 0, 0, 0.08);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.16);

  --panel-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.03);
  --panel-shadow-hover: 0 6px 30px 0 rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------------------------------
   2. Reset & Core Layout Styles
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--color-text-main);
  background: var(--bg-core);
  background-image: 
    radial-gradient(at 5% 5%, rgba(99, 102, 241, 0.035) 0px, transparent 40%),
    radial-gradient(at 95% 95%, rgba(124, 58, 237, 0.015) 0px, transparent 40%);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Global Utilities */
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.scrollable { overflow-y: auto; overflow-x: hidden; }
.hidden { display: none !important; }
.text-accent { color: var(--accent-color) !important; }
.pulsing { animation: blink 2s infinite ease-in-out; }

/* Scrollbar styling */
.scrollable::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.scrollable::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
.scrollable::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 2px;
}
.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Premium Card Panel base */
.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  box-shadow: var(--panel-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-panel:hover {
  border-color: var(--accent-glow);
  box-shadow: var(--panel-shadow-hover);
}

/* --------------------------------------------------------------------------
   3. Main Grid Layout
   -------------------------------------------------------------------------- */
.dashboard-container {
  display: grid;
  grid-template-columns: 290px 1fr 390px;
  grid-template-rows: 80px 1fr 140px;
  grid-gap: 12px;
  padding: 12px;
  height: 100vh;
  width: 100vw;
  box-sizing: border-box;
}

/* Header */
.main-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

/* Sidebar Left */
.left-panel {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-agents { flex: 0.9; min-height: 0; }
.panel-fs { flex: 1.3; min-height: 0; }

/* Center Panel */
.center-panel {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0; /* Prevents overflow */
}
.panel-task-tree { flex: 1.1; min-height: 0; } /* Shrink canvas pane to fit content perfectly and remove dead whitespace */
.panel-terminal { flex: 1.3; min-height: 0; } /* Expand terminal space */

/* Right Panel */
.right-panel {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-inspector { flex: 1.2; min-height: 0; }
.panel-diff { flex: 1.1; min-height: 0; }

/* Timeline Footer */
.main-timeline {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  padding: 12px 20px;
}

/* --------------------------------------------------------------------------
   4. Header & Metrics Panel
   -------------------------------------------------------------------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo svg {
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.brand-text h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--color-text-main);
  line-height: 1;
}
.brand-tagline {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-color);
  letter-spacing: 0.05em;
}

/* Settings Gear button triggers */
.select-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.btn-settings-trigger {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  transition: all 0.2s ease;
}
.btn-settings-trigger:hover {
  color: var(--accent-color);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

/* Simulation Playback controls */
.simulation-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.control-group label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}
.glass-select {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  color: var(--color-text-main);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 6px 12px;
  outline: none;
  cursor: pointer;
  width: 250px;
}
.glass-select option {
  background: var(--bg-core);
  color: var(--color-text-main);
}
.glass-select:focus {
  border-color: var(--border-focus);
}

.playback-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-dim);
}
.btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  color: var(--color-text-main);
  background: var(--bg-card-hover);
}
.btn-primary-action {
  background: var(--accent-color);
  border: none;
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-primary-action:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border-dim);
}
.slider-label {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
}
.glass-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-dim);
  outline: none;
}
.glass-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.glass-slider.scrubber {
  width: 100%;
}

/* Metrics Tracker */
.metrics-grid {
  display: flex;
  gap: 16px;
}
.metric-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}
.metric-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}
.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
}
.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-dim);
  font-size: 0.75rem;
  font-weight: bold;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-color);
}
.status-badge.thinking .status-dot { background: var(--state-thinking); }
.status-badge.executing .status-dot { background: var(--state-executing); }
.status-badge.success .status-dot { background: var(--state-success); }
.status-badge.failure .status-dot { background: var(--state-failure); }
.status-badge.paused .status-dot { background: var(--state-idle); }

/* --------------------------------------------------------------------------
   5. Sidebars & Panel Headers
   -------------------------------------------------------------------------- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 0.8rem;
}
.panel-header.border-bottom {
  border-bottom: 1px solid var(--border-dim);
}
.panel-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title-group h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-text-main);
}
.title-icon {
  color: var(--accent-color);
}
.badge {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  border: 1px solid var(--border-dim);
}
.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--color-text-dim);
  font-size: 0.75rem;
  text-align: center;
  padding: 20px;
}

/* Agent cards list */
.panel-content {
  flex: 1;
  padding: 0 12px 12px 12px;
}
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.agent-card:hover, .agent-card.focused {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}
.agent-card.focused {
  border-left: 3px solid var(--accent-color);
}
.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.agent-name {
  font-size: 0.8rem;
  font-weight: bold;
}
.agent-status-tag {
  font-size: 0.6rem;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.agent-status-tag.idle { background: rgba(100, 116, 139, 0.1); color: var(--state-idle); }
.agent-status-tag.thinking { background: rgba(245, 158, 11, 0.1); color: var(--state-thinking); }
.agent-status-tag.planning { background: rgba(168, 85, 247, 0.1); color: var(--state-planning); }
.agent-status-tag.executing { background: rgba(59, 130, 246, 0.1); color: var(--state-executing); }
.agent-status-tag.success { background: rgba(16, 185, 129, 0.1); color: var(--state-success); }
.agent-status-tag.failure { background: rgba(239, 68, 68, 0.1); color: var(--state-failure); }

.agent-role {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.agent-metrics-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--color-text-dim);
  border-top: 1px dashed var(--border-dim);
  padding-top: 6px;
}

/* --------------------------------------------------------------------------
   6. Custom File Explorer Tree
   -------------------------------------------------------------------------- */
.vfs-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--state-success);
}
.vfs-node {
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}
.vfs-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px; /* slightly tighter heights */
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  transition: background 0.15s ease;
}
.vfs-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.vfs-item.active {
  background: var(--bg-card-hover);
  color: var(--accent-color);
  border-right: 2px solid var(--accent-color);
}
.vfs-icon {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
}
.vfs-item.active .vfs-icon {
  color: var(--accent-color);
}
.vfs-folder-contents {
  border-left: 1px solid var(--border-dim);
  margin-left: 6px;
  padding-left: 6px;
}

/* --------------------------------------------------------------------------
   7. Dynamic SVG Task Tree Panel
   -------------------------------------------------------------------------- */
.tree-canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 20px 20px;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}
.tree-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.canvas-controls {
  display: flex;
  gap: 4px;
}
.btn-small-icon {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-dim);
  color: var(--color-text-muted);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-small-icon:hover {
  color: var(--color-text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* Custom Live Goal Panel layout */
.custom-goal-holder {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glow);
  padding: 4px 8px;
  border-radius: 8px;
  margin-left: 16px;
  flex: 1;
  animation: fadeIn 0.3s ease;
}
#custom-goal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-main);
}
.btn-run-action {
  background: var(--accent-color);
  border: none;
  color: var(--bg-core);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.7rem;
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}
.btn-run-action:hover {
  box-shadow: 0 0 12px var(--accent-glow);
}

/* SVG Card Node Visuals */
.node-card-rect {
  transition: stroke 0.2s ease, fill 0.2s ease;
}
.node-group:hover .node-card-rect {
  stroke: rgba(255, 255, 255, 0.15) !important;
  fill: #0F1016 !important;
}
.node-card-title {
  font-family: var(--font-ui);
  font-size: 8.5px;
  font-weight: 600;
  fill: var(--color-text-main);
  pointer-events: none;
}
.node-card-agent {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--color-text-muted);
  pointer-events: none;
}
.node-status-dot-pulse {
  animation: beaconPulse 1.6s infinite ease-in-out;
  transform-origin: center;
}

@keyframes beaconPulse {
  0%, 100% { opacity: 0.5; r: 3; }
  50% { opacity: 1; r: 4.5; }
}

/* SVG Connection Lines */
.connection-line {
  stroke-width: 1.5;
  fill: none;
  transition: all 0.3s ease;
}
.connection-line.glow {
  stroke-dasharray: 6, 4;
  animation: pulseFlow 1s infinite linear;
}
#tree-overlay-alert {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--state-success);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--state-success);
  backdrop-filter: blur(8px);
  z-index: 10;
  pointer-events: none;
  animation: fadeIn 0.3s ease;
}

/* --------------------------------------------------------------------------
   8. Monospace Shell Terminal
   -------------------------------------------------------------------------- */
.terminal-themes {
  display: flex;
  gap: 4px;
}
.theme-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.theme-tab:hover {
  background: rgba(255, 255, 255, 0.02);
}
.theme-tab.active {
  border-color: var(--border-focus);
  color: var(--color-text-main);
  background: rgba(99, 102, 241, 0.08);
}
.terminal-body {
  flex: 1;
  background: #050508;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.4;
  position: relative;
}
.terminal-body::after {
  display: none;
}
.terminal-log-stream {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 8px;
}
.terminal-prompt {
  color: var(--accent-color);
}
#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-main);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  caret-color: var(--accent-color);
}

/* Command Logs Coloring */
.command-line { color: var(--color-text-muted); }
.command-line::before { content: "> "; color: var(--accent-color); }
.error-line { color: var(--state-failure); }
.success-line { color: var(--state-success); }
.system-line { color: #f59e0b; }
.output-line { color: #cbd5e1; }

/* --------------------------------------------------------------------------
   9. Right Inspector & Markdown Thought Panel
   -------------------------------------------------------------------------- */
.tab-header {
  display: flex;
  border-bottom: 1px solid var(--border-dim);
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 12px 6px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  color: var(--color-text-main);
  background: rgba(255, 255, 255, 0.01);
}
.tab-btn.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(0, 212, 255, 0.02);
}
.tab-body {
  flex: 1;
  padding: 12px;
}
.tab-pane {
  display: none;
  height: 100%;
}
.tab-pane.active {
  display: block;
}

/* Markdown thought styling */
.agent-focused-thought-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 12px;
}
.active-focus-agent {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-color);
}
.focus-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--state-thinking);
}

.thought-stream-markdown {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #e2e8f0;
}
.thought-stream-markdown p {
  margin-bottom: 8px;
}
.thought-stream-markdown code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--accent-color);
}
.thought-stream-markdown blockquote {
  border-left: 2px solid var(--accent-color);
  padding-left: 8px;
  margin: 8px 0;
  color: var(--color-text-muted);
  font-style: italic;
}
.markdown-stream-placeholder {
  color: var(--color-text-dim);
  text-align: center;
  margin-top: 40px !important;
}

/* Memory panel details */
.memory-inspector-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.memory-search-row {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-dim);
  padding: 8px;
  border-radius: 6px;
}
.memory-query-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--accent-color);
  display: block;
}
.memory-query-text {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--color-text-main);
  margin-top: 2px;
}
.memory-visual-nodes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vector-node {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease;
}
.vector-node:hover {
  border-color: var(--accent-color);
  background: var(--bg-card-hover);
}
.vector-text {
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}
.vector-distance {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--state-success);
}
.memory-db-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.memory-db-table h3 {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.kv-log {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 6px;
}
.kv-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}
.kv-key { color: var(--accent-color); }
.kv-val { color: var(--color-text-muted); text-align: right; word-break: break-all; }
.kv-row.empty { color: var(--color-text-dim); justify-content: center; }

/* Prompt iteration comparer */
.prompt-comparer {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.prompt-version-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.prompt-version-card.margin-top {
  margin-top: 12px;
}
.prompt-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-dim);
}
.prompt-badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-dim);
}
.prompt-badge.orange {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--state-thinking);
}
.correction-reason {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  background: rgba(239, 68, 68, 0.1);
  color: var(--state-failure);
  padding: 2px 6px;
  border-radius: 4px;
}
.prompt-code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* --------------------------------------------------------------------------
   10. Custom LCS Diff Viewer
   -------------------------------------------------------------------------- */
.panel-diff {
  min-height: 0;
}
.diff-mode-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-dim);
  padding: 2px 6px;
  border-radius: 4px;
}
.diff-body {
  flex: 1;
  background: rgba(5, 8, 17, 0.3);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.70rem;
  line-height: 1.5;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  overflow-x: auto; /* Fix 3: Added horizontal scrollbar wrapper overflow */
  overflow-y: auto;
}
.diff-lines-list {
  display: flex;
  flex-direction: column;
  min-width: max-content; /* Fix 3: Force line wrapper to extend fully and trigger scroll bar rather than wrap and truncate */
}
.diff-line {
  display: flex;
  white-space: pre;
}
.diff-ln {
  width: 25px;
  color: var(--color-text-dim);
  text-align: right;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  user-select: none;
}
.diff-text {
  padding-left: 8px;
  flex: 1;
}

/* Line colors */
.diff-line.added {
  background: rgba(16, 185, 129, 0.1);
}
.diff-line.added .diff-text {
  color: #34d399;
}
.diff-line.added .diff-text::before {
  content: "+ ";
  color: var(--state-success);
  margin-left: -12px;
  position: absolute;
}
.diff-line.removed {
  background: rgba(239, 68, 68, 0.08);
}
.diff-line.removed .diff-text {
  color: #f87171;
}
.diff-line.removed .diff-text::before {
  content: "- ";
  color: var(--state-failure);
  margin-left: -12px;
  position: absolute;
}

/* --------------------------------------------------------------------------
   11. Horizontal Timeline Footer & Scrubber
   -------------------------------------------------------------------------- */
.timeline-title-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border-dim);
  padding-right: 16px;
  margin-right: 16px;
  width: 100px;
}
.timeline-title-bar h3 {
  font-size: 0.55rem;
  font-family: var(--font-mono);
  color: var(--accent-color);
  letter-spacing: 0.15em;
}
.timeline-title-bar h2 {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.timeline-scroller-wrapper {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  scrollbar-width: none; /* Hide standard scrollbar */
}
.timeline-scroller-wrapper::-webkit-scrollbar {
  display: none;
}
.timeline-event-stream {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding-right: 100px; /* Space to slide */
}

/* Timeline blocks */
.timeline-block {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
  max-width: 220px;
  height: 76px;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: slideIn 0.3s ease;
}
.timeline-block:hover, .timeline-block.active {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}
.timeline-block.active {
  background: var(--bg-card-hover);
}
.timeline-block::after {
  content: "";
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 1px;
  background: var(--border-dim);
  z-index: -1;
}
.timeline-block:last-child::after {
  display: none;
}
.timeline-block.active::after {
  background: var(--accent-color);
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--accent-color);
}
.timeline-agent {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-desc {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-loading-indicator {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
}

/* Scrubber settings */
.timeline-scrubber-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-left: 1px solid var(--border-dim);
  padding-left: 16px;
  margin-left: 16px;
  width: 180px;
  justify-content: center;
  gap: 4px;
}
.scrub-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-muted);
}
.scrub-slider-container {
  width: 100%;
}

/* --------------------------------------------------------------------------
   12. Translucent Modal Overlay
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; bottom: 0; right: 0;
  background: rgba(3, 5, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  width: 520px;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  box-shadow: var(--panel-shadow-hover);
  padding: 20px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.grid-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.role-config-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  align-items: center;
}
.section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 4px;
  margin-bottom: 8px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.modal-header h2 {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--color-text-main);
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.btn-close:hover {
  color: var(--state-failure);
}
.modal-desc {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.form-group label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent-color);
  margin-bottom: 4px;
}
.glass-input {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--color-text-main);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  outline: none;
}
.glass-input:focus {
  border-color: var(--border-focus);
}
.full-width {
  width: 100% !important;
}
.margin-top {
  margin-top: 12px;
}
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-dim);
  padding-top: 12px;
}
.save-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--state-success);
}
.security-disclaimer {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-dim);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 12px;
  line-height: 1.4;
}
.security-disclaimer strong {
  color: var(--accent-color);
}


/* --------------------------------------------------------------------------
   13. Keyframes & Animation Library
   ========================================================================== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes pulseFlow {
  0% { stroke-dashoffset: 24; }
  100% { stroke-dashoffset: 0; }
}

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

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

/* Mobile Navigation Tab Bar (Hidden on desktop by default) */
.mobile-nav-tabs {
  display: none;
}

/* TF-IDF Vector Search Input */
.memory-search-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.memory-search-input-group .glass-input {
  flex: 1;
}

/* API Error Badge & Message styling */
.status-badge.api-error .status-dot {
  background: var(--state-failure);
}
.status-badge.api-error {
  border-color: var(--state-failure);
  color: var(--state-failure);
  background: rgba(239, 68, 68, 0.1);
}

.api-error-card {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  color: var(--color-text-main);
  animation: slideIn 0.3s ease;
}
.api-error-card h3 {
  color: var(--state-failure);
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 700;
}
.api-error-card p {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.api-error-actions {
  display: flex;
  gap: 8px;
}
.btn-error-action {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-dim);
  color: var(--color-text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-error-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-text-muted);
}
.btn-error-action.primary {
  background: var(--state-failure);
  border-color: var(--state-failure);
  color: #fff;
  font-weight: bold;
}
.btn-error-action.primary:hover {
  opacity: 0.9;
}

/* Responsive Scaling adjustments */
@media (max-width: 1400px) {
  .dashboard-container {
    grid-template-columns: 260px 1fr 340px;
  }
  .glass-select {
    width: 200px;
  }
}

/* Mobile & Tablet viewports collapse */
@media (max-width: 1024px) {
  .mobile-nav-tabs {
    display: flex;
    grid-column: 1 / -1;
    justify-content: space-around;
    gap: 6px;
    background: rgba(10, 16, 30, 0.85);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 2px;
  }
  
  .mobile-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.72rem;
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
  }
  
  .mobile-tab-btn:hover {
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.02);
  }
  
  .mobile-tab-btn.active {
    color: var(--accent-color);
    background: var(--border-glow);
    border-bottom: 2px solid var(--accent-color);
  }
  
  .dashboard-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    height: 100vh;
    padding: 8px;
    grid-gap: 8px;
  }
  
  /* Timeline Footer should span the single column */
  .main-timeline {
    grid-row: 4;
  }
  
  /* Conditional visibility of panels on mobile based on selected tab */
  .dashboard-container.mobile-show-workspace .left-panel {
    display: flex !important;
  }
  .dashboard-container.mobile-show-workspace .center-panel,
  .dashboard-container.mobile-show-workspace .right-panel {
    display: none !important;
  }
  
  .dashboard-container.mobile-show-tree .center-panel {
    display: flex !important;
  }
  .dashboard-container.mobile-show-tree .panel-task-tree {
    display: flex !important;
  }
  .dashboard-container.mobile-show-tree .panel-terminal {
    display: none !important;
  }
  .dashboard-container.mobile-show-tree .left-panel,
  .dashboard-container.mobile-show-tree .right-panel {
    display: none !important;
  }
  
  .dashboard-container.mobile-show-terminal .center-panel {
    display: flex !important;
  }
  .dashboard-container.mobile-show-terminal .panel-terminal {
    display: flex !important;
  }
  .dashboard-container.mobile-show-terminal .panel-task-tree {
    display: none !important;
  }
  .dashboard-container.mobile-show-terminal .left-panel,
  .dashboard-container.mobile-show-terminal .right-panel {
    display: none !important;
  }
  
  .dashboard-container.mobile-show-inspector .right-panel {
    display: flex !important;
  }
  .dashboard-container.mobile-show-inspector .left-panel,
  .dashboard-container.mobile-show-inspector .center-panel {
    display: none !important;
  }
  
  /* Allow left and right panels to expand to full height on mobile when visible */
  .left-panel, .right-panel {
    grid-column: 1 !important;
    height: 100% !important;
  }
  .center-panel {
    grid-column: 1 !important;
    height: 100% !important;
  }
  
  /* Adjust SVG tree heights on mobile */
  .panel-task-tree {
    height: 100% !important;
  }
}

