/* AIMY Dashboard — Dark Theme */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252838;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --border: #2e3144;
  --sidebar-width: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1040 100%);
}

.login-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  text-align: center;
}

.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-container h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 24px; }

.login-container input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
}
.login-container input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-container button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-container button:hover { background: var(--accent-hover); }

.error { color: var(--error); margin-top: 12px; font-size: 13px; }

/* App Layout */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 24px; }
.logo-text { font-size: 20px; font-weight: 700; }

.nav-links { list-style: none; padding: 12px 8px; flex: 1; }

.nav-link {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: var(--accent); color: white; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.logout-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.logout-btn:hover { border-color: var(--error); color: var(--error); }

/* Content */
.content { margin-left: var(--sidebar-width); flex: 1; padding: 24px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.page h1 { font-size: 24px; font-weight: 700; margin-bottom: 20px; }

/* Section Titles */
.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 20px 0 10px;
}
.section-title:first-of-type { margin-top: 0; }

/* Status Banner */
.status-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.stale { background: var(--warning); box-shadow: 0 0 6px var(--warning); }

/* Grid Layouts */
.grid { display: grid; gap: 12px; margin-bottom: 4px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-body { font-size: 13px; }
.card.full-width { grid-column: 1 / -1; }

/* Metric Cards */
.metric-card { text-align: center; padding: 20px 16px; }
.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.metric-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
}
.metric-bar {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
}
.metric-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.5s ease, background 0.3s ease;
  width: 0%;
}
.metric-fill.warn { background: var(--warning); }
.metric-fill.danger { background: var(--error); }

.muted { color: var(--text-muted); font-style: italic; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-active { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-offline { background: rgba(113,113,122,0.15); color: var(--text-muted); }
.badge-busy { background: rgba(99,102,241,0.15); color: var(--accent); }
.badge-ip { background: rgba(99,102,241,0.1); color: var(--text-muted); font-weight: 400; font-size: 10px; }
.badge-healthy { background: rgba(16,185,129,0.1); color: var(--success); font-size: 10px; }
.badge-up { background: rgba(16,185,129,0.1); color: var(--success); font-size: 10px; }

/* Container list */
.container-list { list-style: none; }
.container-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(46,49,68,0.5);
}
.container-list li:last-child { border-bottom: none; }
.container-name { color: var(--text-primary); }
.container-status { color: var(--text-muted); font-size: 11px; }

/* Activity Feed */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  min-width: 60px;
}
.activity-text { color: var(--text-secondary); }

/* Page visibility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .logo-text, .sidebar-footer { display: none; }
  .nav-link { padding: 10px; text-align: center; font-size: 18px; }
  .content { margin-left: 60px; padding: 16px; }
}

/* Org Chart */
.org-chart-wrapper { padding: 20px 0; }
.org-node:hover rect { stroke: #6366f1 !important; stroke-width: 2 !important; }

.org-edit-panel {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  width: 300px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.org-edit-panel h3 { margin-bottom: 16px; font-size: 16px; }
.org-edit-panel label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.org-edit-panel input, .org-edit-panel select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
}
.org-edit-panel input:focus, .org-edit-panel select:focus {
  outline: none;
  border-color: var(--accent);
}
.edit-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn-save {
  flex: 1;
  padding: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.btn-save:hover { background: var(--accent-hover); }
.btn-cancel {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-cancel:hover { border-color: var(--error); color: var(--error); }

/* ===== RESEARCH PAGE ===== */

/* Tabs */
.research-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}
.research-tab {
  padding: 8px 18px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.research-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.research-tab.active { background: var(--accent); color: white; }

/* Stats row */
.research-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}
.stat-pill .stat-num {
  font-weight: 700;
  color: var(--text-primary);
}

/* Toolbar */
.research-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.research-toolbar input[type="text"] {
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  width: 240px;
}
.research-toolbar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}
.research-toolbar select {
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
}
.btn-sm {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-sm:hover { background: var(--accent-hover); }
.btn-sm.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-sm.btn-ghost:hover { border-color: var(--accent); color: var(--text-primary); }

/* Report cards */
.report-list { display: flex; flex-direction: column; gap: 8px; }

.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.report-card:hover { border-color: var(--accent); }

.report-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.report-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.report-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.report-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}
.report-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.report-card-footer .topic-tag {
  padding: 2px 8px;
  background: rgba(99,102,241,0.1);
  color: var(--accent);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

/* Relevance badges */
.badge-critical { background: rgba(239,68,68,0.15); color: var(--error); }
.badge-high { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-medium { background: rgba(99,102,241,0.15); color: var(--accent); }
.badge-low { background: rgba(113,113,122,0.15); color: var(--text-muted); }

/* Status badges */
.badge-queued { background: rgba(113,113,122,0.15); color: var(--text-muted); }
.badge-researching { background: rgba(99,102,241,0.15); color: var(--accent); }
.badge-draft { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-ready { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-reviewed { background: rgba(16,185,129,0.3); color: var(--success); }
.badge-archived { background: rgba(113,113,122,0.1); color: var(--text-muted); }

/* Report detail (expanded) */
.report-detail {
  position: fixed;
  right: 0; top: 0;
  width: 600px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
.report-detail-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.report-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.report-detail-body h4 { font-size: 13px; color: var(--text-muted); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.report-detail-body p, .report-detail-body pre {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}
.report-detail-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* Video cards */
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.2s;
}
.video-card:hover { border-color: var(--accent); }
.video-icon { font-size: 28px; flex-shrink: 0; }
.video-info { flex: 1; }
.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.video-title a { color: var(--text-primary); text-decoration: none; }
.video-title a:hover { color: var(--accent); text-decoration: underline; }
.video-channel { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.video-summary { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.video-meta { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.video-actions { flex-shrink: 0; display: flex; gap: 6px; }

/* Topic list */
.topic-list { display: flex; flex-direction: column; gap: 6px; }
.topic-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.topic-item .topic-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}
.topic-item .topic-desc {
  font-size: 12px;
  color: var(--text-muted);
  flex: 2;
}
.topic-item .topic-meta {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.toggle-active {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}
.toggle-active.on { background: var(--success); }
.toggle-active.off { background: var(--text-muted); }
.toggle-active::after {
  content: '';
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  transition: left 0.2s;
}
.toggle-active.on::after { left: 18px; }
.toggle-active.off::after { left: 2px; }

/* Tab panels */
.research-panel { display: none; }
.research-panel.active { display: block; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-style: italic;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 250;
}

/* Add modal */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  width: 440px;
  z-index: 300;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal label {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.modal input, .modal select, .modal textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.modal textarea { min-height: 80px; resize: vertical; }
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

/* ===== BUDGET PAGE ===== */
.budget-panel { display: none; }
.budget-panel.active { display: block; }

.budget-bar-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.budget-bar-row:last-child { border-bottom: none; }
.budget-bar-label {
  display: flex;
  align-items: baseline;
  margin-bottom: 2px;
  font-size: 13px;
}

/* Report content styling */
.report-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.report-content h3, .report-content h4, .report-content h5 {
  font-weight: 600;
}

/* Clickable card hint */
.report-card::after {
  content: '→';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.2s;
}
.report-card {
  position: relative;
}
.report-card:hover::after {
  opacity: 1;
}

/* Approvals */
.approval-panel { display: none; }
.approval-panel.active { display: block; }

/* === PROJECTS PAGE === */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.project-card { background: var(--card-bg, #1e1e2e); border: 1px solid #333; border-radius: 10px; padding: 1.2rem; cursor: pointer; transition: all .2s; }
.project-card:hover { border-color: #6366f1; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99,102,241,.15); }
.project-card.active { border-left: 3px solid #22c55e; }
.project-card.dormant { opacity: 0.7; }
.project-card-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.project-card-header h3 { margin: 0; font-size: 1.05rem; flex: 1; }
.project-activity-dot { font-size: .8rem; }
.gh-link { text-decoration: none; font-size: 1.1rem; opacity: .6; }
.gh-link:hover { opacity: 1; }
.gh-link-large { color: #6366f1; text-decoration: none; font-size: .9rem; }
.project-desc { color: #999; font-size: .85rem; margin: .3rem 0 .7rem; line-height: 1.4; }
.project-meta { display: flex; gap: 1rem; font-size: .8rem; color: #aaa; }
.project-tech { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.tech-badge { background: #2d2d44; color: #a5b4fc; padding: 2px 8px; border-radius: 4px; font-size: .75rem; }

/* Project detail */
.project-detail-header { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.project-detail-header h2 { margin: 0; flex: 1; }
.back-btn { background: none; border: 1px solid #555; color: #ccc; padding: .4rem .8rem; border-radius: 6px; cursor: pointer; font-size: .85rem; }
.back-btn:hover { border-color: #6366f1; color: #fff; }
.project-detail-desc { color: #999; margin-bottom: 1rem; }
.project-detail-stats { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* Mini board */
.mini-board { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.mini-column { min-width: 180px; max-width: 220px; flex-shrink: 0; background: #1a1a2e; border-radius: 8px; padding: .5rem; }
.mini-col-header { display: flex; justify-content: space-between; align-items: center; padding: .4rem .5rem; font-size: .85rem; font-weight: 600; margin-bottom: .5rem; border-radius: 4px; }
.mini-col-count { background: #333; padding: 1px 7px; border-radius: 10px; font-size: .75rem; }
.mini-col-cards { display: flex; flex-direction: column; gap: .3rem; }
.mini-card { background: #252540; border-radius: 6px; padding: .5rem .6rem; font-size: .8rem; }
.mini-card:hover { background: #2d2d50; }
.mini-card-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card-age { font-size: .7rem; color: #777; }

/* === SPRINTS & MILESTONES === */
.milestone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.milestone-card { background: var(--card-bg, #1e1e2e); border: 1px solid #333; border-radius: 10px; padding: 1.2rem; cursor: pointer; transition: all .2s; }
.milestone-card:hover { border-color: #6366f1; transform: translateY(-2px); }
.milestone-card.completed { opacity: .7; border-left: 3px solid #22c55e; }
.milestone-card.cancelled { opacity: .5; border-left: 3px solid #ef4444; }
.milestone-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.milestone-header h4 { margin: 0; font-size: 1.05rem; }
.milestone-status { font-size: .75rem; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.status-active { background: #1e3a5f; color: #60a5fa; }
.status-completed { background: #14532d; color: #4ade80; }
.status-cancelled { background: #451a1a; color: #f87171; }
.milestone-desc { color: #999; font-size: .85rem; margin: .3rem 0 .7rem; }
.milestone-progress { margin: .5rem 0; }
.progress-bar { background: #2a2a3e; border-radius: 6px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 6px; transition: width .3s; }
.progress-text { font-size: .8rem; color: #aaa; margin-top: .3rem; display: inline-block; }
.milestone-meta { display: flex; justify-content: space-between; align-items: center; margin-top: .7rem; font-size: .8rem; color: #aaa; }
.milestone-actions { display: flex; gap: .3rem; }
.overdue { color: #f87171; font-weight: 600; }
.btn-small { background: #2d2d44; border: 1px solid #444; color: #ccc; padding: .3rem .5rem; border-radius: 5px; cursor: pointer; font-size: .8rem; }
.btn-small:hover { border-color: #6366f1; color: #fff; }
.btn-danger { border-color: #7f1d1d; }
.btn-danger:hover { border-color: #ef4444; color: #f87171; }
.btn-primary { background: #6366f1; border: none; color: #fff; padding: .5rem 1rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.btn-primary:hover { background: #818cf8; }
.btn-tiny { background: none; border: none; color: #777; cursor: pointer; font-size: .9rem; padding: 0 .3rem; }
.btn-tiny:hover { color: #f87171; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: #1e1e2e; border: 1px solid #333; border-radius: 12px; width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; }
.modal-large { max-width: 700px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid #333; }
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-close { background: none; border: none; color: #999; font-size: 1.3rem; cursor: pointer; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 1.2rem; }
.modal-body label { display: block; font-size: .85rem; color: #aaa; margin: .8rem 0 .3rem; }
.modal-body input, .modal-body textarea, .modal-body select { width: 100%; background: #252540; border: 1px solid #444; color: #eee; padding: .5rem; border-radius: 6px; font-size: .9rem; box-sizing: border-box; }
.modal-body input:focus, .modal-body textarea:focus { border-color: #6366f1; outline: none; }

/* Detail cards */
.detail-col-group { margin-bottom: 1rem; }
.detail-col-group h4 { margin: 0 0 .4rem; font-size: .9rem; color: #aaa; }
.detail-card { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; background: #252540; border-radius: 6px; margin-bottom: .3rem; font-size: .85rem; }
.detail-card.done { opacity: .6; text-decoration: line-through; }
.detail-card-project { font-size: .75rem; color: #777; margin-left: auto; }
.add-card-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.add-card-form input { background: #252540; border: 1px solid #444; color: #eee; padding: .4rem; border-radius: 5px; font-size: .85rem; }

/* === ALERTS === */
.alert-ok { background: #14532d; color: #4ade80; padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-crit { background: #451a1a; color: #f87171; padding: .6rem 1rem; border-radius: 8px; margin-bottom: .4rem; font-size: .9rem; border-left: 3px solid #ef4444; }
.alert-warn { background: #422006; color: #fbbf24; padding: .6rem 1rem; border-radius: 8px; margin-bottom: .4rem; font-size: .9rem; border-left: 3px solid #f59e0b; }
.badge-warn { background: #422006; color: #fbbf24; }
.badge-crit { background: #451a1a; color: #f87171; }
.data-table.compact td { padding: .2rem .5rem; font-size: .85rem; }

/* === WORKFLOW BUILDER === */
.wf-palette-btn { background: #1e1e2e; border: 2px solid #444; color: #eee; padding: .4rem .7rem; border-radius: 6px; cursor: pointer; font-size: .8rem; }
.wf-palette-btn:hover { background: #2d2d50; }
.wf-node { position: absolute; width: 150px; background: #1e1e2e; border: 2px solid #444; border-radius: 8px; cursor: grab; user-select: none; z-index: 10; }
.wf-node:hover { box-shadow: 0 0 12px rgba(99,102,241,.3); }
.wf-node-header { padding: .3rem .5rem; font-size: .75rem; font-weight: 600; border-radius: 6px 6px 0 0; }
.wf-node-body { padding: .4rem .5rem; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-node-actions { display: flex; justify-content: flex-end; gap: .2rem; padding: .2rem .4rem; }

/* === TASK OPERATIONS === */
.task-card {
  background: #1e1e2e;
  border: 1px solid #2d2d3d;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: .75rem;
  cursor: pointer;
  transition: border-color .2s;
}
.task-card:hover { border-color: #6366f1; }
.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .5rem;
  gap: .5rem;
}
.task-card-title { font-weight: 600; font-size: .95rem; flex: 1; }
.task-card-badges { display: flex; gap: .25rem; flex-shrink: 0; }
.task-card-meta {
  display: flex;
  gap: 1rem;
  font-size: .75rem;
  color: #9ca3af;
  flex-wrap: wrap;
}
.task-error {
  margin-top: .5rem;
  padding: .25rem .5rem;
  background: rgba(239,68,68,.1);
  border-radius: 4px;
  font-size: .75rem;
  color: #ef4444;
}
.task-tab {
  background: #2d2d3d;
  border: 1px solid #3d3d4d;
  color: #ccc;
  padding: .4rem .8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  margin-right: .25rem;
  margin-bottom: .5rem;
}
.task-tab.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.task-tab:hover:not(.active) { background: #3d3d4d; }

/* Task Detail */
.task-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.task-detail-header h2 { flex: 1; margin: 0; font-size: 1.2rem; }

/* Timeline */
.task-timeline { position: relative; padding-left: 2rem; }
.timeline-step {
  position: relative;
  padding: .75rem 0 .75rem 1rem;
  border-left: 2px solid #3d3d4d;
}
.timeline-step:last-child { border-left-color: transparent; }
.timeline-step.completed { border-left-color: #22c55e; }
.timeline-step.running { border-left-color: #f59e0b; }
.timeline-step.failed { border-left-color: #ef4444; }
.timeline-marker {
  position: absolute;
  left: -1.5rem;
  top: .75rem;
  width: 1.5rem;
  text-align: center;
  font-size: .9rem;
}
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .25rem;
}
.timeline-header strong { font-size: .85rem; }
.timeline-agent { font-size: .7rem; color: #9ca3af; }
.timeline-input, .timeline-output {
  font-size: .75rem;
  color: #a1a1aa;
  margin: .25rem 0;
  padding: .25rem .5rem;
  background: rgba(255,255,255,.03);
  border-radius: 4px;
}
.timeline-meta {
  display: flex;
  gap: .75rem;
  font-size: .7rem;
  color: #6b7280;
  margin-top: .25rem;
}
.timeline-artefacts {
  margin-top: .25rem;
  font-size: .7rem;
}
.timeline-artefacts summary { cursor: pointer; color: #6366f1; }
.timeline-artefacts pre {
  background: #0d0d1a;
  padding: .5rem;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  font-size: .7rem;
}
.stat-pill {
  display: inline-block;
  padding: 2px 8px;
  background: #2d2d3d;
  border-radius: 12px;
  font-size: .75rem;
  margin-right: .25rem;
}

/* === WORKFLOW PIPELINE === */
.wf-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: .5rem 0;
}
.wf-step {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.wf-step-icon {
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2d2d3d;
  border-radius: 50%;
  flex-shrink: 0;
}
.wf-step-info { min-width: 80px; }
.wf-step-name { font-size: .8rem; font-weight: 600; }
.wf-step-agent { font-size: .7rem; color: #9ca3af; }
.wf-step-arrow {
  font-size: 1.2rem;
  color: #4d4d5d;
  margin: 0 .25rem;
  flex-shrink: 0;
}
.wf-tab {
  background: #2d2d3d;
  border: 1px solid #3d3d4d;
  color: #ccc;
  padding: .4rem .8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  margin-right: .25rem;
}
.wf-tab.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.wf-tab:hover:not(.active) { background: #3d3d4d; }
.wf-run-steps {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
.wf-run-step {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  background: #2d2d3d;
}
.wf-run-step.completed { background: rgba(34,197,94,.15); color: #22c55e; }
.wf-run-step.current { background: rgba(99,102,241,.2); color: #6366f1; border: 1px solid #6366f1; }
.wf-run-step.pending { color: #6b7280; }
.wf-run-step-num { font-size: .7rem; }
.wf-run-step-name { font-size: .7rem; }

/* === REPORTS === */
.report-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: #1e1e2e;
  border: 1px solid #2d2d3d;
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  cursor: pointer;
  transition: border-color .2s;
}
.report-card:hover { border-color: #6366f1; }
.report-card.report-critical { border-left: 3px solid #ef4444; }
.report-type-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.report-card-body { flex: 1; min-width: 0; }
.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .25rem;
}
.report-title { font-weight: 600; font-size: .9rem; }
.report-meta { font-size: .7rem; color: #6b7280; flex-shrink: 0; }
.report-card-sub {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: .75rem;
  color: #9ca3af;
}
.report-from { font-size: .75rem; }
.report-task { font-size: .7rem; color: #6366f1; }
.report-summary {
  margin-top: .25rem;
  font-size: .8rem;
  color: #a1a1aa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-card-action {
  color: #ef4444;
  font-size: .7rem;
  flex-shrink: 0;
  margin-top: .25rem;
}
.report-tab {
  background: #2d2d3d;
  border: 1px solid #3d3d4d;
  color: #ccc;
  padding: .4rem .8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  margin-right: .25rem;
  margin-bottom: .5rem;
}
.report-tab.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.report-tab:hover:not(.active) { background: #3d3d4d; }
