:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --blue: #58a6ff;
  --purple: #a371f7;
  --accent: #58a6ff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 16px; }
.nav-links a {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
}
.nav-links a:hover { color: var(--text); text-decoration: none; background: var(--border); }
.nav-links a.active { color: var(--text); background: var(--border); }

/* Main */
.main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-size: 18px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; color: var(--text-muted); }
.card.full-width { grid-column: 1 / -1; }

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s, transform 0.2s;
  color: var(--text);
}
.project-card:hover { border-color: var(--blue); transform: translateY(-2px); text-decoration: none; }
.project-card.hot { border-color: var(--yellow); }
.project-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.project-name { font-weight: 600; font-size: 15px; }
.project-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.tag.small { font-size: 11px; padding: 1px 6px; }
.tag.active { background: var(--green); color: #000; }
.tag.hot { background: var(--yellow); color: #000; }
.tag.research { background: var(--purple); color: #fff; }
.tag.new { background: var(--blue); color: #000; }
.tag.complete { background: var(--border); color: var(--text-muted); }
.tag.paused { background: var(--border); color: var(--text-muted); }
.tag.ready { background: var(--accent); color: #000; }
.tag.enqueued { background: var(--yellow); color: #000; }
.tag.running { background: var(--green); color: #000; }
.tag.done { background: var(--green); color: #000; }
.tag.blocked { background: #6e4000; color: #ffb347; }
.tag.queued { background: var(--border); color: var(--text); }
.tag.pending { background: var(--yellow); color: #000; }
.tag.approved { background: var(--green); color: #000; }
.tag.executing { background: var(--blue); color: #000; }
.tag.completed { background: var(--green); color: #000; }
.tag.failed, .tag.rejected { background: var(--red); color: #fff; }
.tag.high { background: var(--red); color: #fff; }
.tag.medium { background: var(--yellow); color: #000; }

/* Progress Bar */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Prompt List */
.prompt-list { list-style: none; }
.prompt-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.prompt-item:hover { background: rgba(255,255,255,0.03); }
.prompt-item:last-child { border-bottom: none; }
.prompt-title { font-weight: 500; margin-bottom: 4px; }
.prompt-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-muted); align-items: center; }

/* Status Card */
.status-card {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.stat { text-align: center; flex: 1; min-width: 80px; }
.stat-val { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-approve { background: var(--green); color: #000; }
.btn-reject { background: var(--red); color: #fff; }
.btn-small {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.btn-small:hover { background: var(--border); }

/* Tabs */
.task-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.tab:hover { background: var(--border); color: var(--text); }
.tab.active { background: var(--border); color: var(--text); font-weight: 600; }

/* Todo */
.todo-list { list-style: none; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: none; }
.todo-task { flex: 1; font-weight: 500; }
.todo-meta { display: flex; gap: 8px; font-size: 12px; color: var(--text-muted); }

/* Task Detail */
.task-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 14px; margin: 12px 0; }
.task-params pre, .task-result pre { background: var(--bg); padding: 12px; border-radius: 8px; font-size: 13px; overflow-x: auto; margin-top: 8px; white-space: pre-wrap; }
.history-list { list-style: none; }
.history-list li { padding: 6px 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }

/* Project Detail */
.project-detail-header { margin-bottom: 20px; }
.project-detail-header h1 { font-size: 28px; }
.project-detail-header .desc { color: var(--text-muted); margin: 8px 0; }
.project-detail-header .repos { display: flex; gap: 6px; margin-top: 8px; }
.question-answer { font-size: 13px; color: var(--text-muted); margin-top: 4px; padding: 8px; background: var(--bg); border-radius: 6px; }

/* Back Link */
.back-link { display: inline-block; margin-bottom: 16px; font-size: 14px; color: var(--text-muted); }
.back-link:hover { color: var(--text); text-decoration: none; }

/* Utilities */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }

/* Collapsible */
.collapsible-header {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  user-select: none;
}
.collapsible-header:hover { color: var(--text); }
.chev {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 16px;
  margin-right: 4px;
}
.chev.open { transform: rotate(90deg); }
.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.collapsible-body.open { max-height: 2000px; }

/* Launch Form */
.launch-form { max-width: 700px; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.form-group input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--purple);
}
.form-group textarea {
  width: 100%;
  min-height: 300px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}
.form-group textarea:focus {
  outline: none;
  border-color: var(--purple);
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Idea Cards Grid ─────────────────────────────────────────────────────── */
.idea-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.idea-controls select, .idea-controls button { padding: 6px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; cursor: pointer; }
.idea-controls button:hover { background: var(--border); }
.idea-controls .stats { margin-left: auto; font-size: 13px; color: var(--text-muted); }

.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.idea-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; cursor: pointer; transition: border-color 0.2s, transform 0.2s;
}
.idea-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.idea-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.idea-card-header .cat-icon { font-size: 20px; flex-shrink: 0; }
.idea-card-name { font-weight: 600; font-size: 15px; }
.idea-card-oneliner { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.idea-card-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; }

.idea-score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.idea-score-badge.none { background: var(--border); color: var(--text-muted); border: 2px solid var(--border); }

/* AI evaluation badge variants */
.idea-score-badge.ai-scored {
  background: rgba(88,166,255,0.15); color: var(--blue); border: 2px solid var(--blue);
  position: relative;
}
.ai-micro {
  position: absolute; bottom: -2px; right: -4px; font-size: 8px; font-weight: 700;
  background: var(--blue); color: #000; padding: 0 3px; border-radius: 4px; line-height: 1.4;
}
.idea-score-badge.ai-processing {
  background: rgba(88,166,255,0.1); border: 2px solid var(--blue);
  animation: ai-pulse 2s ease-in-out infinite;
}
.ai-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88,166,255,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(88,166,255,0); }
}

/* AI-evaluated card distinction */
.idea-card.ai-evaluated { border-left: 3px solid var(--blue); }

/* Recommendation badge on card */
.rec-badge {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 0 6px;
  border: 1px solid; border-radius: 4px; line-height: 1.6; margin-left: 4px;
}

/* Eval progress bar */
.eval-progress-bar {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px;
}
.eval-progress-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; margin-bottom: 4px;
}

/* Rubric display */
.rubric-grid { margin: 8px 0 16px; }
.rubric-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 2px;
}
.rubric-label { width: 140px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.rubric-bar-track {
  flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.rubric-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.rubric-score { width: 24px; font-size: 13px; font-weight: 700; text-align: right; flex-shrink: 0; }
.rubric-rationale {
  font-size: 11px; color: var(--text-muted); margin: 0 0 8px 150px; line-height: 1.4;
}

/* Analysis section wrapper */
.analysis-section {
  background: rgba(88,166,255,0.04); border: 1px solid rgba(88,166,255,0.15);
  border-radius: 10px; padding: 16px; margin-bottom: 20px;
}

.coverage-bar { height: 4px; background: var(--border); border-radius: 2px; flex: 1; min-width: 60px; overflow: hidden; }
.coverage-fill { height: 100%; background: var(--green); border-radius: 2px; }

/* ── Idea Modal ──────────────────────────────────────────────────────────── */
.idea-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 16px;
}
.idea-modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  max-width: 800px; width: 100%; padding: 0; position: relative;
}
.idea-modal-header {
  display: flex; align-items: center; gap: 12px; padding: 20px 24px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.idea-modal-header h2 { flex: 1; font-size: 20px; min-width: 200px; }
.idea-modal-header .close-btn {
  background: none; border: none; color: var(--text-muted); font-size: 24px;
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.idea-modal-header .close-btn:hover { color: var(--text); }
.idea-modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }

/* ── Capability Chips ────────────────────────────────────────────────────── */
.cap-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cap-chip {
  display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px;
  cursor: pointer; transition: opacity 0.15s; position: relative;
}
.cap-chip:hover { opacity: 0.85; }
.cap-chip.have    { background: #000; color: var(--green); border: 1px solid var(--green); }
.cap-chip.partial { background: rgba(210,153,34,0.2); color: var(--yellow); border: 1px solid var(--yellow); }
.cap-chip.missing { background: transparent; color: var(--red); border: 1px solid var(--red); }

/* ── Capability Popup ────────────────────────────────────────────────────── */
.cap-popup {
  position: fixed; z-index: 300; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px; width: 340px; max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.cap-popup-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; text-transform: capitalize; }
.cap-popup-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cap-popup-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.cap-popup-quality { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.cap-popup-quality span { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--border); color: var(--text-muted); }
.cap-popup-quality span.yes { background: rgba(63,185,80,0.2); color: var(--green); }

/* ── Markdown Content ────────────────────────────────────────────────────── */
.md-content h1 { font-size: 22px; margin: 20px 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md-content h2 { font-size: 18px; margin: 18px 0 10px; }
.md-content h3 { font-size: 15px; margin: 14px 0 8px; color: var(--text-muted); }
.md-content p { margin: 8px 0; line-height: 1.6; }
.md-content ul, .md-content ol { margin: 8px 0; padding-left: 24px; }
.md-content li { margin: 4px 0; line-height: 1.5; }
.md-content code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.md-content pre { background: var(--bg); padding: 14px; border-radius: 8px; overflow-x: auto; margin: 12px 0; }
.md-content pre code { padding: 0; background: none; }
.md-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.md-content th, .md-content td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.md-content th { background: var(--bg); font-weight: 600; }
.md-content strong { color: var(--text); }
.md-content em { color: var(--text-muted); }
.md-content blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--text-muted); margin: 8px 0; }

/* ── Vote Buttons ────────────────────────────────────────────────────────── */
.vote-btn { padding: 6px 16px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font-size: 16px; cursor: pointer; transition: all 0.15s; }
.vote-btn.like:hover { background: rgba(63,185,80,0.2); border-color: var(--green); }
.vote-btn.dislike:hover { background: rgba(248,81,73,0.2); border-color: var(--red); }

/* ── Brainstorm / Comment Thread ─────────────────────────────────────────── */
.brainstorm-thread { margin-top: 16px; }
.brainstorm-msg { padding: 10px 14px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.brainstorm-msg .sender { font-weight: 600; margin-right: 8px; }
.brainstorm-msg .time { font-size: 11px; color: var(--text-muted); float: right; }
.brainstorm-input { display: flex; gap: 8px; margin-top: 8px; }
.brainstorm-input textarea { flex: 1; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; resize: vertical; min-height: 40px; font-family: inherit; }

/* ── Section label ───────────────────────────────────────────────────────── */
.section-label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 0 8px; }

/* ── Star Button ─────────────────────────────────────────────────────── */
.star-btn {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: var(--text-muted); transition: transform 0.15s, color 0.15s;
  padding: 0 2px; line-height: 1; flex-shrink: 0;
}
.star-btn:hover { transform: scale(1.15); color: var(--yellow); }
.star-btn.starred { color: var(--yellow); }

/* ── Deep Dive Status Badge ─────────────────────────────────────────── */
.deep-dive-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 1px 8px;
  border-radius: 10px; white-space: nowrap;
}
.deep-dive-badge.pending {
  background: rgba(210,153,34,0.15); color: var(--yellow);
}
.deep-dive-badge.pending::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--yellow);
  animation: dd-pulse 1.5s ease-in-out infinite;
}
.deep-dive-badge.ready {
  background: rgba(63,185,80,0.15); color: var(--green);
}
.deep-dive-badge.ready::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--green);
}
@keyframes dd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Toast Notifications ────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transform: translateX(120%); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 340px;
}
.toast.show { transform: translateX(0); opacity: 1; }

/* ── Document Popup ─────────────────────────────────────────────────────── */
.doc-popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
}
.doc-popup-overlay.maximized { padding: 0; }
.doc-popup {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  max-width: 860px; width: 100%; max-height: 80vh; display: flex; flex-direction: column;
  position: relative;
}
.doc-popup-overlay.maximized .doc-popup {
  max-width: 100%; max-height: 100%; border-radius: 0; height: 100%; width: 100%;
}
.doc-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.doc-popup-header h2 { font-size: 16px; margin: 0; }
.doc-popup-btn {
  background: none; border: none; color: var(--text-muted); font-size: 20px;
  cursor: pointer; padding: 2px 8px; line-height: 1;
}
.doc-popup-btn:hover { color: var(--text); }
.doc-popup-body {
  padding: 24px; overflow-y: auto; flex: 1; font-size: 14px; line-height: 1.7;
}
.doc-popup-body h1 { font-size: 24px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 24px 0 12px; }
.doc-popup-body h1:first-child { margin-top: 0; }
.doc-popup-body h2 { font-size: 20px; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin: 20px 0 10px; }
.doc-popup-body h3 { font-size: 16px; margin: 16px 0 8px; }
.doc-popup-body p { margin: 0 0 12px; }
.doc-popup-body ul, .doc-popup-body ol { padding-left: 24px; margin: 0 0 12px; }
.doc-popup-body code {
  background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}
.doc-popup-body pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; margin: 0 0 12px;
}
.doc-popup-body pre code { background: none; padding: 0; }
.doc-popup-body table { border-collapse: collapse; width: 100%; margin: 0 0 12px; }
.doc-popup-body th, .doc-popup-body td {
  border: 1px solid var(--border); padding: 6px 12px; text-align: left; font-size: 13px;
}
.doc-popup-body th { background: var(--bg); font-weight: 600; }
.doc-popup-body blockquote {
  border-left: 3px solid var(--border); margin: 0 0 12px; padding: 4px 16px; color: var(--text-muted);
}
.doc-popup-body a { color: var(--blue, #58a6ff); }
.doc-popup-body img { max-width: 100%; }

/* ── Workflow Pipeline ────────────────────────────────────────────────── */
.wf-pipeline {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.wf-pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wf-pipeline-title {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf-pipeline-elapsed {
  font-size: 12px;
  color: var(--text-muted);
}
.wf-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 4px 0;
}
.wf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 110px;
  flex: 1;
}
.wf-step-top {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
}
.wf-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
}
.wf-connector.done { background: var(--green); }
.wf-connector.hidden { visibility: hidden; }
.wf-node {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}
.wf-node.pending { border-color: var(--border); color: var(--text-muted); }
.wf-node.active {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(88,166,255,0.1);
  animation: wf-pulse 2s ease-in-out infinite;
}
.wf-node.done {
  border-color: var(--green);
  background: var(--green);
  color: #000;
}
.wf-node.failed {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}
@keyframes wf-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88,166,255,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(88,166,255,0); }
}
.wf-step-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}
.wf-step.active .wf-step-label { color: var(--blue); font-weight: 600; }
.wf-step.done .wf-step-label { color: var(--green); }

.wf-step-progress {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: center;
}

/* Step detail expand */
.wf-detail-toggle {
  font-size: 11px;
  color: var(--blue);
  cursor: pointer;
  margin-top: 2px;
  text-align: center;
}
.wf-detail-toggle:hover { text-decoration: underline; }
.wf-detail-panel {
  width: 100%;
  margin-top: 8px;
  display: none;
}
.wf-detail-panel.open { display: block; }
.wf-sub-items {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 320px;
  margin: 0 auto;
}
.wf-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}
.wf-sub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wf-sub-dot.pending { background: var(--text-muted); }
.wf-sub-dot.active { background: var(--blue); animation: pulse 2s infinite; }
.wf-sub-dot.done { background: var(--green); }
.wf-sub-dot.unchanged { background: var(--text-muted); opacity: 0.5; }
.wf-sub-dot.failed { background: var(--red); }
.wf-sub-name { color: var(--text); flex: 1; }
.wf-sub-status { color: var(--text-muted); font-size: 11px; }

/* Prompt queue bar */
.wf-queue {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.wf-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.wf-queue-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}
.wf-queue-seg {
  height: 100%;
  transition: width 0.3s;
}
.wf-queue-seg.done { background: var(--green); }
.wf-queue-seg.running { background: var(--blue); }
.wf-queue-seg.failed { background: var(--red); }
.wf-queue-seg.pending { background: var(--border); }
.wf-queue-current {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Completed workflow fade-out */
.wf-pipeline.completed {
  opacity: 0.6;
  transition: opacity 0.5s;
}

/* ── Building Block Cards ──────────────────────────────────────────── */
.block-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  max-height: 420px;
  overflow-y: auto;
}
.block-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.block-item:last-child { border-bottom: none; }
.block-item:hover { background: rgba(255,255,255,0.03); }
.block-item.selected { background: rgba(163,113,247,0.08); }
.block-item-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.block-item.selected .block-item-checkbox {
  background: var(--purple);
  border-color: var(--purple);
}
.block-item-body { flex: 1; min-width: 0; }
.block-item-name {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.block-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.block-item-reason {
  font-size: 12px;
  color: var(--green);
  margin-top: 4px;
  line-height: 1.4;
}
.block-item-comments {
  margin-top: 6px;
}
.block-item-comments textarea {
  width: 100%;
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 32px;
  line-height: 1.4;
}
.block-item-comments textarea:focus {
  outline: none;
  border-color: var(--purple);
}
.block-item-comments textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Mobile */
@media (max-width: 768px) {
  .main { padding: 16px; }
  .project-grid { grid-template-columns: 1fr; }
  .idea-grid { grid-template-columns: 1fr; }
  .status-card { gap: 12px; }
  .task-detail-grid { grid-template-columns: 1fr; }
  .nav { flex-wrap: wrap; gap: 8px; }
  .idea-modal { margin: 16px; }
  .idea-modal-body { max-height: 80vh; }
  .doc-popup-overlay { padding: 0; }
  .doc-popup { border-radius: 0; max-height: 100%; height: 100%; }
}
