/**
 * Antfarm Design System v2.0
 * ============================================
 * Warp-inspired, terminal-first, flat design
 * Based on Shell Design System v5.0
 *
 * Philosophy:
 * - Terminal-first aesthetic (Warp.dev inspired)
 * - Flat design: NO shadows, NO glows
 * - Warm off-white text on deep black
 * - ANSI-inspired accent colors
 * - Mobile-first with 44-48px touch targets
 * - Monospace typography for data/CLI elements
 */

/* ============================================
   1. CORE DESIGN TOKENS
   ============================================ */

:root {
  /* === WARP BACKGROUND COLORS === */
  --background: #121212;           /* Warp's deep black */
  --background-elevated: #1a1a1a;  /* Slightly lighter for layers */
  --background-overlay: #242424;   /* Overlay panels */
  --background-subtle: #181818;    /* Subtle differentiation */

  /* Legacy aliases (for backward compatibility) */
  --bg-base: #121212;
  --bg-surface: #1a1a1a;
  --bg-elevated: #242424;
  --bg-hover: rgba(250, 249, 246, 0.05);
  --bg-active: rgba(250, 249, 246, 0.08);
  --bg-subtle: #181818;
  --bg-primary: #121212;

  /* === SURFACE COLORS (Overlay-based) === */
  --surface-primary: #1a1a1a;
  --surface-secondary: #242424;
  --surface-tertiary: #2d2d2d;
  --surface-hover: rgba(250, 249, 246, 0.05);
  --surface-active: rgba(250, 249, 246, 0.08);
  --surface-border: rgba(250, 249, 246, 0.1);
  --surface-border-strong: rgba(250, 249, 246, 0.15);

  /* === TEXT COLORS (Warm off-white with opacity) === */
  --text-primary: rgba(250, 249, 246, 0.9);
  --text-secondary: rgba(250, 249, 246, 0.7);
  --text-muted: rgba(250, 249, 246, 0.5);
  --text-disabled: rgba(250, 249, 246, 0.3);
  --text-inverse: #121212;

  /* === BORDER COLORS === */
  --border-default: rgba(250, 249, 246, 0.1);
  --border-subtle: rgba(250, 249, 246, 0.06);
  --border-strong: rgba(250, 249, 246, 0.15);
  --border-focus: #38d9a9;

  /* === ANSI 16-COLOR PALETTE === */
  /* Normal colors (Warp-inspired warm tones) */
  --ansi-black: #1a1a1a;
  --ansi-red: #ff6b6b;
  --ansi-green: #4ecdc4;
  --ansi-yellow: #ffe66d;
  --ansi-blue: #4dabf7;
  --ansi-magenta: #da77f2;
  --ansi-cyan: #38d9a9;
  --ansi-white: #f1f3f5;

  /* Bright colors */
  --ansi-bright-black: #495057;
  --ansi-bright-red: #ff8787;
  --ansi-bright-green: #63e6be;
  --ansi-bright-yellow: #ffd43b;
  --ansi-bright-blue: #74c0fc;
  --ansi-bright-magenta: #e599f7;
  --ansi-bright-cyan: #63e6be;
  --ansi-bright-white: #ffffff;

  /* === ACCENT COLORS (ANSI-inspired) === */
  --accent-primary: #38d9a9;       /* Teal-green (Warp style) */
  --accent-primary-hover: #4ae3b5;
  --accent-primary-active: #2bc89a;
  --accent-primary-muted: rgba(56, 217, 169, 0.15);
  --accent-primary-text: #121212;

  --accent-secondary: #4dabf7;
  --accent-highlight: #da77f2;

  /* === SEMANTIC COLORS === */
  --accent-success: #4ecdc4;
  --accent-warning: #ffe66d;
  --accent-error: #ff6b6b;
  --accent-info: #4dabf7;

  /* Legacy semantic aliases */
  --color-success: #4ecdc4;
  --color-success-muted: rgba(78, 205, 196, 0.15);
  --color-warning: #ffe66d;
  --color-warning-muted: rgba(255, 230, 109, 0.15);
  --color-error: #ff6b6b;
  --color-error-muted: rgba(255, 107, 107, 0.15);
  --color-info: #4dabf7;
  --color-info-muted: rgba(77, 171, 247, 0.15);

  /* === BLOCK STYLING (Warp's signature feature) === */
  --block-bg: rgba(250, 249, 246, 0.03);
  --block-bg-hover: rgba(250, 249, 246, 0.05);
  --block-bg-selected: rgba(56, 217, 169, 0.1);
  --block-border: rgba(250, 249, 246, 0.08);
  --block-border-selected: var(--accent-primary);
  --block-radius: 12px;

  /* === COMMAND INPUT STYLING === */
  --command-bg: rgba(250, 249, 246, 0.05);
  --command-border: rgba(250, 249, 246, 0.1);
  --command-focus-border: var(--accent-primary);

  /* === GLASSMORPHISM (Subtle, no heavy blur) === */
  --glass-bg: rgba(26, 26, 26, 0.95);
  --glass-border: rgba(250, 249, 246, 0.1);
  --glass-blur: 12px;

  /* === TYPOGRAPHY === */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Mobile-friendly sizes (px for consistency) */
  --text-xs: 13px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  --text-5xl: 48px;

  /* Font weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line heights */
  --leading-tight: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;
  --line-height-tight: 1.3;
  --line-height-base: 1.5;
  --line-height-relaxed: 1.7;

  /* === SPACING (4px base unit) === */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 80px;
  --space-12: 96px;

  /* === TOUCH TARGETS (Mobile-friendly) === */
  --touch-target: 44px;
  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;
  --input-min-height: 48px;
  --button-min-height: 44px;

  /* === BORDER RADIUS (Square, not pills) === */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* === SHADOWS - DISABLED (Flat Design) === */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-xl: none;
  --shadow-glow: none;
  --shadow-block: none;

  /* === ANIMATION TOKENS === */
  --duration-instant: 50ms;
  --duration-fast: 100ms;
  --duration-base: 150ms;
  --duration-slow: 250ms;
  --duration-slower: 400ms;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* Legacy transition aliases */
  --transition-fast: 100ms var(--ease-out);
  --transition-base: 150ms var(--ease-out);
  --transition-slow: 250ms var(--ease-out);

  /* === Z-INDEX SCALE === */
  --z-background: -1;
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
  --z-toast: 700;

  /* === TERMINAL SPECIFIC === */
  --cursor-color: var(--accent-primary);
  --cursor-width: 2px;
  --cursor-height: 1.2em;
  --prompt-color: var(--accent-primary);
  --prompt-user-color: var(--ansi-cyan);
  --prompt-path-color: var(--ansi-blue);
  --selection-bg: rgba(56, 217, 169, 0.3);

  /* === SPRINT 2: MESSAGE TYPES === */
  --msg-notify-border: var(--color-info);
  --msg-ask-border: var(--accent-primary);
  --msg-error-border: var(--color-error);
  --msg-error-bg: rgba(255, 107, 107, 0.07);

  /* === SPRINT 2: LOG PANEL === */
  --log-panel-width: 400px;
  --log-font-size: 13px;
  --log-entry-height: 22px;

  /* === SPRINT 2: TIMELINE === */
  --timeline-track-height: 8px;
  --timeline-marker-width: 3px;
  --timeline-playhead-size: 16px;

  /* === SPRINT 2: Z-INDEX LAYERS === */
  --z-panel: 200;
  --z-max: 9999;
}


/* ============================================
   2. BASE STYLES
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background: var(--background);
  overflow-x: hidden;
}

/* Subtle scanline effect for terminal feel */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.02) 2px,
      rgba(0, 0, 0, 0.02) 4px
    );
  pointer-events: none;
  z-index: var(--z-background);
}

/* Selection styling */
::selection {
  background-color: var(--selection-bg);
  color: var(--text-primary);
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}


/* ============================================
   3. SCROLLBAR - WARP STYLE
   ============================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-border);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  background-clip: content-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}


/* ============================================
   4. COMPONENT STYLES
   ============================================ */

/* --- Cards & Containers (No shadows) --- */
.card {
  background: var(--surface-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.card-elevated {
  background: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.card:hover,
.card-elevated:hover {
  border-color: var(--surface-border-strong);
}

/* Glass Container */
.glass-container {
  background: var(--surface-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* --- Buttons (Square radius, no shadow) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--button-min-height);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: var(--duration-instant);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.btn-primary {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  border-color: var(--accent-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-primary-active);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--surface-border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-tertiary);
  border-color: var(--text-muted);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--accent-primary-muted);
}

/* Danger Button */
.btn-danger {
  background: var(--accent-error);
  color: var(--text-inverse);
  border-color: var(--accent-error);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* Success Button */
.btn-success {
  background: var(--accent-success);
  color: var(--text-inverse);
  border-color: var(--accent-success);
}

.btn-success:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* --- Form Inputs (Square radius) --- */
.input {
  width: 100%;
  min-height: var(--input-min-height);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--duration-base) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

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

.input:hover {
  border-color: var(--surface-border-strong);
}

.input:focus {
  border-color: var(--accent-primary);
  background: var(--surface-tertiary);
}

.input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Textarea */
.textarea {
  border-radius: var(--radius-lg);
  resize: vertical;
  min-height: 100px;
  line-height: var(--line-height-relaxed);
}

/* Form labels */
.label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* Form groups */
.form-group {
  margin-bottom: var(--space-5);
}

/* --- Badges (ANSI colors, pill shape) --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.badge-default {
  background: var(--surface-secondary);
  color: var(--text-secondary);
  border-color: var(--surface-border);
}

.badge-primary {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  border-color: rgba(56, 217, 169, 0.3);
}

.badge-success {
  background: var(--color-success-muted);
  color: var(--color-success);
  border-color: rgba(78, 205, 196, 0.3);
}

.badge-warning {
  background: var(--color-warning-muted);
  color: var(--color-warning);
  border-color: rgba(255, 230, 109, 0.3);
}

.badge-error {
  background: var(--color-error-muted);
  color: var(--color-error);
  border-color: rgba(255, 107, 107, 0.3);
}

.badge-info {
  background: var(--color-info-muted);
  color: var(--color-info);
  border-color: rgba(77, 171, 247, 0.3);
}

/* --- Status Indicator (Animated dot) --- */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-indicator--online {
  background: rgba(78, 205, 196, 0.15);
  color: var(--accent-success);
}

.status-indicator--online .status-dot {
  background: var(--accent-success);
  animation: status-pulse 2s var(--ease-smooth) infinite;
}

.status-indicator--offline {
  background: var(--surface-secondary);
  color: var(--text-muted);
}

.status-indicator--offline .status-dot {
  background: var(--text-muted);
}

.status-indicator--error {
  background: rgba(255, 107, 107, 0.15);
  color: var(--accent-error);
}

.status-indicator--error .status-dot {
  background: var(--accent-error);
  animation: status-pulse 1s var(--ease-smooth) infinite;
}

.status-indicator--warning {
  background: rgba(255, 230, 109, 0.15);
  color: var(--accent-warning);
}

.status-indicator--warning .status-dot {
  background: var(--accent-warning);
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Progress Bar --- */
.progress {
  width: 100%;
  height: 8px;
  background: var(--surface-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-smooth);
}

.progress--sm { height: 4px; }
.progress--lg { height: 12px; }

.progress--success .progress-bar { background: var(--accent-success); }
.progress--warning .progress-bar { background: var(--accent-warning); }
.progress--error .progress-bar { background: var(--accent-error); }

/* Indeterminate progress */
.progress--indeterminate .progress-bar {
  width: 30% !important;
  animation: progress-indeterminate 1.5s var(--ease-smooth) infinite;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* --- Message Bubbles (Chat) --- */
.message {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: message-in 0.2s var(--ease-out);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-user {
  align-self: flex-end;
}

.message-bot {
  align-self: flex-start;
}

.message-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  line-height: var(--line-height-base);
  word-wrap: break-word;
}

.message-user .message-bubble {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  border-bottom-right-radius: var(--radius-sm);
}

.message-bot .message-bubble {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-bottom-left-radius: var(--radius-sm);
}

.message-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  padding: 0 var(--space-1);
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Workflow/Tag Buttons --- */
.tag-btn {
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--surface-border);
  background: var(--surface-primary);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  touch-action: manipulation;
}

.tag-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--surface-hover);
}

.tag-btn.active {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  border-color: var(--accent-primary);
}

/* --- Header --- */
.header {
  background: var(--surface-primary);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface-border);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.header-title {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.header-title span {
  color: var(--text-muted);
  font-weight: var(--font-normal);
}

.header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* --- Loading Spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.loading::after {
  border-color: rgba(18, 18, 18, 0.3);
  border-top-color: var(--accent-primary-text);
}

/* --- Error Messages --- */
.error-message {
  background: var(--color-error-muted);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  display: none;
}

.error-message.visible {
  display: block;
}

/* --- Alert Component --- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-size: var(--text-sm);
}

.alert--info {
  background: var(--color-info-muted);
  border-color: rgba(77, 171, 247, 0.3);
  color: var(--color-info);
}

.alert--success {
  background: var(--color-success-muted);
  border-color: rgba(78, 205, 196, 0.3);
  color: var(--color-success);
}

.alert--warning {
  background: var(--color-warning-muted);
  border-color: rgba(255, 230, 109, 0.3);
  color: var(--color-warning);
}

.alert--error {
  background: var(--color-error-muted);
  border-color: rgba(255, 107, 107, 0.3);
  color: var(--color-error);
}

/* --- Links --- */
.link {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.link:hover {
  color: var(--accent-primary-hover);
}

.run-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  transition: background var(--duration-fast) var(--ease-out);
}

.run-link:hover {
  background: var(--accent-primary-hover);
}

/* --- Command Block (Warp-style) --- */
.command-block {
  background: var(--block-bg);
  border: 1px solid var(--block-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-3);
  transition: all var(--duration-fast) var(--ease-out);
}

.command-block:hover {
  background: var(--block-bg-hover);
  border-color: var(--surface-border-strong);
}

.command-block--selected {
  background: var(--block-bg-selected);
  border-color: var(--accent-primary);
}

.command-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-primary);
  border-bottom: 1px solid var(--block-border);
  min-height: 44px;
}

.command-block-prompt {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.command-block-prompt-symbol {
  color: var(--prompt-color);
  font-weight: var(--font-bold);
}

.command-block-content {
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
}

/* --- Terminal Container --- */
.terminal {
  background: var(--surface-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--surface-border);
  min-height: 44px;
}

.terminal-title {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.terminal-content {
  padding: var(--space-4);
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
}

.terminal-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding: var(--space-1) 0;
}

.terminal-line--command { color: var(--text-primary); }
.terminal-line--output { color: var(--text-secondary); }
.terminal-line--success { color: var(--accent-success); }
.terminal-line--error { color: var(--accent-error); }
.terminal-line--warning { color: var(--accent-warning); }

.terminal-prompt {
  color: var(--prompt-color);
  font-weight: var(--font-semibold);
}


/* ============================================
   5. MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  :root {
    --text-base: 16px;
    --text-lg: 18px;
    --touch-target: 48px;
    --touch-target-min: 48px;
  }
}

@media (max-width: 640px) {
  .header {
    padding: var(--space-3);
  }

  .header-title {
    font-size: var(--text-base);
    flex: 1;
    min-width: 0;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .message {
    max-width: 95%;
  }

  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }

  .tag-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}

@media (max-width: 480px) {
  :root {
    --space-6: 20px;
  }

  .mobile-stack {
    flex-direction: column;
  }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .input-container {
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --surface-border: var(--text-secondary);
    --text-muted: var(--text-secondary);
  }
}


/* ============================================
   6. UTILITIES
   ============================================ */

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* Spacing */
.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }

.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }

/* Text colors (ANSI) */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--accent-success); }
.text-warning { color: var(--accent-warning); }
.text-error { color: var(--accent-error); }
.text-info { color: var(--accent-info); }
.text-accent { color: var(--accent-primary); }

/* Font weights */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }

/* Touch-friendly */
.touch-target {
  min-height: var(--touch-target);
  min-width: var(--touch-target);
}

/* Scrolling */
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.scroll-smooth { scroll-behavior: smooth; }

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Visibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   8. WORKFLOW PIPELINE (Linear-inspired)
   ============================================ */

/* Workflow pipeline horizontal display */
.workflow-pipeline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.workflow-step {
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all var(--duration-base) var(--ease-out);
}

.workflow-step.active {
  background: var(--accent-primary);
  color: var(--background);
  font-weight: 600;
}

.workflow-step.done {
  color: var(--accent-success);
}

.workflow-step.failed {
  color: var(--accent-error);
}

.workflow-step.pending {
  color: var(--text-muted);
}

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

/* Workflow step indicators with terminal feel */
.workflow-step-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  transition: all var(--duration-base) var(--ease-out);
}

.workflow-step-indicator:hover {
  border-color: var(--surface-border-strong);
}

.workflow-step-indicator.active {
  border-color: var(--accent-primary);
  border-width: 2px;
}

.workflow-step-indicator.done {
  border-left: 3px solid var(--accent-success);
}

.workflow-step-indicator.failed {
  border-left: 3px solid var(--accent-error);
}


/* ============================================
   9. ANIMATIONS (Linear-inspired)
   ============================================ */

/* Status pulse animation - used for running states */
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Fade in animation for modals and panels */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in up - for cards and content */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide in from right - for panels */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in - for modals */
@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Shimmer loading effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Terminal cursor blink */
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Animation utility classes */
.animate-fade-in {
  animation: fade-in var(--duration-slow) var(--ease-out);
}

.animate-fade-in-up {
  animation: fade-in-up var(--duration-slow) var(--ease-out);
}

.animate-slide-in-right {
  animation: slide-in-right var(--duration-slow) var(--ease-out);
}

.animate-scale-in {
  animation: scale-in var(--duration-base) var(--ease-spring);
}

.animate-pulse {
  animation: status-pulse 2s ease infinite;
}

.animate-pulse-fast {
  animation: status-pulse 1s ease infinite;
}

/* Shimmer loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-secondary) 25%,
    var(--surface-tertiary) 50%,
    var(--surface-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* Terminal cursor */
.terminal-cursor {
  display: inline-block;
  width: var(--cursor-width);
  height: var(--cursor-height);
  background: var(--cursor-color);
  animation: cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* No print */
@media print {
  .no-print {
    display: none !important;
  }
}


/* ============================================
   SPRINT 2: MESSAGE TYPE SYSTEM
   ============================================ */

/* S2-001: Message Types (notify/ask/error) */

/* Base message styles (extends existing .message) */
.message--notify,
.message--ask,
.message--error {
  animation: fadeIn 0.2s var(--ease-out);
}

/* NOTIFY: Status updates - subtle, full-width, no reply needed */
.message--notify {
  align-self: stretch;
  max-width: 100%;
}

.message--notify .message-bubble {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border-left: 2px solid var(--msg-notify-border);
  border-radius: 0;
}

.message--notify .message-icon {
  width: 16px;
  height: 16px;
  color: var(--color-info);
  opacity: 0.7;
  flex-shrink: 0;
}

.message--notify .message-text {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  flex: 1;
}

.message--notify .message-time--inline {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: auto;
}

/* Notify variants */
.message--notify[data-notify-variant="step-start"] .message-bubble {
  border-color: var(--color-info);
}

.message--notify[data-notify-variant="step-done"] .message-bubble {
  border-color: var(--color-success);
}

.message--notify[data-notify-variant="step-skip"] .message-bubble {
  border-color: var(--text-muted);
  opacity: 0.6;
}

.message--notify[data-notify-variant="agent-switch"] .message-bubble {
  border-color: var(--accent-primary);
}

/* ASK: Questions requiring user input */
.message--ask {
  align-self: flex-start;
  max-width: 85%;
}

.message--ask .message-bubble {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--msg-ask-border);
  border-left: 3px solid var(--msg-ask-border);
  border-radius: var(--radius-md);
  animation: askPulse 0.8s ease-in-out;
}

@keyframes askPulse {
  0%, 100% { border-color: var(--accent-primary); }
  50% { border-color: rgba(56, 217, 169, 0.5); }
}

.message--ask__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.message--ask .message-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.message--ask__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message--ask .message-time--inline {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: auto;
}

.message--ask__question {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
}

.message--ask__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ask-option-btn {
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-primary);
  background: transparent;
  color: var(--accent-primary);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out);
}

.ask-option-btn:hover {
  background: var(--accent-primary-muted);
}

.ask-option-btn:active {
  background: rgba(56, 217, 169, 0.25);
  transform: scale(0.97);
}

.ask-option-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.ask-option-btn--selected {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  pointer-events: none;
  opacity: 0.8;
}

.ask-option-btn--selected::after {
  content: '';
  width: 14px;
  height: 14px;
  margin-left: var(--space-2);
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

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

/* Ask free-text input */
.message--ask__input-group {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.message--ask__input {
  flex: 1;
  height: 44px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}

.message--ask__input:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.message--ask__submit {
  height: 44px;
  padding: var(--space-2) var(--space-4);
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
}

.message--ask__submit:hover {
  background: var(--accent-primary-hover);
}

/* Ask answered state */
.message--ask[data-answered="true"] .message-bubble {
  border-color: var(--border-default);
}

.message--ask[data-answered="true"] .message--ask__label {
  color: var(--color-success);
}

.message--ask[data-answered="true"] .message--ask__options {
  opacity: 0.4;
  pointer-events: none;
}

.message--ask__response {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-2);
}

/* ERROR: Failure messages with actions */
.message--error {
  align-self: flex-start;
  max-width: 85%;
}

.message--error .message-bubble {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--msg-error-bg);
  border: 1px solid var(--msg-error-border);
  border-left: 3px solid var(--msg-error-border);
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s var(--ease-out), errorShake 0.3s 0.2s var(--ease-out);
}

@keyframes errorShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-4px); }
  40%  { transform: translateX(4px); }
  60%  { transform: translateX(-2px); }
  80%  { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

.message--error__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.message--error .message-icon {
  width: 20px;
  height: 20px;
  color: var(--color-error);
}

.message--error__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-error);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message--error .message-time--inline {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: auto;
}

.message--error__collapse {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform var(--duration-base) var(--ease-out);
}

.message--error__collapse[aria-expanded="false"] {
  transform: rotate(180deg);
}

.message--error__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.message--error__detail {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.message--error__detail--code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  overflow-x: auto;
  white-space: pre-wrap;
}

.message--error__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.btn--error-retry {
  height: 36px;
  padding: var(--space-2) var(--space-4);
  background: var(--color-error);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
}

.btn--error-retry:hover {
  background: var(--ansi-bright-red);
}

.btn--error-retry:active {
  transform: scale(0.97);
}

.btn--error-secondary {
  height: 36px;
  padding: var(--space-2) var(--space-4);
  background: transparent;
  color: var(--color-error);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
}

.btn--error-secondary:hover {
  border-color: var(--color-error);
  background: var(--msg-error-bg);
}

/* Notify grouping (3+ consecutive notifies) */
.notify-group-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  background: transparent;
  border: none;
}

.notify-group-toggle:hover {
  color: var(--text-secondary);
}

.notify-group {
  display: none;
}

.notify-group--expanded {
  display: contents;
}


/* ============================================
   SPRINT 2: LOG PANEL
   ============================================ */

/* S2-002: Log Panel Layout */
.log-panel {
  position: fixed;
  right: 0;
  top: 56px; /* header height */
  bottom: 0;
  width: var(--log-panel-width);
  max-width: 45vw;
  background: var(--background);
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: var(--z-panel);
}

.log-panel--open {
  transform: translateX(0);
}

/* S2-003: Log Panel Header */
.log-panel__header {
  height: 48px;
  padding: 0 var(--space-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.log-panel__title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.log-panel__live-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 10px;
  color: var(--color-success);
}

.log-panel__live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: 50%;
  animation: status-pulse 2s ease infinite;
}

.log-panel__step-select {
  height: 28px;
  padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  cursor: pointer;
}

.log-panel__step-select:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.log-panel__search {
  height: 28px;
  flex: 1;
  max-width: 160px;
  padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.log-panel__search::placeholder {
  color: var(--text-muted);
}

.log-panel__search:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.log-panel__actions {
  display: flex;
  gap: var(--space-1);
  margin-left: auto;
}

.log-panel__btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.log-panel__btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.log-panel__btn--active {
  color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.log-panel__btn svg {
  width: 16px;
  height: 16px;
}

/* S2-004: Log Filter Pills */
.log-panel__filters {
  height: 32px;
  padding: 0 var(--space-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.log-filter-pill {
  height: 22px;
  padding: var(--space-0) var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.log-filter-pill:hover {
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.log-filter-pill--active {
  background: rgba(250, 249, 246, 0.1);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.log-filter-pill--debug.log-filter-pill--active {
  background: rgba(77, 171, 247, 0.12);
  color: var(--color-info);
  border-color: rgba(77, 171, 247, 0.3);
}

.log-filter-pill--info.log-filter-pill--active {
  background: rgba(56, 217, 169, 0.12);
  color: var(--accent-primary);
  border-color: rgba(56, 217, 169, 0.3);
}

.log-filter-pill--warn.log-filter-pill--active {
  background: rgba(255, 230, 109, 0.12);
  color: var(--color-warning);
  border-color: rgba(255, 230, 109, 0.3);
}

.log-filter-pill--error.log-filter-pill--active {
  background: rgba(255, 107, 107, 0.12);
  color: var(--color-error);
  border-color: rgba(255, 107, 107, 0.3);
}

/* S2-005: Log Output Area */
.log-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: var(--space-2) 0;
  background: var(--background);
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-mono);
  font-size: var(--log-font-size);
}

.log-output--smooth {
  scroll-behavior: smooth;
}

/* S2-006: Log Entry */
.log-entry {
  display: flex;
  align-items: flex-start;
  padding: 2px var(--space-4);
  min-height: var(--log-entry-height);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  gap: var(--space-2);
}

.log-entry:hover {
  background: rgba(250, 249, 246, 0.03);
}

.log-entry:hover .log-entry__copy {
  opacity: 1;
}

.log-entry__level-gutter {
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
  border-radius: 2px;
  margin: 1px 0;
}

.log-entry--debug .log-entry__level-gutter { background: rgba(77, 171, 247, 0.3); }
.log-entry--info .log-entry__level-gutter { background: rgba(56, 217, 169, 0.4); }
.log-entry--warn .log-entry__level-gutter { background: rgba(255, 230, 109, 0.5); }
.log-entry--error .log-entry__level-gutter { background: var(--color-error); }

.log-entry__timestamp {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 62px;
  flex-shrink: 0;
  user-select: none;
}

.log-entry__badge {
  font-size: 10px;
  font-weight: var(--font-semibold);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  min-width: 42px;
  text-align: center;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.log-entry--debug .log-entry__badge {
  background: rgba(77, 171, 247, 0.12);
  color: var(--color-info);
}

.log-entry--info .log-entry__badge {
  background: rgba(56, 217, 169, 0.12);
  color: var(--accent-primary);
}

.log-entry--warn .log-entry__badge {
  background: rgba(255, 230, 109, 0.15);
  color: var(--color-warning);
}

.log-entry--error .log-entry__badge {
  background: rgba(255, 107, 107, 0.2);
  color: var(--color-error);
}

.log-entry__text {
  flex: 1;
}

.log-entry--debug .log-entry__text { color: var(--text-muted); }
.log-entry--info .log-entry__text { color: var(--text-secondary); }
.log-entry--warn .log-entry__text { color: rgba(255, 230, 109, 0.9); }
.log-entry--error .log-entry__text { color: rgba(255, 107, 107, 0.9); }

.log-entry__copy {
  opacity: 0;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.log-entry__copy:hover {
  color: var(--text-primary);
}

.log-entry__copy svg {
  width: 14px;
  height: 14px;
}

/* Search highlighting */
.log-highlight {
  background: rgba(255, 230, 109, 0.25);
  color: var(--color-warning);
  border-radius: 2px;
}

/* Jump to bottom button */
.log-jump-btn {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
}

.log-jump-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Log Section (collapsible step groups) */
.log-section {
  margin: var(--space-1) 0;
  border-top: 1px solid var(--border-subtle);
}

.log-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  cursor: pointer;
  background: var(--bg-surface);
  transition: background var(--duration-fast) var(--ease-out);
}

.log-section__header:hover {
  background: var(--bg-elevated);
}

.log-section__chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
  transform: rotate(-90deg);
}

.log-section--expanded .log-section__chevron {
  transform: rotate(0deg);
}

.log-section__step-name {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.log-section__line-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.log-section__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.log-section__status-dot--running {
  background: var(--color-info);
  animation: status-pulse 2s ease infinite;
}

.log-section__status-dot--done { background: var(--color-success); }
.log-section__status-dot--failed { background: var(--color-error); }
.log-section__status-dot--skipped { background: var(--text-muted); }

.log-section__entries {
  display: none;
}

.log-section--expanded .log-section__entries {
  display: block;
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

/* Log panel loading state */
.log-panel--loading .log-output {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.log-panel__loading-cursor {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  animation: cursor-blink 1s step-end infinite;
}

.log-panel__loading-text {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* Log panel empty state */
.log-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 100%;
  color: var(--text-muted);
}

.log-panel__empty-icon {
  width: 24px;
  height: 24px;
}

.log-panel__empty-text {
  font-size: var(--text-sm);
}

.log-panel__empty-subtext {
  font-size: var(--text-xs);
  color: var(--text-disabled);
}


/* ============================================
   SPRINT 2: TIMELINE ENHANCEMENTS
   ============================================ */

/* S2-007: Enhanced Timeline Track */
.timeline--enhanced .timeline__track {
  height: var(--timeline-track-height);
  background: var(--bg-elevated);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  margin: var(--space-2) 0;
  user-select: none;
}

/* Expand touch area */
.timeline--enhanced .timeline__track::before {
  content: '';
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: 0;
  right: 0;
}

.timeline--enhanced .timeline__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width 0.3s var(--ease-out);
  pointer-events: none;
}

.timeline--enhanced.timeline--playing .timeline__progress {
  transition: width 1s linear;
}

.timeline--enhanced.timeline--scrubbing .timeline__progress {
  transition: none;
}

/* S2-008: Enhanced Playhead */
.timeline--enhanced .timeline__playhead {
  position: absolute;
  top: -4px;
  width: var(--timeline-playhead-size);
  height: var(--timeline-playhead-size);
  background: var(--accent-primary);
  border: 2px solid var(--background);
  border-radius: 50%;
  transform: translateX(-50%);
  cursor: grab;
  z-index: 2;
  transition: transform var(--duration-fast) var(--ease-out);
}

.timeline--enhanced .timeline__playhead:hover {
  transform: translateX(-50%) scale(1.25);
}

.timeline--enhanced .timeline__playhead:active {
  cursor: grabbing;
  transform: translateX(-50%) scale(1.15);
}

.timeline--enhanced .timeline__playhead:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* S2-009: Enhanced Step Markers */
.timeline--enhanced .timeline__marker {
  position: absolute;
  top: -2px;
  width: var(--timeline-marker-width);
  height: 12px;
  background: var(--border-strong);
  border-radius: 1px;
  transform: translateX(-50%);
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-out),
              height var(--duration-base) var(--ease-out),
              top var(--duration-base) var(--ease-out);
}

.timeline--enhanced .timeline__marker:hover {
  background: var(--accent-primary);
  height: 16px;
  top: -4px;
}

.timeline--enhanced .timeline__marker--active {
  background: var(--text-primary);
  height: 18px;
  top: -5px;
}

.timeline--enhanced .timeline__marker[data-status="pending"] { background: var(--border-strong); }
.timeline--enhanced .timeline__marker[data-status="running"] {
  background: var(--color-info);
  animation: status-pulse 2s ease infinite;
}
.timeline--enhanced .timeline__marker[data-status="done"] { background: var(--color-success); }
.timeline--enhanced .timeline__marker[data-status="failed"] {
  background: var(--color-error);
  height: 14px;
}
.timeline--enhanced .timeline__marker[data-status="skipped"] {
  background: var(--text-muted);
  opacity: 0.5;
}

/* S2-010: Timeline Tooltip */
.timeline__tooltip {
  position: absolute;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-width: 160px;
  max-width: 240px;
  white-space: nowrap;
  z-index: var(--z-tooltip);
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn var(--duration-fast) var(--ease-out) 0.2s forwards;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.timeline__tooltip-name {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.timeline__tooltip-agent {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.timeline__tooltip-duration {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.timeline__tooltip-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11px;
  margin-top: var(--space-1);
}

.timeline__tooltip-arrow {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--bg-elevated);
}

/* S2-011: Enhanced Playback Controls */
.timeline--enhanced .timeline__controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.timeline--enhanced .timeline__play-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.timeline--enhanced .timeline__play-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.timeline--enhanced .timeline__play-btn:active {
  transform: scale(0.92);
}

.timeline--enhanced .timeline__play-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.timeline--enhanced .timeline__play-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.timeline--enhanced .timeline__play-btn--primary {
  width: 36px;
  height: 36px;
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  border-color: rgba(56, 217, 169, 0.3);
}

.timeline--enhanced .timeline__play-btn--primary:hover {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
}

.timeline--enhanced .timeline__speed-btn {
  width: 36px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.timeline--enhanced .timeline__time-display {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  min-width: 100px;
  margin-left: auto;
}

/* S2-012: Timeline Mobile */
@media (max-width: 768px) {
  .log-panel {
    width: 100%;
    max-width: 100%;
    top: auto;
    bottom: 0;
    height: 70vh;
    max-height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border-default);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }

  .log-panel--open {
    transform: translateY(0);
  }

  .log-panel__header {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-2);
  }

  .log-panel__search {
    max-width: 100%;
    width: 100%;
    order: 10;
  }

  .log-entry__timestamp {
    display: none;
  }

  .log-entry__badge {
    width: 36px;
    min-width: 36px;
  }

  .log-panel__filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .timeline--enhanced .timeline__track {
    height: 10px;
  }

  .timeline--enhanced .timeline__playhead {
    width: 20px;
    height: 20px;
  }

  .timeline--enhanced .timeline__play-btn {
    width: 40px;
    height: 40px;
  }

  .timeline--enhanced .timeline__play-btn--primary {
    width: 44px;
    height: 44px;
  }

  .timeline--enhanced .timeline__time-display {
    display: none;
  }

  .timeline--enhanced .timeline__controls {
    gap: var(--space-2);
  }

  .message--ask__options {
    gap: var(--space-1);
  }

  .ask-option-btn {
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
  }

  .message--error__actions {
    flex-direction: column;
  }

  .btn--error-retry,
  .btn--error-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* S2-013: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .message--ask .message-bubble {
    animation: none;
  }

  .message--error .message-bubble {
    animation: fadeIn 0.2s var(--ease-out);
  }

  .timeline--enhanced .timeline__progress,
  .timeline--enhanced .timeline__playhead,
  .timeline--enhanced .timeline__marker {
    transition: none;
  }

  .timeline__tooltip {
    animation: none;
    opacity: 1;
  }

  .log-panel {
    transition: none;
  }
}


/* ============================================
   PHASE 4: UNIFIED DASHBOARD LAYOUT
   ============================================ */

/* === App Shell === */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* === App Header with Navigation === */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-primary);
  border-bottom: 1px solid var(--surface-border);
  flex-shrink: 0;
  min-height: 56px;
}

.app-header__logo {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--accent-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

/* === Primary Navigation === */
.nav {
  display: flex;
  gap: var(--space-1);
}

.nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.nav__link:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.nav__link--active {
  color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.nav__link--active:hover {
  background: var(--accent-primary-muted);
}

.nav__icon {
  width: 16px;
  height: 16px;
}

/* === App Body (Main Layout) === */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--surface-primary);
  border-right: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--duration-slow) var(--ease-out),
              min-width var(--duration-slow) var(--ease-out);
}

.sidebar--collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--surface-border);
}

.sidebar__title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: var(--space-1);
}

.sidebar__item:hover {
  background: var(--surface-hover);
}

.sidebar__item--active {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

.sidebar__item-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar__item--active .sidebar__item-icon {
  color: var(--accent-primary);
}

.sidebar__item-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__item-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar__item-status--running {
  background: var(--accent-primary);
  animation: status-pulse 2s ease infinite;
}

.sidebar__item-status--failed {
  background: var(--color-error);
}

.sidebar__item-status--idle {
  background: var(--text-muted);
}

.sidebar__divider {
  height: 1px;
  background: var(--surface-border);
  margin: var(--space-3) var(--space-2);
}

/* === Main Content Area === */
.main-content {
  flex: 1;
  overflow: auto;
  background: var(--background);
  padding: var(--space-4);
}

/* === Detail Panel (Right) === */
.detail-panel {
  width: 480px;
  min-width: 480px;
  background: var(--surface-primary);
  border-left: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  transition: transform var(--duration-slow) var(--ease-out),
              width var(--duration-slow) var(--ease-out);
}

.detail-panel--hidden {
  transform: translateX(100%);
  width: 0;
  min-width: 0;
}

.detail-panel--wide {
  width: 600px;
  min-width: 600px;
}

/* === Status Bar === */
.status-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-secondary);
  border-top: 1px solid var(--surface-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.status-bar__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-bar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-bar__dot--healthy {
  background: var(--accent-success);
}

.status-bar__dot--warning {
  background: var(--accent-warning);
}

.status-bar__dot--error {
  background: var(--accent-error);
}


/* === Views === */
.view {
  animation: fade-in var(--duration-base) var(--ease-out);
}

.view--projects {
  /* Projects view specific styles */
}

.view--runs {
  /* Runs view specific styles */
}

.view--agents {
  /* Agents view specific styles */
}


/* === Request Input Component === */
.request-input {
  background: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.request-input:focus-within {
  border-color: var(--accent-primary);
}

.request-input__label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.request-input__textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.request-input__textarea:focus {
  border-color: var(--accent-primary);
}

.request-input__textarea::placeholder {
  color: var(--text-muted);
}

.request-input__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.request-input__workflow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.request-input__workflow-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.request-input__workflow-select {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
}

.request-input__workflow-select:focus {
  border-color: var(--accent-primary);
}


/* === Request List Component === */
.request-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.request-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.request-item:hover {
  background: var(--surface-tertiary);
  border-color: var(--surface-border-strong);
}

.request-item--active {
  border-color: var(--accent-primary);
  border-width: 2px;
}

.request-item__status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.request-item__status--running {
  background: var(--accent-primary);
  animation: status-pulse 2s ease infinite;
}

.request-item__status--done {
  background: var(--accent-success);
}

.request-item__status--failed {
  background: var(--accent-error);
}

.request-item__status--pending {
  background: var(--text-muted);
}

.request-item__content {
  flex: 1;
  min-width: 0;
}

.request-item__title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}


/* === Inspector Component (Unified) === */
.inspector {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.inspector__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--surface-border);
}

.inspector__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.inspector__close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.inspector__tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-primary);
  border-bottom: 1px solid var(--surface-border);
}

.inspector__tab {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.inspector__tab:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.inspector__tab--active {
  color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.inspector__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

/* Inspector Steps Tab */
.inspector__steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Inspector Console Tab */
.inspector__console {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
  background: var(--background);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
}

/* Inspector Timeline Tab */
.inspector__timeline {
  /* Timeline styles - uses existing timeline component */
}


/* === Step Item (Unified) === */
.step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.step:hover {
  border-color: var(--surface-border-strong);
}

.step--active {
  border-color: var(--accent-primary);
  border-width: 2px;
  background: var(--accent-primary-muted);
}

.step--done {
  border-left: 3px solid var(--accent-success);
}

.step--failed {
  border-left: 3px solid var(--accent-error);
}

.step--skipped {
  opacity: 0.5;
}

.step__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.step__icon--done {
  background: var(--color-success-muted);
  color: var(--accent-success);
}

.step__icon--running {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

.step__icon--pending {
  background: var(--surface-tertiary);
  color: var(--text-muted);
}

.step__icon--failed {
  background: var(--color-error-muted);
  color: var(--accent-error);
}

.step__name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.step__status {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.step__agent {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-2);
  background: var(--surface-tertiary);
  border-radius: var(--radius-sm);
}


/* === Intervention Bar === */
.intervention {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--surface-border);
}

.intervention__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--surface-tertiary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.intervention__btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--surface-border-strong);
}

.intervention__btn--pause {
  color: var(--accent-warning);
  border-color: rgba(255, 230, 109, 0.3);
}

.intervention__btn--pause:hover {
  background: var(--color-warning-muted);
}

.intervention__btn--cancel {
  color: var(--accent-error);
  border-color: rgba(255, 107, 107, 0.3);
}

.intervention__btn--cancel:hover {
  background: var(--color-error-muted);
}

.intervention__btn svg {
  width: 14px;
  height: 14px;
}


/* === View-specific styles === */

/* Project Detail View */
.project-detail {
  max-width: 800px;
}

.project-detail__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.project-detail__name {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.project-detail__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.project-detail__section {
  margin-bottom: var(--space-6);
}

.project-detail__section-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}


/* === Responsive: Tablet === */
@media (max-width: 1200px) {
  .sidebar {
    width: 240px;
    min-width: 240px;
  }

  .detail-panel {
    width: 400px;
    min-width: 400px;
  }

  .detail-panel--wide {
    width: 480px;
    min-width: 480px;
  }
}


/* === Responsive: Mobile === */
@media (max-width: 768px) {
  .app-body {
    flex-direction: column;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: var(--z-overlay);
  }

  .sidebar--mobile-open {
    display: flex;
  }

  .detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: 100%;
    z-index: var(--z-modal);
    transform: translateX(100%);
  }

  .detail-panel--open {
    transform: translateX(0);
  }

  .main-content {
    padding: var(--space-3);
  }

  .nav {
    display: none;
  }

  /* Mobile bottom navigation */
  .mobile-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: var(--space-2);
    background: var(--surface-primary);
    border-top: 1px solid var(--surface-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  }

  .mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
  }

  .mobile-nav__item--active {
    color: var(--accent-primary);
  }

  .mobile-nav__icon {
    width: 24px;
    height: 24px;
  }

  /* Add padding to main content for mobile bottom nav */
  .app {
    padding-bottom: 70px;
  }

  .request-input__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .request-input__workflow {
    justify-content: space-between;
  }

  .intervention {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 56px;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-overlay) - 1);
}

.sidebar-overlay--visible {
  display: block;
}

/* Desktop: hide mobile nav */
@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}
