/* ============================================
   AETHON DASHBOARD - COZY WARM THEME
   ============================================ */

/* Google Fonts - handwritten style for headings */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Cozy Warm Colors */
  --bg-cream: #faf7f2;
  --bg-card: #ffffff;
  --bg-sidebar: #fef6ee;

  /* Warm accent colors */
  --accent-orange: #f59e0b;
  --accent-coral: #fb7185;
  --accent-sage: #84cc16;
  --accent-brown: #92400e;
  --accent-peach: #fed7aa;

  /* Text colors */
  --text-primary: #44403c;
  --text-secondary: #78716c;
  --text-muted: #a8a29e;

  /* Borders */
  --border-color: #e7e5e4;
  --border-warm: #fde68a;

  /* Shadows - warm tinted */
  --shadow-sm: 0 1px 2px rgba(146, 64, 14, 0.05);
  --shadow-md: 0 4px 12px rgba(146, 64, 14, 0.08);
  --shadow-lg: 0 12px 32px rgba(146, 64, 14, 0.12);

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 70px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  line-height: 1.6;
}

#app {
  display: flex;
  height: 100vh;
}

/* ============================================
   SIDEBAR - Cozy Navigation
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #fff9f0 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: relative;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(254, 215, 170, 0.3) 0%, transparent 100%);
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3));
}

.logo-text {
  font-family: 'Caveat', cursive;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-brown);
  letter-spacing: -0.5px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
  font-weight: 500;
  font-size: 0.9375rem;
  position: relative;
}

.nav-item:hover {
  background-color: rgba(254, 215, 170, 0.5);
  color: var(--accent-brown);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-peach) 0%, #fef3c7 100%);
  color: var(--accent-brown);
  box-shadow: var(--shadow-sm);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--accent-orange);
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  font-size: 1.25rem;
  width: 1.5rem;
  text-align: center;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  position: relative;
  z-index: 1;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-muted);
  transition: all 0.3s ease;
}

.status-dot.connected {
  background-color: var(--accent-sage);
  box-shadow: 0 0 8px rgba(132, 204, 22, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-cream);
}

/* ============================================
   HEADER - Friendly Greeting
   ============================================ */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

.header-left h1 {
  font-family: 'Caveat', cursive;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.server-url {
  display: flex;
  gap: 0.75rem;
}

.server-url input {
  padding: 0.625rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  width: 200px;
  background: white;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.server-url input:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* ============================================
   BUTTONS - Rounded & Friendly
   ============================================ */
.btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-orange) 0%, #fbbf24 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-cream);
  border-color: var(--accent-orange);
  color: var(--accent-brown);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-coral) 0%, #f43f5e 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  display: none;
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.section.active {
  display: block;
}

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

.section-header h2 {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================
   CARDS - Soft & Cozy
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(254, 247, 242, 0.5) 0%, transparent 100%);
}

.card-header h3 {
  font-family: 'Caveat', cursive;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 1.5rem;
}

/* ============================================
   STAT CARDS - Warm Gradients
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card:nth-child(1) {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.stat-card:nth-child(2) {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.stat-card:nth-child(3) {
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
}

.stat-card:nth-child(4) {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.stat-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   FORMS - Cozy Input Fields
   ============================================ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: white;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.form-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-orange);
  cursor: pointer;
}

.form-row select {
  flex: 1;
  min-width: 150px;
}

.form-row input[type="text"] {
  flex: 2;
  min-width: 200px;
}

/* ============================================
   SESSION LIST
   ============================================ */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  background: var(--bg-cream);
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  transition: all 0.2s ease;
}

.session-item:hover {
  border-color: var(--accent-peach);
  background: white;
}

.session-info {
  flex: 1;
}

.session-goal {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.session-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.session-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  background: var(--bg-cream);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

/* ============================================
   STATUS BADGES - Colorful Pills
   ============================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
}

.status-planning {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
}

.status-executing {
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
  color: #9d174d;
}

.status-verifying {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
}

.status-completed {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
}

.status-failed {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
}

.status-paused {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #374151;
}

/* ============================================
   VERIFY & TOOL RESULTS
   ============================================ */
.verify-result,
.tool-result {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.verify-result.success,
.tool-result.success {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 2px solid #86efac;
}

.verify-result.error,
.tool-result.error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border: 2px solid #fca5a5;
}

.verify-status,
.tool-status {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.verify-details,
.tool-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tool-output {
  background: #1e293b;
  color: #a7f3d0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  line-height: 1.5;
}

.tool-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

/* ============================================
   AGENT SECTION
   ============================================ */
.agent-container {
  display: grid;
  gap: 1.5rem;
}

.agent-input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.agent-input-group textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
}

.agent-input-group textarea:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

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

.agent-controls select {
  padding: 0.625rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: white;
  color: var(--text-primary);
  cursor: pointer;
}

.agent-controls select:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.agent-status {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.agent-message {
  padding: 1rem;
  background: var(--bg-cream);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.agent-actions-list {
  margin-top: 1rem;
}

.agent-duration {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.example-btn {
  padding: 0.75rem 1rem;
  background: var(--bg-cream);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.example-btn:hover {
  background: white;
  border-color: var(--accent-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   TASKS SECTION
   ============================================ */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.task-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.task-info h4 {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.task-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

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

.task-input-container {
  margin-bottom: 1.5rem;
}

.task-input-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ============================================
   CHAT SECTION
   ============================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: calc(100vh - var(--header-height) - 6rem);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-cream);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.chat-message {
  max-width: 75%;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  line-height: 1.5;
}

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-orange) 0%, #fbbf24 100%);
  color: white;
  border-bottom-right-radius: 6px;
}

.chat-message.assistant {
  align-self: flex-start;
  background: white;
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.chat-input-container {
  display: flex;
  gap: 0.75rem;
}

.chat-input-container textarea {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 0.9375rem;
  resize: none;
  min-height: 50px;
}

.chat-input-container textarea:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

/* ============================================
   SCREEN SECTION
   ============================================ */
.screen-preview {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.screen-preview img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

/* ============================================
   MESSAGING SECTION
   ============================================ */
.messaging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.service-icon {
  font-size: 2rem;
  margin-right: 0.75rem;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  background: var(--bg-cream);
  border-radius: var(--radius-md);
}

.service-status.connected {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
}

.service-status.disconnected {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
}

.qr-container {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.qr-container canvas {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.events-log {
  max-height: 200px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 1rem;
  background: #1e293b;
  color: #a7f3d0;
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.stopped-info {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-secondary);
}

.stopped-info .hint {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

.token-input {
  padding: 1.25rem;
}

.token-input label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.token-input input {
  width: 100%;
  padding: 0.875rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
}

.token-input input:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.card-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-cream);
}

.card-footer .btn {
  flex: 1;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-cream);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

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

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.section.active {
  animation: fadeIn 0.3s ease;
}

/* ============================================
   LLM PLANNER & CHAT
   ============================================ */

.llm-planner-card,
.llm-chat-card {
  border: 2px solid var(--border-warm);
  background: linear-gradient(135deg, #fffbeb 0%, var(--bg-card) 100%);
}

.badge-new {
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-coral));
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.planner-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.planner-input-group textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  transition: all 0.2s ease;
}

.planner-input-group textarea:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

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

.planner-controls input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.planner-controls input:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.planner-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--text-secondary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.plan-result {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--border-color);
}

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

.plan-header h4 {
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  color: var(--text-primary);
}

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

.btn-success {
  background: linear-gradient(135deg, var(--accent-sage), #65a30d);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card {
  background: var(--bg-cream);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.task-card:hover {
  border-color: var(--accent-orange);
  transform: translateX(4px);
}

.task-number {
  width: 32px;
  height: 32px;
  background: var(--accent-orange);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.task-card.completed .task-number {
  background: var(--accent-sage);
}

.task-card.running .task-number {
  background: var(--accent-coral);
  animation: pulse 1s infinite;
}

.task-content {
  flex: 1;
}

.task-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.task-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.task-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.task-badge.type {
  background: #e0f2fe;
  color: #0369a1;
}

.task-badge.effort {
  background: #fef3c7;
  color: #92400e;
}

.task-badge.priority-high,
.task-badge.priority-critical {
  background: #fee2e2;
  color: #dc2626;
}

.task-badge.priority-medium {
  background: #fef3c7;
  color: #d97706;
}

.task-badge.priority-low {
  background: #dcfce7;
  color: #16a34a;
}

.plan-meta {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-cream);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

/* Chat Interface */
.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-cream);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
}

.chat-message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-peach);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.chat-message.user .message-avatar {
  background: var(--accent-orange);
}

.message-content {
  background: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.chat-message.user .message-content {
  background: var(--accent-orange);
  color: white;
}

.chat-input-group {
  display: flex;
  gap: 0.75rem;
}

.chat-input-group input {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.chat-input-group input:focus {
  outline: none;
  border-color: var(--accent-orange);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    width: 70px;
    padding: 1rem 0.5rem;
  }

  .logo-text,
  .nav-item span:not(.nav-icon) {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0.75rem;
  }

  .nav-icon {
    font-size: 1.5rem;
  }

  .header {
    padding: 0 1rem;
  }

  .section {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .planner-controls {
    flex-direction: column;
  }

  .plan-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
}

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

  .messaging-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   PLANNER & EXECUTION STYLES
   ============================================ */

.task-card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 0.5rem;
}

.task-card-status.status-pending {
  background: #f3f4f6;
  color: #6b7280;
}

.task-card-status.status-in_progress,
.task-card-status.status-running {
  background: #dbf4ff;
  color: #0c4a6e;
  border: 1px solid #bae6fd;
}

.task-card-status.status-completed {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.task-card-status.status-failed {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.spinner-small {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-left-color: currentColor;
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
}

.execution-note {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
  color: #166534;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  animation: slideIn 0.3s ease;
}

.task-card.status-completed {
  opacity: 0.8;
  border-left-color: #22c55e;
}

.task-card.status-failed {
  border-left-color: #ef4444;
}

.task-card.status-in_progress {
  border-left-color: #3b82f6;
  background: #eff6ff;
  transform: translateX(4px);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  min-width: 300px;
  max-width: 450px;
  pointer-events: auto;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid transparent;
}

.toast.toast-success {
  border-left-color: #22c55e;
}

.toast.toast-error {
  border-left-color: #ef4444;
}

.toast.toast-info {
  border-left-color: #3b82f6;
}

.toast.toast-warning {
  border-left-color: #f59e0b;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  margin-left: 0.5rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.toast-close:hover {
  opacity: 1;
  color: var(--text-primary);
}

.toast.toast-autofix {
  border-left-color: #8b5cf6;
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
}

.toast.toast-progress {
  border-left-color: #06b6d4;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
}

.toast.toast-progress .toast-icon {
  animation: spin 1s linear infinite;
}

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

/* ==================== Agent Cards ==================== */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 4px 2px;
}

.agent-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.agent-card.active-agent {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 99,102,241), 0.15);
}

.agent-card.offline { opacity: 0.65; }

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
}

.agent-platform-icon { font-size: 1.4rem; }

.agent-name {
  font-weight: 700;
  font-size: 1rem;
  text-transform: capitalize;
  flex: 1;
}

.agent-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.agent-badge.online  { background: #d1fae5; color: #065f46; }
.agent-badge.offline { background: #fee2e2; color: #991b1b; }
.agent-badge.active  { background: #e0e7ff; color: #3730a3; }

.agent-card-body { padding: 14px 16px; }

.agent-desc { font-size: 0.85rem; opacity: 0.7; margin: 0 0 10px; }

.agent-stats {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  font-family: var(--font-mono, monospace);
  opacity: 0.65;
}

.agent-card-footer {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

/* Agent selector in header */
.agent-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

.agent-select {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 0.85rem;
  cursor: pointer;
}