/* =========================================================
   Mission Control — Modern Dark Theme
   ========================================================= */

/* --- Variabler --- */
:root {
  --bg: #0a0c10;
  --bg-grid: #111318;
  --surface: #12141b;
  --surface-2: #181b24;
  --surface-3: #1f2330;
  --border: #232735;
  --border-light: #2c3040;
  --text: #e8eaf0;
  --text-dim: #888d9b;
  --text-faint: #5c6270;
  --accent: #6c8aff;
  --accent-2: #5a6fd6;
  --accent-glow: rgba(108, 138, 255, 0.18);
  --success: #3dd686;
  --warning: #f5b85a;
  --danger: #ef5a5a;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Subtle grid background --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, var(--bg-grid) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* =========================================================
   Login-side
   Styling for login-siden ligger i /css/login.css (egen fil,
   indlæses kun af views/login.html). OAuth-knapperne er fjernet.
   ========================================================= */

/* =========================================================
   App shell
   ========================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* =========================================================
   Sidebar
   ========================================================= */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(4px);
}

.brand {
  padding: 0 18px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon { color: var(--accent); flex-shrink: 0; }
.brand-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: all 0.15s ease;
  font-family: var(--font);
  position: relative;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-item.active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: inset 0 1px 0 var(--border-light);
}

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

.nav-icon { flex-shrink: 0; opacity: 0.6; }
.nav-item.active .nav-icon { opacity: 1; color: var(--accent); }
.nav-item:hover .nav-icon { opacity: 0.85; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* =========================================================
   Main area
   ========================================================= */
.main {
  flex: 1;
  padding: 32px 40px 40px;
  overflow-y: auto;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 4px 0 0;
}

/* =========================================================
   Tab-indhold
   ========================================================= */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeSlide 0.25s ease; }

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

/* =========================================================
   Stat-kort
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px 18px 18px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover::after { opacity: 1; }

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.stat-icon[data-color="accent"]   { background: rgba(108,138,255,0.15); color: var(--accent); }
.stat-icon[data-color="success"]  { background: rgba(61,214,134,0.15);  color: var(--success); }
.stat-icon[data-color="warning"]  { background: rgba(245,184,90,0.15);  color: var(--warning); }
.stat-icon[data-color="danger"]   { background: rgba(239,90,90,0.15);   color: var(--danger); }

.stat-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.stat-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
}

.stat-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* =========================================================
   Kanban
   ========================================================= */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}

.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  transition: border-color 0.2s;
}

.kanban-col.drag-over {
  border-color: var(--accent);
  background: rgba(108, 138, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.kanban-col-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kanban-col-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 1px 8px;
  border-radius: 10px;
}

.task-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.task-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  font-weight: 500;
  cursor: grab;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.task-card:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.task-card:active { cursor: grabbing; }

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

.task-card .task-title { margin: 0; line-height: 1.4; }
.task-card .task-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
}

.task-card .task-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  font-size: 14px;
}

.task-card:hover .task-del { opacity: 1; }
.task-card .task-del:hover {
  background: rgba(239, 90, 90, 0.15);
  color: var(--danger);
}

.add-task-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 6px;
  font-family: var(--font);
  transition: all 0.15s;
}

.add-task-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(108, 138, 255, 0.05);
}

/* =========================================================
   Button-varianter
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-2);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}

/* =========================================================
   Projekter
   ========================================================= */
.projects-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-height: 38px;
}

.project-tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-tab-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.project-tab-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(108, 138, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}

.project-tab-btn .close-proj {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  font-size: 14px;
  margin-left: 2px;
}

.project-tab-btn:hover .close-proj { opacity: 0.7; }
.project-tab-btn .close-proj:hover { color: var(--danger); opacity: 1; }

.project-frame-wrap {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-frame {
  width: 100%;
  height: 70vh;
  border: none;
}

/* =========================================================
   Hermes + Agent-log
   ========================================================= */
.hermes-wrap {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hermes-frame {
  width: 100%;
  height: 70vh;
  border: none;
}

.agent-log-wrap {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.agent-log-list {
  padding: 0;
  max-height: 70vh;
  overflow-y: auto;
}

.agent-log-entry {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.agent-log-entry:last-child { border-bottom: none; }

.agent-log-time {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
  margin-top: 1px;
  min-width: 80px;
}

.agent-log-body { flex: 1; min-width: 0; }
.agent-log-msg {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
}

.agent-log-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
}

.agent-log-tag.memory { background: rgba(108,138,255,0.15); color: var(--accent); }
.agent-log-tag.action { background: rgba(61,214,134,0.15);  color: var(--success); }
.agent-log-tag.system { background: rgba(245,184,90,0.15);  color: var(--warning); }

/* =========================================================
   Empty state
   ========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 30px;
  text-align: center;
  color: var(--text-dim);
  gap: 10px;
}

.empty-state svg { color: var(--text-faint); margin-bottom: 4px; }
.empty-state p {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  margin: 0;
}
.empty-state span {
  font-size: 13px;
  color: var(--text-faint);
}

.empty-state code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* =========================================================
   Modal
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay:not([hidden]) {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s ease;
  overflow: hidden;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 16px;
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-body {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-dim);
}

.modal-body input, .modal-body textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 12px;
}

.modal-body input:focus, .modal-body textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-body textarea { resize: vertical; min-height: 80px; }
.modal-body label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.modal-footer {
  padding: 0 20px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

/* =========================================================
   Toast
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 340px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

.toast .toast-icon { flex-shrink: 0; font-size: 16px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    .toast-icon { color: var(--accent); }

.toast.removing { animation: toastOut 0.25s ease forwards; }

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

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* =========================================================
   Chat
   ========================================================= */

.chat-section {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.chat-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.chat-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 2px 0 0;
}

.chat-messages {
  flex: 1;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar-thumb {
  width: 4px;
  background: var(--border);
  border-radius: 2px;
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeSlide 0.2s ease;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

.chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.chat-message.user .chat-message-avatar {
  background: rgba(108,138,255,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.chat-message.bot .chat-message-avatar {
  background: rgba(61,214,134,0.15);
  border-color: var(--success);
  color: var(--success);
}

.chat-message-bubble {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}

.chat-message.user .chat-message-bubble {
  background: rgba(108,138,255,0.12);
  border-color: var(--accent);
}

.chat-message-time {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-message.user .chat-message-time {
  text-align: right;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  flex: 1;
}

.chat-welcome-icon {
  font-size: 40px;
  opacity: 0.6;
}

.chat-welcome p {
  font-size: 14px;
  margin: 0;
  color: var(--text-dim);
  max-width: 300px;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
  line-height: 1.5;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
  max-height: 120px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0.5;
  pointer-events: none;
}

.chat-send-btn.active {
  opacity: 1;
  pointer-events: auto;
}

.chat-send-btn.active:hover {
  background: var(--accent-2);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-status {
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
}

.chat-status.error {
  color: var(--danger);
}

.chat-status .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* =========================================================
   Agent-picker
   ========================================================= */

.agent-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.agent-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.agent-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}

.agent-btn:hover {
  border-color: var(--text-faint);
  color: var(--text);
  background: var(--surface-2);
}

.agent-btn.active {
  color: #fff;
  border-color: var(--agent-color, var(--accent));
  background: var(--agent-color, var(--accent));
}

.agent-btn .agent-emoji {
  font-size: 16px;
}

.agent-btn .agent-name {
  font-weight: 600;
}

.agent-btn .agent-role {
  font-size: 11px;
  opacity: 0.7;
  display: none;
}

|.agent-btn.active .agent-role {
  display: inline;
}

.execplan-info {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.execplan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(90, 111, 214, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(90, 111, 214, 0.2);
}

.execplan-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

.execplan-desc a {
  color: var(--accent);
  text-decoration: none;
}

.execplan-desc a:hover {
  text-decoration: underline;
}

.execplan-info[hidden] {
  display: none;
}

/* =========================================================
   Agent status cards
   ========================================================= */

.agent-status-section {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agent-status-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-status-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.agent-status-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 2px 0 0;
}

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

.agent-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.agent-card:hover {
  border-color: var(--border-light);
}

.agent-card.active {
  border-color: var(--agent-color, var(--accent));
  box-shadow: 0 0 0 1px var(--agent-color, var(--accent));
}

.agent-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.agent-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--agent-color, var(--surface-3));
  border: 1px solid var(--agent-color, var(--border));
}

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

.agent-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.agent-card-role {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 1px;
}

.agent-card-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.agent-skill-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--agent-color, var(--text-dim));
  background: rgba(var(--agent-color-rgb, 136, 141, 155), 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(var(--agent-color-rgb, 136, 141, 155), 0.2);
}

.agent-card-status {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.agent-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.agent-status-badge.busy {
  color: var(--warning);
  border-color: var(--warning);
  background: rgba(245, 184, 90, 0.1);
}

.agent-status-badge.idle {
  color: var(--text-faint);
  border-color: var(--border);
}

.agent-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  transition: background 0.3s;
}

.agent-status-badge.busy .agent-status-dot {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.agent-status-badge.idle .agent-status-dot {
  background: var(--text-faint);
}

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

.agent-card-tasks {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
  line-height: 1.4;
}

/* =========================================================
   Scrollbar
   ========================================================= */
.main::-webkit-scrollbar,
.agent-log-list::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track,
.agent-log-list::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb,
.agent-log-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.main::-webkit-scrollbar-thumb:hover,
.agent-log-list::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 24px 20px 32px; }
  .chat-messages { min-height: 220px; max-height: 320px; }
}

@media (max-width: 640px) {
  .sidebar { width: 64px; }
  .brand-text, .nav-item span:not(.nav-badge):not(.close-proj),
  .sidebar-footer span, .nav-badge, .nav-item::before { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-icon { opacity: 1; }
  .nav-item.active .nav-icon { color: var(--accent); }
  .main { padding: 16px; }
  .page-header { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .chat-section { padding: 14px; }
  .chat-messages { min-height: 200px; max-height: 280px; }
}
