/* ===== Design Tokens ===== */
:root {
  /* Colors - Dark Theme */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a26;
  --bg-card: #16161f;
  --bg-card-hover: #1e1e2a;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);

  --text-primary: #f0f0f5;
  --text-secondary: #8b8b9e;
  --text-tertiary: #5a5a6e;
  --text-inverse: #0a0a0f;

  /* Accent Colors */
  --accent-primary: #6c5ce7;
  --accent-primary-hover: #7d6ff0;
  --accent-primary-glow: rgba(108, 92, 231, 0.3);
  --accent-success: #00d68f;
  --accent-success-glow: rgba(0, 214, 143, 0.2);
  --accent-warning: #ffb800;
  --accent-warning-glow: rgba(255, 184, 0, 0.2);
  --accent-danger: #ff4757;
  --accent-danger-glow: rgba(255, 71, 87, 0.2);
  --accent-info: #4da6ff;
  --accent-info-glow: rgba(77, 166, 255, 0.2);

  /* Status Colors */
  --status-running: #4da6ff;
  --status-completed: #00d68f;
  --status-failed: #ff4757;
  --status-queued: #ffb800;
  --status-cancelled: #8b8b9e;

  /* Output terminal */
  --output-bg: #0d0d14;
  --output-text: #c8c8d8;

  /* Header blur */
  --header-bg: rgba(10, 10, 15, 0.85);
  --modal-backdrop: rgba(0, 0, 0, 0.7);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-primary-glow);

  /* Glass */
  --glass-blur: 16px;
  --glass-saturate: 1.8;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  --bg-primary: #f5f5f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eeeef2;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f8fb;
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-hover: rgba(0, 0, 0, 0.06);

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.18);

  --text-primary: #1a1a2e;
  --text-secondary: #5a5a72;
  --text-tertiary: #8a8aa0;
  --text-inverse: #f0f0f5;

  --accent-primary: #5b4cdb;
  --accent-primary-hover: #4e3fd0;
  --accent-primary-glow: rgba(91, 76, 219, 0.15);
  --accent-success: #00b877;
  --accent-success-glow: rgba(0, 184, 119, 0.12);
  --accent-warning: #e5a600;
  --accent-warning-glow: rgba(229, 166, 0, 0.12);
  --accent-danger: #e8384f;
  --accent-danger-glow: rgba(232, 56, 79, 0.12);
  --accent-info: #3b8fe8;
  --accent-info-glow: rgba(59, 143, 232, 0.12);

  --status-running: #3b8fe8;
  --status-completed: #00b877;
  --status-failed: #e8384f;
  --status-queued: #e5a600;
  --status-cancelled: #8a8aa0;

  --output-bg: #f0f0f4;
  --output-text: #2a2a42;

  --header-bg: rgba(245, 245, 248, 0.9);
  --modal-backdrop: rgba(0, 0, 0, 0.35);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 30px var(--accent-primary-glow);
}

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.4s var(--ease-spring);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-glass-hover);
  color: var(--accent-primary);
  transform: rotate(45deg) scale(1.1);
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px var(--accent-primary-glow);
}

.theme-toggle:active {
  transform: rotate(90deg) scale(0.9);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Subtle background grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 214, 143, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(91, 76, 219, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 184, 119, 0.03) 0%, transparent 50%);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 100px;
  transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

/* ===== Header ===== */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: var(--header-bg);
  backdrop-filter: blur(24px) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(24px) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 1px 0 0 var(--border-subtle), 0 4px 24px -4px rgba(0, 0, 0, 0.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 20px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(var(--glass-blur));
  transition: all 0.25s var(--ease-out-expo);
}

.stat:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-running {
  background: var(--status-running);
  box-shadow: 0 0 8px var(--accent-info-glow);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.dot-completed { background: var(--status-completed); }
.dot-failed { background: var(--status-failed); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

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

.stat-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: transform 0.2s var(--ease-spring);
}

.badge:hover {
  transform: scale(1.05);
}

.badge-glass {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-running {
  background: var(--accent-info-glow);
  color: var(--status-running);
  border: 1px solid rgba(77, 166, 255, 0.3);
}

.badge-completed {
  background: var(--accent-success-glow);
  color: var(--status-completed);
  border: 1px solid rgba(0, 214, 143, 0.3);
}

.badge-failed {
  background: var(--accent-danger-glow);
  color: var(--status-failed);
  border: 1px solid rgba(255, 71, 87, 0.3);
}

.badge-queued {
  background: var(--accent-warning-glow);
  color: var(--status-queued);
  border: 1px solid rgba(255, 184, 0, 0.3);
}

.badge-cancelled {
  background: rgba(139, 139, 158, 0.1);
  color: var(--status-cancelled);
  border: 1px solid rgba(139, 139, 158, 0.2);
}

/* ===== Notification System ===== */
.notif-wrapper {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--accent-danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounce-in 0.3s ease;
}

@keyframes bounce-in {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-subtle);
  backdrop-filter: blur(24px);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideDown 0.25s var(--ease-out-expo);
}

.notif-dropdown.open {
  display: flex;
}

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

.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.notif-list {
  overflow-y: auto;
  max-height: 350px;
}

.notif-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-item:hover {
  background: var(--bg-glass-hover);
}

.notif-item.unread {
  background: var(--accent-primary-glow);
  border-left: 3px solid var(--accent-primary);
}

.notif-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  padding-top: 2px;
}

.notif-content {
  min-width: 0;
  flex: 1;
}

.notif-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: white;
  box-shadow: 0 2px 12px var(--accent-primary-glow);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.12));
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary:hover {
  box-shadow: 0 6px 24px var(--accent-primary-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

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

.btn-ghost:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.btn-ghost:active {
  transform: translateY(0) scale(0.98);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  line-height: 1;
}

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

/* ===== Main Content ===== */
#app-main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 100px 32px;
  text-align: center;
  animation: fadeInUp 0.5s var(--ease-out-expo);
}

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

.empty-icon {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px var(--accent-primary-glow));
  background: var(--bg-glass);
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
}

.empty-state h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 360px;
  line-height: 1.5;
}

.empty-state .btn {
  margin-top: 4px;
}

/* ===== View Controls ===== */
.view-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.view-toggle {
  display: flex;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn:hover {
  color: var(--text-secondary);
}

.view-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.view-btn svg {
  flex-shrink: 0;
}

.task-count {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ===== Kanban Board ===== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: 400px;
}

.kanban-column {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 300px;
  backdrop-filter: blur(var(--glass-blur));
  transition: border-color 0.3s;
}

.kanban-column:hover {
  border-color: var(--border-default);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.kanban-col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-col-dot.pulse {
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.kanban-col-header h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.kanban-col-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-tertiary);
  background: var(--bg-glass);
  padding: 2px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

.kanban-col-body {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Kanban Card */
.kanban-card {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
}

.kanban-card:hover {
  border-color: var(--border-default);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.kanban-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.kanban-card-agent {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-card-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-card-project {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-primary);
}

.kanban-card-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.kanban-col-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-style: italic;
  padding: 24px 20px;
  text-align: center;
  opacity: 0.7;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    var(--bg-glass) 8px,
    var(--bg-glass) 9px
  );
  border-radius: var(--radius-sm);
  margin: 4px;
}

/* Kanban running card glow */
.kanban-card.running {
  border-color: rgba(77, 166, 255, 0.2);
  animation: card-glow 2s ease-in-out infinite;
}

@keyframes card-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-info-glow); }
  50% { box-shadow: 0 0 12px 0 var(--accent-info-glow); }
}

/* ===== Task List ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Task Card */
.task-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.task-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  transition: background 0.2s;
}

.task-card.status-running::before { background: var(--status-running); }
.task-card.status-completed::before { background: var(--status-completed); }
.task-card.status-failed::before { background: var(--status-failed); }
.task-card.status-queued::before { background: var(--status-queued); }
.task-card.status-cancelled::before { background: var(--status-cancelled); }

.task-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-default);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.task-card:active {
  transform: translateX(2px);
}

.task-card.status-running {
  border-color: rgba(77, 166, 255, 0.15);
}

.task-agent {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
}

.task-info {
  min-width: 0;
}

.task-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-project {
  color: var(--accent-primary) !important;
  font-weight: 500;
}

.task-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.task-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.task-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.task-actions .btn-icon {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.task-actions .btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.task-actions .btn-icon.danger:hover {
  color: var(--accent-danger);
  background: var(--accent-danger-glow);
}

/* Running animation */
.task-card.status-running .task-agent {
  animation: pulse-agent 2s ease-in-out infinite;
}

@keyframes pulse-agent {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-info-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

/* Spinner for running tasks */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--status-running);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--shadow-glow), 0 0 0 1px var(--border-subtle);
  animation: slideUp 0.35s var(--ease-out-expo);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px 24px;
  border-top: 1px solid var(--border-subtle);
}

/* Form */
.form-grid {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

select, textarea {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s;
  resize: vertical;
}

select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

select option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

textarea {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  min-height: 100px;
}

/* Agent Grid */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.agent-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
}

.agent-option:hover {
  border-color: var(--border-default);
  background: var(--bg-glass-hover);
}

.agent-option.selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-glow);
}

.agent-option input[type="radio"] {
  display: none;
}

.agent-name {
  font-weight: 500;
  color: var(--text-primary);
}

/* Template Buttons */
.template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Auto-Select Preview */
.auto-select-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent-primary-glow), var(--accent-info-glow));
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: var(--radius-sm);
  min-height: 42px;
  transition: all 0.3s ease;
}

.auto-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.auto-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.auto-selected-agent {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.auto-confidence {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-primary);
  padding: 2px 8px;
  background: var(--bg-glass);
  border-radius: 12px;
  white-space: nowrap;
}

.auto-scores {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* Auto Badge in task list */
.badge-auto {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border: 1px solid rgba(108, 92, 231, 0.25);
  font-size: 0.6rem;
  padding: 2px 6px;
  margin-left: 6px;
  text-transform: none;
}

/* ===== Detail Panel ===== */
.detail-panel {
  position: fixed;
  right: -600px;
  top: 0;
  bottom: 0;
  width: 600px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-default);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.4s var(--ease-out-expo);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.3);
}

.detail-panel.open {
  right: 0;
}

.detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.detail-title-row h3 {
  font-size: 1rem;
  font-weight: 700;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-meta-item {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.detail-meta-item strong {
  color: var(--text-primary);
}

.detail-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.detail-output {
  background: var(--output-bg);
  border-radius: var(--radius-sm);
  margin: 0;
}

.detail-output pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--output-text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Follow-up Bar */
.detail-followup {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.followup-bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.followup-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: border-color 0.2s;
}

.followup-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.followup-input::placeholder {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.detail-followup .btn-primary {
  height: 44px;
  width: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.followup-hint {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 6px;
  padding-left: 2px;
}

/* ===== Responsive — Tablet (768px–1024px) ===== */
@media (max-width: 1024px) {
  /* Header: wrap left/right, shrink padding */
  #app-header {
    padding: 12px 20px;
    gap: 10px;
  }

  .header-left {
    gap: 10px;
    flex-wrap: wrap;
  }

  .header-right {
    gap: 16px;
  }

  .stats-bar {
    gap: 12px;
  }

  .stat-label {
    display: none;
  }

  /* Badges hidden on tablet to save space */
  .badge-version {
    display: none;
  }

  /* Nav tabs: smaller padding */
  .nav-tab {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  /* Sections */
  #app-main,
  .app-section {
    padding: 24px 20px;
  }

  /* Kanban: 2 columns on tablet */
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .kanban-column {
    min-height: 200px;
  }

  /* Boards grid: max 2 cols */
  .boards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  /* Ticket kanban: 2 cols */
  .ticket-kanban {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Agent activity grid: 2 cols */
  .agent-activity-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  /* Org chart: tighter nodes */
  .org-node {
    min-width: 150px;
    padding: 12px 14px;
  }

  .org-node-emoji {
    font-size: 1.6rem;
  }

  /* Detail panel: slightly narrower */
  .detail-panel {
    width: 500px;
  }

  /* Modal: reduce max-width */
  .modal {
    max-width: 580px;
  }

  .modal-header {
    padding: 20px 22px 14px;
  }

  .form-grid {
    padding: 20px 22px;
    gap: 16px;
  }

  .modal-footer {
    padding: 16px 22px 20px;
  }

  /* Workflow optimizer textarea */
  .optimizer-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .optimizer-input-row .btn {
    align-self: flex-end;
  }
}

/* ===== Responsive — Mobile (<=768px) ===== */
@media (max-width: 768px) {
  /* ---- Header ---- */
  #app-header {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
    align-items: stretch;
  }

  .header-left {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
  }

  /* Hide badges on mobile */
  .header-left .badge {
    display: none;
  }

  .logo h1 {
    font-size: 1.1rem;
  }

  /* Nav tabs: full width, scrollable horizontally */
  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    flex-shrink: 0;
  }

  .nav-tab {
    padding: 8px 14px;
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
  }

  .stats-bar {
    flex: 1;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
  }

  .stat {
    padding: 4px 8px;
    gap: 4px;
  }

  .stat-label {
    display: none;
  }

  .stat-value {
    font-size: 0.8rem;
  }

  /* New Task button: compact on mobile */
  #btn-new-task span {
    display: inline;
  }

  /* ---- Main content ---- */
  #app-main,
  .app-section {
    padding: 16px 12px;
  }

  /* ---- Section headers ---- */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-header h2 {
    font-size: 1.1rem;
  }

  /* ---- Empty states ---- */
  .empty-state {
    padding: 60px 20px;
    gap: 16px;
  }

  .empty-icon {
    width: 72px;
    height: 72px;
    font-size: 3rem;
  }

  .empty-state h2 {
    font-size: 1.2rem;
  }

  /* ---- View controls ---- */
  .view-controls {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  /* ---- Task cards (list view) ---- */
  .task-card {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .task-meta {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .task-actions {
    opacity: 1;
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .task-info h3 {
    white-space: normal;
    font-size: 0.85rem;
  }

  .task-info p {
    white-space: normal;
  }

  /* ---- Kanban boards ---- */
  .kanban-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kanban-column {
    min-height: 120px;
  }

  .kanban-col-body {
    max-height: 300px;
    overflow-y: auto;
  }

  /* ---- Modals ---- */
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-header {
    padding: 16px 18px 12px;
  }

  .modal-header h2 {
    font-size: 1.05rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 16px 18px;
    gap: 14px;
  }

  .modal-footer {
    padding: 14px 18px 18px;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }

  /* Agent grid: 2 columns */
  .agent-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .agent-option {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  /* Template buttons: scroll */
  .template-btns {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .template-btns .btn {
    flex-shrink: 0;
  }

  /* ---- Detail panel ---- */
  .detail-panel {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }

  .detail-panel.open {
    right: 0;
  }

  .detail-header {
    padding: 16px;
  }

  .detail-title-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .detail-title-row h3 {
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
  }

  .detail-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .detail-output {
    padding: 12px 16px;
  }

  .detail-output pre {
    font-size: 0.72rem;
  }

  .detail-followup {
    padding: 10px 12px;
  }

  .followup-bar {
    gap: 6px;
  }

  /* ---- Projects section ---- */
  .boards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .board-card {
    padding: 16px;
  }

  .board-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .board-detail-info {
    padding: 16px;
  }

  .board-detail-title {
    font-size: 1.1rem;
  }

  .board-step {
    padding: 12px 14px;
    gap: 10px;
  }

  .step-number {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .step-title {
    font-size: 0.85rem;
  }

  .step-status {
    align-items: center;
  }

  /* ---- Team section ---- */
  .team-stats {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Org chart: stack vertically */
  .org-chart {
    margin-bottom: 24px;
  }

  .org-level {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .org-node {
    min-width: 0;
    width: 100%;
    max-width: 280px;
    padding: 14px 16px;
  }

  .org-node-emoji {
    font-size: 1.5rem;
    margin-bottom: 4px;
  }

  .org-node-name {
    font-size: 0.8rem;
  }

  .org-node-role {
    font-size: 0.65rem;
  }

  .org-connector::after {
    height: 16px;
  }

  /* Workflow optimizer */
  .workflow-optimizer {
    padding: 16px;
    margin-bottom: 20px;
  }

  .optimizer-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .optimizer-input-row .btn {
    align-self: stretch;
    justify-content: center;
  }

  .opt-pipeline {
    flex-direction: column;
    align-items: stretch;
  }

  .opt-arrow {
    transform: rotate(90deg);
    align-self: center;
  }

  .opt-step {
    width: 100%;
    justify-content: center;
  }

  /* Agent activity */
  .agent-activity-grid {
    grid-template-columns: 1fr;
  }

  /* ---- Support section ---- */
  .support-stats {
    flex-direction: column;
    gap: 8px;
  }

  .ticket-kanban {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Ticket detail */
  .tkt-header {
    padding: 14px 16px;
  }

  .tkt-subject {
    font-size: 1rem;
  }

  .tkt-meta {
    gap: 10px;
    font-size: 0.75rem;
  }

  .tkt-body {
    padding: 14px 16px;
    font-size: 0.8rem;
  }

  .tkt-section {
    padding: 14px 16px;
  }

  .tkt-section h4 {
    font-size: 0.85rem;
  }

  .tkt-draft-editor {
    min-height: 150px;
    font-size: 0.8rem;
  }

  .tkt-actions {
    flex-direction: column;
  }

  .tkt-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .tkt-assign {
    flex-direction: column;
    align-items: stretch;
  }

  .tkt-assign select {
    max-width: 100%;
  }

  /* Notification dropdown */
  .notif-dropdown {
    width: calc(100vw - 32px);
    right: -60px;
    max-height: 360px;
  }

  /* History panel */
  .history-item-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .history-time {
    margin-left: 0;
    width: 100%;
  }

  /* Attachments */
  .tkt-attach-item {
    width: 80px;
    height: 80px;
  }

  .tkt-attach-remove {
    opacity: 1;
  }
}

/* ===== Responsive — Small mobile (<=480px) ===== */
@media (max-width: 480px) {
  #app-header {
    padding: 10px 12px;
  }

  .logo-icon-wrapper {
    display: none;
  }

  .logo h1 {
    font-size: 1rem;
  }

  /* Nav tabs: icon only */
  .nav-tab {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  /* Stats: minimal */
  .stat {
    padding: 3px 6px;
  }

  .stat-dot {
    width: 6px;
    height: 6px;
  }

  .stat-value {
    font-size: 0.75rem;
  }

  /* Agent grid: single column */
  .agent-grid {
    grid-template-columns: 1fr;
  }

  /* Board steps preview */
  .board-steps-preview {
    max-height: 150px;
  }

  /* Detail panel output */
  .detail-output pre {
    font-size: 0.68rem;
    line-height: 1.5;
  }

  /* Buttons */
  .btn-lg {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .btn {
    font-size: 0.8rem;
  }

  /* Ticket cards */
  .ticket-card {
    padding: 10px;
  }

  .ticket-card-subject {
    font-size: 0.75rem;
  }

  /* Org node */
  .org-node {
    max-width: 100%;
    padding: 12px;
  }
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  backdrop-filter: blur(var(--glass-blur));
}

.nav-tab {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  position: relative;
}

.nav-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-glass-hover);
}

.nav-tab.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 12px var(--accent-primary-glow);
}

.nav-tab:active {
  transform: scale(0.96);
}

/* ===== Projects Section ===== */
.app-section {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

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

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== Boards Grid ===== */
.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Board Card */
.board-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.board-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-primary-glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.board-card:hover::before {
  opacity: 1;
}

.board-card:hover {
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.board-card:active {
  transform: translateY(-1px);
}

.board-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.board-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.board-card-status {
  flex-shrink: 0;
}

.board-card-repo {
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 500;
  margin-bottom: 12px;
}

.board-card-steps {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s var(--ease-out-expo);
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-fill.failed {
  background: linear-gradient(90deg, var(--accent-danger), var(--accent-warning));
}

.board-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.board-card-progress {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.board-card-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

/* Board running glow */
.board-card.status-running {
  border-color: rgba(77, 166, 255, 0.2);
}

.board-card.status-running .progress-fill {
  animation: progress-glow 2s ease-in-out infinite;
}

@keyframes progress-glow {
  0%, 100% { box-shadow: 0 0 4px var(--accent-info-glow); }
  50% { box-shadow: 0 0 12px var(--accent-info-glow); }
}

/* ===== Board Detail ===== */
.board-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.board-detail-info {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.board-detail-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.board-detail-repo {
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-weight: 500;
  margin-bottom: 16px;
}

.board-detail-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.board-detail-progress .progress-bar {
  flex: 1;
  height: 8px;
  margin-bottom: 0;
}

.board-detail-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

/* Steps Timeline */
.board-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.board-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  cursor: pointer;
}

.board-step:hover {
  background: var(--bg-card-hover);
}

.board-step.step-running {
  border-color: var(--status-running);
  background: var(--accent-info-glow);
}

.board-step.step-completed {
  border-left: 3px solid var(--status-completed);
}

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

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-glass);
  color: var(--text-tertiary);
  border: 2px solid var(--border-subtle);
}

.step-running .step-number {
  background: var(--accent-info-glow);
  color: var(--status-running);
  border-color: var(--status-running);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.step-completed .step-number {
  background: var(--accent-success-glow);
  color: var(--status-completed);
  border-color: var(--status-completed);
}

.step-failed .step-number {
  background: var(--accent-danger-glow);
  color: var(--status-failed);
  border-color: var(--status-failed);
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.step-agent {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.step-status {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* Board Steps Preview in Modal */
.board-steps-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  max-height: 200px;
  overflow-y: auto;
}

.preview-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  background: var(--bg-card);
  border-radius: 4px;
}

.preview-step-num {
  font-weight: 700;
  color: var(--accent-primary);
  min-width: 20px;
}

.preview-step-agent {
  color: var(--text-tertiary);
  font-size: 0.7rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* ===== Team Section ===== */
.team-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.team-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.team-stat strong {
  color: var(--text-primary);
}

/* Org Chart */
.org-chart {
  margin-bottom: 32px;
}

.org-level {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.org-connector {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.org-connector::after {
  content: '';
  width: 2px;
  height: 24px;
  background: var(--border-subtle);
}

/* Agent Node */
.org-node {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  min-width: 180px;
  text-align: center;
  transition: all 0.3s var(--ease-out-expo);
  position: relative;
  cursor: default;
}

.org-node:hover {
  border-color: var(--border-default);
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.org-node.is-working {
  border-color: var(--status-running);
  box-shadow: 0 0 12px var(--accent-info-glow);
}

.org-node.is-working::before {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--status-running);
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.org-lead {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-card), var(--accent-primary-glow));
}

.org-node-emoji {
  font-size: 2rem;
  margin-bottom: 6px;
}

.org-node-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.org-node-role {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.org-node-task {
  font-size: 0.65rem;
  color: var(--status-running);
  font-weight: 500;
  padding: 4px 8px;
  background: var(--accent-info-glow);
  border-radius: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.org-node-idle {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.org-node-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

.org-node-stats span {
  font-variant-numeric: tabular-nums;
}

/* Workflow Optimizer */
.workflow-optimizer {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
}

.workflow-optimizer h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.optimizer-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.optimizer-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.optimizer-input-row textarea {
  flex: 1;
  min-height: 44px;
  font-family: var(--font-body);
}

.optimizer-result {
  margin-top: 16px;
}

.opt-pipeline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.opt-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.opt-step-num {
  font-weight: 700;
  color: var(--accent-primary);
}

.opt-arrow {
  color: var(--text-tertiary);
  font-size: 1.2rem;
}

.opt-summary {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
}

.opt-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

/* Agent Activity */
.agent-activity {
  margin-top: 8px;
}

.agent-activity h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.agent-activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.activity-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-out-expo);
}

.activity-card:hover {
  border-color: var(--border-default);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.activity-card.active {
  border-color: var(--status-running);
  background: var(--accent-info-glow);
}

.activity-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.activity-info {
  flex: 1;
  min-width: 0;
}

.activity-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-task {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-badge {
  flex-shrink: 0;
}

.badge-idle {
  background: var(--bg-glass);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
}

.badge-working {
  background: var(--accent-info-glow);
  color: var(--status-running);
  border: 1px solid rgba(77, 166, 255, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ===== Support Desk ===== */
.support-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.support-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.support-stat strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.ticket-kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.ticket-col {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ticket-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ticket-col-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-glass);
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: auto;
}

.ticket-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}

.ticket-card {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  border-left: 3px solid transparent;
}

.ticket-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card-hover);
}

.ticket-card:active {
  transform: translateY(0);
}

.ticket-card.priority-urgent { border-left-color: #ef4444; }
.ticket-card.priority-high { border-left-color: #f97316; }
.ticket-card.priority-medium { border-left-color: #eab308; }
.ticket-card.priority-low { border-left-color: #22c55e; }

.ticket-card-subject {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ticket-card-from {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.ticket-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

.ticket-detail { margin-top: 16px; }
.tkt-back { margin-bottom: 16px; }

.tkt-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.tkt-subject {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tkt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.tkt-body {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.tkt-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.tkt-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.tkt-diagnosis {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--output-bg);
  padding: 14px;
  border-radius: var(--radius-sm);
}

.tkt-draft-editor {
  width: 100%;
  min-height: 200px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  line-height: 1.6;
}

.tkt-draft-editor:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.tkt-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tkt-assign {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.tkt-assign select {
  flex: 1;
  max-width: 300px;
}

/* ===== Global Polish ===== */

/* Text selection */
::selection {
  background: var(--accent-primary);
  color: white;
}

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

/* Smooth section transitions */
.app-section {
  animation: fadeInUp 0.4s var(--ease-out-expo);
}

/* Subtle stagger for lists */
.task-list .task-card,
.boards-grid .board-card,
.agent-activity-grid .activity-card {
  animation: fadeInUp 0.4s var(--ease-out-expo) both;
}

.task-list .task-card:nth-child(1),
.boards-grid .board-card:nth-child(1) { animation-delay: 0s; }
.task-list .task-card:nth-child(2),
.boards-grid .board-card:nth-child(2) { animation-delay: 0.04s; }
.task-list .task-card:nth-child(3),
.boards-grid .board-card:nth-child(3) { animation-delay: 0.08s; }
.task-list .task-card:nth-child(4),
.boards-grid .board-card:nth-child(4) { animation-delay: 0.12s; }
.task-list .task-card:nth-child(5),
.boards-grid .board-card:nth-child(5) { animation-delay: 0.16s; }

/* Notif item hover refinement */
.notif-item {
  transition: all 0.2s var(--ease-out-expo);
}

.notif-item:hover {
  padding-left: 18px;
}

/* Form input transitions */
select, textarea, .followup-input, .tkt-draft-editor {
  transition: all 0.25s var(--ease-out-expo);
}

/* View toggle improvement */
.view-toggle {
  backdrop-filter: blur(var(--glass-blur));
}

.view-btn {
  transition: all 0.25s var(--ease-out-expo);
}

.view-btn:active {
  transform: scale(0.96);
}

/* Opt step hover */
.opt-step {
  transition: all 0.2s var(--ease-out-expo);
}

.opt-step:hover {
  transform: translateY(-1px);
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

/* Board step hover */
.board-step {
  transition: all 0.25s var(--ease-out-expo);
}

.board-step:hover {
  transform: translateX(4px);
}

/* Support stat hover */
.support-stat {
  transition: all 0.2s var(--ease-out-expo);
}

.support-stat:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* Ticket column glass */
.ticket-col {
  backdrop-filter: blur(var(--glass-blur));
  transition: border-color 0.3s;
}

.ticket-col:hover {
  border-color: var(--border-default);
}

/* Smooth backdrop overlay */
.modal-overlay {
  transition: backdrop-filter 0.3s;
}

/* Agent option micro-interaction */
.agent-option {
  transition: all 0.2s var(--ease-spring);
}

.agent-option:hover {
  transform: translateY(-1px);
}

.agent-option.selected {
  transform: scale(1.02);
  box-shadow: 0 2px 12px var(--accent-primary-glow);
}

/* Workflow optimizer card */
.workflow-optimizer {
  transition: border-color 0.3s;
}

.workflow-optimizer:hover {
  border-color: var(--border-default);
}

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

/* Ticket Attachments */
.tkt-attachments {
  margin-top: 12px;
}

.tkt-attach-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tkt-attach-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tkt-attach-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.tkt-attach-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.tkt-attach-item img:hover {
  transform: scale(1.05);
}

.tkt-attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.tkt-attach-item:hover .tkt-attach-remove {
  opacity: 1;
}

/* Version History */
.detail-history {
  border-top: 1px solid var(--border-subtle);
  max-height: 40px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.detail-history.expanded {
  max-height: 600px;
  overflow-y: auto;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.history-header:hover {
  color: var(--text-primary);
}

.history-toggle {
  transition: transform 0.3s;
  font-size: 0.7rem;
}

.detail-history.expanded .history-toggle {
  transform: rotate(180deg);
}

.history-items {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.history-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
}

.history-version {
  font-weight: 700;
  color: var(--accent-primary);
}

.history-status {
  font-size: 0.7rem;
}

.history-time {
  margin-left: auto;
  color: var(--text-tertiary);
}

.history-output {
  padding: 8px 12px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 0;
}

/* Drag & Drop */
.ticket-card[draggable="true"] {
  cursor: grab;
}

.ticket-card[draggable="true"]:active {
  cursor: grabbing;
}

.ticket-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.ticket-col.drag-over {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  box-shadow: inset 0 0 12px var(--accent-primary-glow);
}

.ticket-col.drag-over .ticket-col-body {
  min-height: 80px;
}

.ticket-col-empty {
  color: var(--text-tertiary);
  font-size: 0.7rem;
  padding: 16px 8px;
  text-align: center;
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  margin: 4px;
}

.ticket-col.drag-over .ticket-col-empty {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Task Kanban Drag */
.kanban-card[draggable="true"] {
  cursor: grab;
}

.kanban-card[draggable="true"]:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.kanban-column.drag-over {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  box-shadow: inset 0 0 12px var(--accent-primary-glow);
}

/* Logo Image */
.logo-img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

/* Detail Panel Overlay */
.detail-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.detail-overlay.open {
  display: block;
  opacity: 1;
}

/* ===== Search Bar ===== */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  gap: 6px;
}

.search-bar .search-icon {
  font-size: 0.8rem;
}

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.8rem;
  width: 200px;
  font-family: var(--font-main);
}

.search-bar input::placeholder {
  color: var(--text-tertiary);
}

.search-kbd {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 350px;
  overflow-y: auto;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-item:hover {
  background: var(--bg-glass);
}

.search-item-type {
  font-size: 1.1rem;
}

.search-item-content {
  flex: 1;
  min-width: 0;
}

.search-item-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.search-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

/* ===== Home Dashboard ===== */
.home-grid {
  padding: 20px clamp(12px, 2vw, 24px);
  max-width: 1400px;
  margin: 0 auto;
}

.home-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.metric-icon {
  font-size: 1.8rem;
}

.metric-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.metric-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.metric-running { border-left: 3px solid var(--status-running); }
.metric-completed { border-left: 3px solid var(--status-completed); }
.metric-tickets { border-left: 3px solid var(--accent-warning); }
.metric-agents { border-left: 3px solid var(--accent-primary); }
.metric-projects { border-left: 3px solid var(--accent-info); }
.metric-success { border-left: 3px solid var(--accent-success); }

.home-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.home-col h3 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.home-activity {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-glass); }

.activity-icon { font-size: 1rem; }
.activity-text {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-btn {
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: var(--font-main);
}

.quick-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.home-templates {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-card {
  padding: 10px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.template-card:hover {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
}

@media (max-width: 768px) {
  .home-columns { grid-template-columns: 1fr; }
  .home-metrics { grid-template-columns: repeat(2, 1fr); }
  .search-bar input { width: 120px; }
}
