/* ═══════════════════════════════════════════════════════════════════════════
   AI Software Factory — factory.css
   Extracted + extended styles for the Factory page
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Factory Tab Navigation ────────────────────────────────────────────── */
.factory-tabs {
  display: flex; gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 1.25rem;
}
.factory-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
  white-space: nowrap;
}
.factory-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}
.factory-tab.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0,212,255,0.3);
  box-shadow: var(--cyan-glow);
}
.factory-tab-icon {
  font-size: 0.85rem;
  opacity: 0.7;
}
.factory-tab.active .factory-tab-icon {
  opacity: 1;
}
.factory-tab-badge {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0,212,255,0.12);
  color: var(--cyan);
  font-family: var(--font-mono);
  line-height: 1.4;
}
.factory-tab.active .factory-tab-badge {
  background: rgba(0,212,255,0.25);
}

/* ── Tab content panels ────────────────────────────────────────────────── */
.factory-panel {
  display: none;
}
.factory-panel.active {
  display: block;
}

/* ═══════════════════════════════════════════════════ OVERVIEW TAB */

/* Hero KPI row */
.fov-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.fov-kpi {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition);
}
.fov-kpi:hover {
  border-color: rgba(0,212,255,0.25);
}
.fov-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.fov-kpi.kpi-cyan::before    { background: var(--cyan); }
.fov-kpi.kpi-green::before   { background: var(--green); }
.fov-kpi.kpi-yellow::before  { background: var(--yellow); }
.fov-kpi.kpi-red::before     { background: var(--red); }
.fov-kpi.kpi-purple::before  { background: #a78bfa; }
.fov-kpi.kpi-orange::before  { background: var(--orange); }
.fov-kpi-val {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}
.fov-kpi-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-top: 4px;
  text-transform: uppercase;
}

/* Overview grid: 2 columns — activity feed + side panels */
.fov-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
  min-height: 0;
}

/* Activity feed */
.fov-activity {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.fov-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--bg-border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.fov-panel-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.fov-activity-list {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}
.fov-event {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid rgba(0,212,255,0.04);
  transition: background var(--transition);
}
.fov-event:hover {
  background: var(--bg-hover);
}
.fov-event-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.fov-event-icon.ev-task    { background: rgba(0,212,255,0.1); color: var(--cyan); }
.fov-event-icon.ev-run     { background: rgba(255,209,102,0.1); color: var(--yellow); }
.fov-event-icon.ev-success { background: rgba(0,255,159,0.1); color: var(--green); }
.fov-event-icon.ev-fail    { background: rgba(255,58,92,0.1); color: var(--red); }
.fov-event-icon.ev-review  { background: rgba(124,58,237,0.1); color: #c084fc; }
.fov-event-icon.ev-apply   { background: rgba(0,255,159,0.1); color: var(--green); }
.fov-event-body { flex: 1; min-width: 0; }
.fov-event-text {
  font-size: 0.78rem;
  color: var(--text-primary);
  line-height: 1.4;
}
.fov-event-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Side panels: overnight status + quick actions */
.fov-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Overnight status card */
.fov-overnight {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.fov-overnight-body {
  padding: 1rem 1.25rem;
}
.fov-overnight-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.78rem;
}
.fov-overnight-stat + .fov-overnight-stat {
  border-top: 1px solid rgba(0,212,255,0.04);
}
.fov-overnight-label { color: var(--text-muted); }
.fov-overnight-val { font-family: var(--font-mono); color: var(--text-primary); font-weight: 500; }

/* Quick actions */
.fov-actions {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.fov-actions-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.fov-action-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}
.fov-action-btn:hover {
  color: var(--text-primary);
  border-color: rgba(0,212,255,0.3);
  background: var(--bg-hover);
}
.fov-action-icon {
  font-size: 0.9rem;
  color: var(--cyan);
}

/* ═══════════════════════════════════════════════════ TASKS TAB */
/* Re-uses all da-* classes from dev_agent.html which are now included below */

/* Agent status strip */
.da-layout {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 1rem;
  height: calc(100vh - var(--topbar-h) - var(--statusbar-h) - 10rem);
}
.da-agent-strip {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius-lg);
}
.da-agent-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: rgba(255,209,102,0.1); color: var(--yellow);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.da-agent-info { flex: 1; }
.da-agent-name { font-size: 0.95rem; font-weight: 700; }
.da-agent-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.da-agent-caps { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.35rem; }
.da-cap-tag {
  font-size: 0.6rem; padding: 2px 7px; border-radius: var(--radius-sm);
  background: rgba(255,209,102,0.08); color: var(--yellow);
  border: 1px solid rgba(255,209,102,0.2); letter-spacing: 0.06em;
}
.da-agent-stats { display: flex; gap: 1.5rem; flex-shrink: 0; }
.da-stat { text-align: center; }
.da-stat-val {
  font-size: 1.3rem; font-weight: 700; font-family: var(--font-mono);
  color: var(--text-primary); line-height: 1;
}
.da-stat-label { font-size: 0.6rem; color: var(--text-muted); letter-spacing: 0.1em; margin-top: 2px; }
.da-stat-val.cyan { color: var(--cyan); }
.da-stat-val.yellow { color: var(--yellow); }
.da-stat-val.green { color: var(--green); }
.da-agent-badge {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 4px 12px; border-radius: var(--radius-sm);
  background: var(--green-dim); color: var(--green);
  border: 1px solid rgba(0,255,159,0.25);
  flex-shrink: 0;
}

/* KPI row */
.da-kpi-row {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.75rem;
}
.da-kpi {
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-md); padding: 0.75rem 1rem;
  display: flex; flex-direction: column; gap: 2px;
  position: relative; overflow: hidden;
}
.da-kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.da-kpi.kpi-cyan::before  { background: var(--cyan); }
.da-kpi.kpi-green::before { background: var(--green); }
.da-kpi.kpi-yellow::before{ background: var(--yellow); }
.da-kpi.kpi-red::before   { background: var(--red); }
.da-kpi.kpi-purple::before{ background: #a78bfa; }
.da-kpi.kpi-muted::before { background: var(--text-muted); }
.da-kpi-val {
  font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono);
  color: var(--text-primary); line-height: 1;
}
.da-kpi-label { font-size: 0.6rem; color: var(--text-muted); letter-spacing: 0.1em; margin-top: 2px; }

/* Main split panel */
.da-split {
  display: grid; grid-template-columns: 380px 1fr; gap: 1rem;
  min-height: 0;
}

/* List panel */
.da-list-panel {
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column;
}
.da-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--bg-border);
  background: var(--bg-elevated); flex-shrink: 0;
}
.da-panel-title { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; }
.da-panel-tabs { display: flex; gap: 0.25rem; }
.da-tab {
  padding: 4px 12px; border-radius: var(--radius-sm);
  font-size: 0.7rem; letter-spacing: 0.06em;
  border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--text-muted);
  font-family: var(--font-body); transition: all var(--transition);
}
.da-tab:hover { color: var(--text-secondary); background: var(--bg-hover); }
.da-tab.active {
  background: var(--cyan-dim); color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
}
.da-list-body { flex: 1; overflow-y: auto; }
.da-list-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1rem; color: var(--text-muted); font-size: 0.8rem; gap: 0.5rem;
}
.da-list-empty-icon { font-size: 2rem; opacity: 0.3; }

/* Task row */
.da-task-row {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(0,212,255,0.04);
  cursor: pointer; transition: background var(--transition);
  display: flex; flex-direction: column; gap: 0.3rem;
}
.da-task-row:hover { background: var(--bg-hover); }
.da-task-row.selected { background: var(--cyan-dim); border-left: 2px solid var(--cyan); }
.da-task-row-top { display: flex; align-items: center; gap: 0.5rem; }
.da-task-title { font-size: 0.82rem; font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.da-task-row-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.68rem; color: var(--text-muted); }
.da-task-type { font-family: var(--font-mono); color: var(--cyan); }

/* Run row */
.da-run-row {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(0,212,255,0.04);
  cursor: pointer; transition: background var(--transition);
  display: flex; align-items: center; gap: 0.6rem;
}
.da-run-row:hover { background: var(--bg-hover); }
.da-run-row.selected { background: var(--cyan-dim); border-left: 2px solid var(--cyan); }
.da-run-info { flex: 1; min-width: 0; }
.da-run-title { font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.da-run-meta { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; font-family: var(--font-mono); }

/* Status badges */
.status-badge {
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 2px 7px; border-radius: var(--radius-sm); flex-shrink: 0;
  text-transform: uppercase;
}
.status-new       { background: rgba(74,90,122,0.25); color: var(--text-muted); }
.status-queued    { background: rgba(0,212,255,0.1); color: var(--cyan); }
.status-running   { background: rgba(255,209,102,0.15); color: var(--yellow); }
.status-review    { background: rgba(124,58,237,0.2); color: #c084fc; }
.status-approved  { background: var(--green-dim); color: var(--green); }
.status-rejected  { background: var(--red-dim); color: var(--red); }
.status-done      { background: var(--green-dim); color: var(--green); }
.status-failed    { background: var(--red-dim); color: var(--red); }
.status-succeeded { background: var(--green-dim); color: var(--green); }
.status-pending   { background: rgba(74,90,122,0.25); color: var(--text-muted); }
.status-cancelled { background: rgba(74,90,122,0.25); color: var(--text-muted); }

/* Priority badges */
.priority-badge {
  font-size: 0.58rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: var(--radius-sm); flex-shrink: 0;
}
.priority-low      { background: rgba(74,90,122,0.2); color: var(--text-muted); }
.priority-medium   { background: rgba(0,212,255,0.08); color: var(--cyan); }
.priority-high     { background: rgba(255,140,66,0.12); color: var(--orange); }
.priority-critical { background: var(--red-dim); color: var(--red); }

/* Risk badge */
.risk-badge {
  font-size: 0.58rem; font-weight: 600; padding: 1px 6px;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.risk-low    { background: var(--green-dim); color: var(--green); }
.risk-medium { background: rgba(255,209,102,0.12); color: var(--yellow); }
.risk-high   { background: var(--red-dim); color: var(--red); }

/* Detail panel */
.da-detail-panel {
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column;
}
.da-detail-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.8rem; gap: 0.75rem;
}
.da-detail-empty-icon { font-size: 2.5rem; opacity: 0.2; }
.da-detail-content { display: flex; flex-direction: column; height: 100%; }
.da-detail-header {
  padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--bg-border);
  background: var(--bg-elevated); flex-shrink: 0;
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.da-detail-title-block { flex: 1; }
.da-detail-title { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.da-detail-subtitle { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; font-family: var(--font-mono); }
.da-detail-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.da-detail-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.da-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.da-meta-item { display: flex; flex-direction: column; gap: 3px; }
.da-meta-label { font-size: 0.6rem; letter-spacing: 0.1em; color: var(--text-muted); text-transform: uppercase; }
.da-meta-value { font-size: 0.78rem; font-weight: 500; }
.da-meta-value.mono { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-secondary); }
.da-section-label {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.12em;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.4rem;
}
.da-text-block {
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  padding: 0.75rem; font-size: 0.78rem; color: var(--text-secondary);
  line-height: 1.6; border: 1px solid var(--bg-border);
}
.da-scope-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.da-scope-tag {
  font-size: 0.65rem; font-family: var(--font-mono); padding: 2px 8px;
  border-radius: var(--radius-sm); background: var(--cyan-dim);
  color: var(--cyan); border: 1px solid rgba(0,212,255,0.2);
}
.da-files-list { display: flex; flex-direction: column; gap: 0.25rem; }
.da-file-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.72rem; font-family: var(--font-mono);
  color: var(--text-secondary); padding: 3px 0;
}
.da-file-icon { color: var(--yellow); font-size: 0.65rem; }

/* Log viewer */
.da-log-viewer {
  background: var(--bg-base); border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm); padding: 0.75rem;
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-secondary); line-height: 1.7;
  max-height: 280px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.log-line-ok     { color: var(--green); }
.log-line-err    { color: var(--red); }
.log-line-warn   { color: var(--yellow); }
.log-line-head   { color: var(--cyan); font-weight: 700; }
.log-line-note   { color: var(--text-muted); }

/* Validation result bar */
.da-validation-bar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 0.9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--bg-border);
}
.da-val-status { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; }
.da-val-counts { display: flex; gap: 0.75rem; font-size: 0.72rem; font-family: var(--font-mono); }

/* New task modal */
.da-new-task-form { display: flex; flex-direction: column; gap: 0.75rem; }
.da-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* Button: danger */
.btn-danger {
  background: transparent; color: var(--red);
  border: 1px solid rgba(255,58,92,0.4);
}
.btn-danger:hover { background: var(--red-dim); border-color: var(--red); }

/* Button: success */
.btn-success {
  background: transparent; color: var(--green);
  border: 1px solid rgba(0,255,159,0.35);
}
.btn-success:hover { background: var(--green-dim); border-color: var(--green); }

/* DEV FACTORY CONTROL */
.dfc-section {
  background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg); margin-top: 1.5rem; overflow: hidden;
}
.dfc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--bg-border);
  background: rgba(13,21,38,0.5);
}
.dfc-title {
  font-size: 11px; font-weight: 600; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--text-secondary);
}
.dfc-body { padding: 20px; }
.dfc-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.dfc-kpi {
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  border-radius: 8px; padding: 12px; text-align: center;
}
.dfc-kpi-val {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700; line-height: 1;
}
.dfc-kpi-lbl {
  font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted); margin-top: 4px;
}
.dfc-config {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-top: 16px;
}
.dfc-cfg-card {
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  border-radius: 8px; padding: 14px;
}
.dfc-cfg-label {
  font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 6px;
}
.dfc-cfg-input {
  width: 100%; background: var(--bg-surface); border: 1px solid var(--bg-border);
  border-radius: 4px; padding: 6px 10px; color: var(--text-primary);
  font-family: var(--font-mono); font-size: 13px; box-sizing: border-box;
}
.dfc-cfg-input:focus { border-color: var(--cyan); outline: none; }
.dfc-cfg-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.dfc-cfg-toggle input { accent-color: var(--cyan); }
.dfc-save-btn {
  margin-top: 12px; padding: 8px 24px; border-radius: 6px;
  border: 1px solid rgba(0,212,255,0.3); background: rgba(0,212,255,0.08);
  color: var(--cyan); font-size: 12px; cursor: pointer; font-weight: 600;
}
.dfc-save-btn:hover { background: rgba(0,212,255,0.15); }
.dfc-diff-file {
  background: var(--bg-elevated); border: 1px solid var(--bg-border);
  border-radius: 8px; margin-bottom: 10px; overflow: hidden;
}
.dfc-diff-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: rgba(13,21,38,0.4); cursor: pointer;
}
.dfc-diff-path { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); }
.dfc-diff-badge {
  font-size: 9px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.dfc-diff-badge.new { background: rgba(0,255,159,0.1); color: var(--green); }
.dfc-diff-badge.modified { background: rgba(0,212,255,0.1); color: var(--cyan); }
.dfc-diff-badge.deleted { background: rgba(255,99,99,0.1); color: var(--red); }
.dfc-diff-stats { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.dfc-diff-content {
  display: none; padding: 10px 14px; font-family: var(--font-mono);
  font-size: 11px; line-height: 1.5; white-space: pre-wrap;
  max-height: 400px; overflow-y: auto; color: var(--text-secondary);
  background: rgba(0,0,0,0.2);
}
.dfc-diff-content .add { color: var(--green); }
.dfc-diff-content .del { color: var(--red); }

/* ═══════════════════════════════════════════════════ PIPELINE TAB */

/* Pipeline SVG container */
.fpipe-svg-section {
    background: var(--bg-surface);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.fpipe-svg-title {
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em;
    color: var(--text-secondary); text-transform: uppercase;
    margin-bottom: 1rem;
}

/* Cycle info row */
.fpipe-cycle-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bg-border);
}
.fpipe-cycle-stat {
    display: flex; flex-direction: column; gap: 2px;
}
.fpipe-cycle-label {
    font-size: 0.6rem; letter-spacing: 0.1em; color: var(--text-muted);
    text-transform: uppercase;
}
.fpipe-cycle-val {
    font-size: 0.78rem; font-family: var(--font-mono); font-weight: 600;
    color: var(--text-primary);
}

/* Kanban board */
.fpipe-kanban {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}
.fpipe-kanban-col {
    background: var(--bg-surface);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 200px;
}
.fpipe-kanban-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--bg-border);
}
.fpipe-kanban-title {
    font-size: 0.65rem; font-weight: 600; letter-spacing: 0.1em;
    color: var(--text-muted); text-transform: uppercase;
}
.fpipe-kanban-count {
    font-size: 0.65rem; font-family: var(--font-mono);
    color: var(--cyan); font-weight: 700;
}
.fpipe-kanban-body {
    padding: 0.5rem;
    display: flex; flex-direction: column; gap: 0.4rem;
}
.fpipe-kanban-card {
    padding: 0.5rem 0.6rem;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition);
    display: flex; flex-direction: column; gap: 0.3rem;
}
.fpipe-kanban-card:hover {
    border-color: rgba(0,212,255,0.3);
}
.fpipe-kanban-card-title {
    font-size: 0.72rem; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fpipe-kanban-empty {
    padding: 1rem; text-align: center;
    font-size: 0.7rem; color: var(--text-muted);
}

/* History table */
.fpipe-history-table {
    width: 100%;
}
.fpipe-history-header, .fpipe-history-row {
    display: grid;
    grid-template-columns: 90px 140px 70px repeat(5, 1fr) 70px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
}
.fpipe-history-header {
    font-size: 0.6rem; font-weight: 600; letter-spacing: 0.1em;
    color: var(--text-muted); text-transform: uppercase;
    border-bottom: 1px solid var(--bg-border);
    padding-bottom: 0.6rem;
    margin-bottom: 0.25rem;
}
.fpipe-history-row {
    border-bottom: 1px solid rgba(0,212,255,0.04);
    transition: background var(--transition);
}
.fpipe-history-row:hover {
    background: var(--bg-hover);
}
.fpipe-history-row .mono {
    font-family: var(--font-mono); font-size: 0.7rem;
    color: var(--text-secondary);
}

@media (max-width: 1200px) {
    .fpipe-kanban { grid-template-columns: repeat(3, 1fr); }
    .fpipe-history-header, .fpipe-history-row {
        grid-template-columns: 80px 120px 60px repeat(5, 1fr) 60px;
        font-size: 0.65rem;
    }
}
@media (max-width: 768px) {
    .fpipe-kanban { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════════════════ AGENTS TAB */
.fagent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.fagent-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color var(--transition);
}
.fagent-card:hover {
  border-color: rgba(0,212,255,0.25);
}
.fagent-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.fagent-avatar {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.fagent-avatar.av-dev   { background: rgba(255,209,102,0.1); color: var(--yellow); }
.fagent-avatar.av-scan  { background: rgba(0,212,255,0.1); color: var(--cyan); }
.fagent-avatar.av-test  { background: rgba(0,255,159,0.1); color: var(--green); }
.fagent-avatar.av-audit { background: rgba(124,58,237,0.1); color: #c084fc; }
.fagent-name {
  font-size: 0.9rem; font-weight: 600; color: var(--text-primary);
}
.fagent-model {
  font-size: 0.65rem; color: var(--text-muted); font-family: var(--font-mono);
  margin-top: 2px;
}
.fagent-status-dot {
  margin-left: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fagent-status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.fagent-status-dot.offline { background: var(--text-muted); }
.fagent-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
  margin-top: 0.5rem;
}
.fagent-stat-val {
  font-size: 1.1rem; font-weight: 700; font-family: var(--font-mono);
  color: var(--text-primary); line-height: 1;
}
.fagent-stat-label {
  font-size: 0.55rem; color: var(--text-muted);
  letter-spacing: 0.08em; margin-top: 2px;
}
.fagent-caps {
  display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.75rem;
}

/* ═══════════════════════════════════════════════════ HISTORY TAB */
.fhist-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fhist-entry {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0,212,255,0.04);
}
.fhist-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  flex-shrink: 0;
}
.fhist-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fhist-dot.dot-green  { background: var(--green); }
.fhist-dot.dot-red    { background: var(--red); }
.fhist-dot.dot-yellow { background: var(--yellow); }
.fhist-dot.dot-cyan   { background: var(--cyan); }
.fhist-dot.dot-muted  { background: var(--text-muted); }
.fhist-line {
  flex: 1;
  width: 1px;
  background: rgba(0,212,255,0.1);
  margin-top: 4px;
}
.fhist-body { flex: 1; min-width: 0; }
.fhist-title {
  font-size: 0.82rem; font-weight: 500; color: var(--text-primary);
}
.fhist-meta {
  font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono);
  margin-top: 3px;
}

/* ═══════════════════════════════════════════════════ RESPONSIVE */
@media (max-width: 1200px) {
  .fov-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .fov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .factory-tabs { flex-wrap: wrap; }
  .factory-tab { flex: none; }
  .fov-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .da-split { grid-template-columns: 1fr; }
  .da-kpi-row { grid-template-columns: repeat(3, 1fr); }
}


/* ═══════════════════════════════════════════════════ GOAL WIZARD */

/* Step indicator */
.gw-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
  padding: 0 2rem;
}
.gw-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  z-index: 1;
}
.gw-step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 2px solid var(--bg-border);
  color: var(--text-muted);
  transition: all 0.3s ease;
}
.gw-step.active .gw-step-dot {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,212,255,0.25);
}
.gw-step.done .gw-step-dot {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}
.gw-step-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.gw-step.active .gw-step-label { color: var(--cyan); }
.gw-step.done .gw-step-label { color: var(--green); }
.gw-step-line {
  flex: 1;
  height: 2px;
  background: var(--bg-border);
  margin: 0 0.5rem;
  margin-bottom: 1.2rem;
  transition: background 0.3s ease;
}
.gw-step-line.done {
  background: var(--green);
}

/* Panels */
.gw-panel {
  display: none;
}
.gw-panel.active {
  display: block;
}

/* Steps list in plan view */
.gw-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.gw-plan-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}
.gw-plan-step:hover {
  border-color: rgba(0,212,255,0.25);
}
.gw-plan-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  font-family: var(--font-mono);
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid rgba(0,212,255,0.3);
  flex-shrink: 0;
  margin-top: 2px;
}
.gw-plan-step-body { flex: 1; min-width: 0; }
.gw-plan-step-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.gw-plan-step-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   Stream terminal panel — Phase 3: Live Execution Stream
   ═══════════════════════════════════════════════════════════════ */
.stream-panel {
    display: none;
    background: var(--bg-base);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
    overflow: hidden;
}
.stream-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--bg-border);
}
.stream-title {
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.1em; color: var(--cyan);
    text-transform: uppercase;
}
.stream-output {
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-secondary);
}
.stream-line { white-space: pre-wrap; word-break: break-all; }
.stream-head { color: var(--cyan); font-weight: 700; }
.stream-cyan { color: var(--cyan); }
.stream-ok   { color: var(--green); }
.stream-err  { color: var(--red); }
.stream-warn { color: var(--yellow); }
.stream-note { color: var(--text-muted); }


/* ═══════════════════════════════════════════════════ REVIEW PANEL */
.review-panel {
  background: var(--bg-surface);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 0.25rem;
}
.review-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--bg-border);
}
.review-panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
}
.review-panel-actions {
  display: flex;
  gap: 0.4rem;
}
.review-reject-area {
  padding: 0.75rem 1rem;
  background: rgba(255,58,92,0.04);
  border-bottom: 1px solid var(--bg-border);
}
.review-diff-area {
  max-height: 500px;
  overflow-y: auto;
}
.review-diff-summary {
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-border);
}
.review-file {
  border-bottom: 1px solid rgba(0,212,255,0.06);
}
.review-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
}
.review-file-header:hover {
  background: var(--bg-hover);
}
.review-file-path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan);
}
.review-file-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.review-file-stats {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}
.review-badge {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.review-badge-new {
  background: rgba(0,255,159,0.1);
  color: var(--green);
}
.review-badge-mod {
  background: rgba(0,212,255,0.1);
  color: var(--cyan);
}
.review-badge-del {
  background: rgba(255,58,92,0.1);
  color: var(--red);
}
.review-file-diff {
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.55;
  background: rgba(0,0,0,0.25);
  overflow-x: auto;
}
.diff-line {
  padding: 0 1rem;
  white-space: pre;
  min-height: 1.55em;
}
.diff-add {
  background: rgba(0,255,159,0.08);
  color: var(--green);
}
.diff-del {
  background: rgba(255,58,92,0.08);
  color: var(--red);
}
.diff-hunk {
  background: rgba(0,212,255,0.05);
  color: var(--cyan);
  font-weight: 600;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  margin-top: 0.25rem;
}

/* Stream pulse indicator */
.stream-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: streamPulse 1.5s infinite;
}
@keyframes streamPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green); }
    50% { opacity: 0.4; box-shadow: none; }
}

/* Kanban live stream box */
.fpipe-stream-box {
    margin: 0.25rem 0.5rem 0.5rem;
    background: var(--bg-base);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    color: var(--text-secondary);
}

/* Kanban live stream box */
.fpipe-stream-box {
    margin: 0.25rem 0.5rem 0.5rem;
    background: var(--bg-base);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    color: var(--text-secondary);
}
