/* ===== Harness Pipeline View ===== */
.view-harness {
  flex-direction: column;
  height: 100%;
}

.harness-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ===== Header ===== */
.harness-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.harness-view-title {
  font-size: 20px;
  font-weight: 700;
}

/* ===== Input Form ===== */
.harness-input-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.harness-input-field {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-family);
  transition: border-color 150ms;
}

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

.harness-input-field::placeholder {
  color: var(--text-muted);
}

.harness-submit-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 150ms;
}

.harness-submit-btn:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-md);
}

/* ===== Empty State ===== */
.harness-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.harness-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  color: var(--accent);
  opacity: 0.5;
}

.harness-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.harness-empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Feature Card ===== */
.harness-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 150ms;
}

.harness-card:hover {
  box-shadow: var(--shadow-md);
}

.harness-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.harness-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.harness-card-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 150ms, color 150ms;
}

.harness-card:hover .harness-card-delete {
  opacity: 1;
}

.harness-card-delete:hover {
  color: #EF4444;
}

.harness-incomplete-badge {
  font-size: 11px;
  color: var(--status-warning, #F59E0B);
  background: color-mix(in srgb, var(--status-warning, #F59E0B) 12%, transparent);
  border-radius: var(--radius-full, 999px);
  padding: 1px 8px;
  font-weight: 500;
  white-space: nowrap;
}

.harness-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

/* ===== Phase Progress Bar ===== */
.harness-phase-bar {
  display: flex;
  align-items: center;
  margin-top: 14px;
  gap: 0;
}

.harness-phase-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 200ms;
}

.harness-phase-step.phase-done {
  background: var(--status-online);
  color: white;
}

.harness-phase-step.phase-active {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.harness-phase-step.phase-current {
  box-shadow: 0 0 0 3px var(--accent-light);
}

.harness-phase-step.phase-pending {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* 시작 가능한 phase: hover 시 시각적 힌트 */
.harness-phase-step.phase-actionable {
  cursor: pointer;
  border: 1.5px dashed var(--text-muted);
}

.harness-phase-step.phase-actionable:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  transform: scale(1.15);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent);
}

.harness-phase-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 8px;
}

.harness-phase-step.phase-done + .harness-phase-line {
  background: var(--status-online);
}

/* ===== Phase Hover Popup ===== */
.phase-hover-popup {
  position: fixed;
  z-index: 9999;
  display: none;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 160px;
  max-width: 320px;
  max-height: 360px;
  overflow-y: auto;
}

.phase-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.phase-popup-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.phase-popup-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.phase-popup-done {
  background: rgba(16,185,129,0.1);
  color: var(--status-online);
}

.phase-popup-active {
  background: var(--accent-light);
  color: var(--accent);
}

.phase-popup-pending {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.phase-popup-evaluating {
  background: rgba(245,158,11,0.1);
  color: #F59E0B;
}

.phase-popup-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.phase-popup-error {
  font-size: 11px;
  color: #EF4444;
  margin-top: 4px;
  word-break: break-word;
}

.phase-popup-loading {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Detail sections */
.phase-popup-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.phase-popup-detail-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 6px;
}

.phase-popup-detail-title:first-child {
  margin-top: 0;
}

.phase-popup-item {
  font-size: 11px;
  color: var(--text-primary);
  padding: 2px 0;
  line-height: 1.4;
}

.phase-popup-item strong {
  color: var(--text-secondary);
}

.phase-popup-item-text {
  color: var(--text-primary);
}

.phase-popup-eval {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 4px;
}

.phase-popup-eval.eval-confident {
  background: rgba(16,185,129,0.1);
  color: var(--status-online);
}

.phase-popup-eval.eval-uncertain {
  background: rgba(245,158,11,0.1);
  color: #F59E0B;
}

.phase-popup-eval.eval-doubtful {
  background: rgba(239,68,68,0.1);
  color: #EF4444;
}

.phase-popup-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-style: italic;
}

.phase-popup-text {
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-line;
}

.phase-popup-more {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.phase-popup-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.phase-popup-kw {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.phase-popup-risk-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.risk-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

.risk-badge.risk-critical { color: #EF4444; }
.risk-badge.risk-manageable { color: #F59E0B; }
.risk-badge.risk-silent { color: #3B82F6; }

/* Expand/collapse */
.phase-popup-expand {
  display: inline-block;
  margin-top: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font-family);
}

.phase-popup-expand:hover {
  opacity: 0.7;
}

.phase-popup-full {
  max-height: 280px;
  overflow-y: auto;
}

/* Markdown in popup */
.phase-popup-md {
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 2px 0 6px;
}

.phase-popup-md p { margin: 2px 0; }
.phase-popup-md ul, .phase-popup-md ol { padding-left: 16px; margin: 2px 0; }
.phase-popup-md h1, .phase-popup-md h2, .phase-popup-md h3 { font-size: 12px; font-weight: 700; margin: 6px 0 2px; }
.phase-popup-md code { background: var(--bg-tertiary); padding: 1px 4px; border-radius: 3px; font-size: 10px; }
.phase-popup-md pre { background: var(--bg-tertiary); padding: 6px 8px; border-radius: var(--radius-md); overflow-x: auto; font-size: 10px; margin: 4px 0; }

/* Source full view */
.phase-popup-source-full {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.phase-popup-source-full:last-child {
  border-bottom: none;
}

/* Discussion entry in full view */
.phase-popup-discussion-entry {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.phase-popup-discussion-entry:last-child {
  border-bottom: none;
}

.phase-popup-round {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  margin-left: 4px;
}

/* Chat entry */
.phase-popup-chat-entry {
  padding: 4px 0;
}

.phase-popup-chat-user {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.phase-popup-chat-assistant {
  border-left: 2px solid var(--text-muted);
  padding-left: 8px;
}

/* File path tag */
.phase-popup-file {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}

.harness-phase-step {
  cursor: default;
}

/* ===== Card Footer ===== */
.harness-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.harness-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== Action Buttons ===== */
.harness-action-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 150ms;
}

.harness-action-btn:hover {
  opacity: 0.9;
}

.harness-action-btn.harness-action-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.harness-action-btn.harness-action-secondary:hover {
  background: var(--border);
}

.harness-action-btn.harness-action-restart {
  background: transparent;
  color: var(--text-tertiary);
  padding: 4px 8px;
  font-size: 14px;
  min-width: 28px;
  border: 1px solid var(--border);
}

.harness-action-btn.harness-action-restart:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
  border-color: var(--accent);
}

.harness-action-status {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.harness-action-status.harness-action-done {
  color: var(--status-online);
}

.harness-action-group {
  display: flex;
  gap: 6px;
}

/* ===== Briefing Cards ===== */
.harness-briefing-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  border-left: 3px solid var(--accent);
}

.harness-briefing-card.briefing-seoyeon { border-left-color: #8B5CF6; }
.harness-briefing-card.briefing-jihyun { border-left-color: #06B6D4; }
.harness-briefing-card.briefing-sori { border-left-color: #F59E0B; }
.harness-briefing-card.briefing-hana { border-left-color: var(--accent); }

.harness-briefing-agent {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.harness-briefing-viewpoint {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.harness-briefing-details {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Research Modal ===== */
.harness-research-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.harness-research-modal {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.harness-research-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.harness-research-title {
  font-size: 16px;
  font-weight: 600;
}

.harness-research-close {
  background: var(--bg-secondary);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.harness-research-close:hover {
  background: var(--bg-tertiary);
}

.harness-research-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.harness-research-section {
  margin-bottom: 20px;
}

.harness-research-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.harness-research-meta {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* Keywords */
.harness-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.harness-keyword {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Sources */
.harness-source {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}

.harness-source.filter-direct {
  border-left-color: var(--status-online);
}

.harness-source.filter-indirect {
  border-left-color: #F59E0B;
}

.harness-source.filter-none {
  border-left-color: #EF4444;
}

.harness-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.harness-source-filter {
  font-size: 14px;
}

.harness-source-type {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.harness-source-url {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.harness-source-url:hover {
  text-decoration: underline;
}

.harness-source-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Review Chat Popup ===== */
.harness-review-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.harness-review-popup {
  width: 95%;
  max-width: 720px;
  height: 85vh;
  max-height: 800px;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.harness-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.harness-review-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.harness-review-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.harness-review-close:hover {
  color: var(--text-primary);
}

.harness-review-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 문서 영역 */
.harness-review-docs {
  flex-shrink: 0;
  max-height: 40%;
  overflow-y: auto;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.review-doc-section {
  margin-bottom: 12px;
}

.review-doc-section:last-child {
  margin-bottom: 0;
}

.review-doc-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.review-doc-content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}

.review-doc-content h1,
.review-doc-content h2,
.review-doc-content h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.review-doc-content ul,
.review-doc-content ol {
  padding-left: 20px;
  margin: 4px 0;
}

.review-doc-content p {
  margin: 4px 0;
}

/* 채팅 영역 */
.harness-review-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.harness-review-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.review-msg {
  margin-bottom: 12px;
}

.review-msg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.review-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.6;
  max-width: 85%;
}

.review-msg-user-bubble {
  background: var(--accent);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.review-msg-assistant-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.review-msg-assistant-bubble p { margin: 4px 0; }
.review-msg-assistant-bubble ul,
.review-msg-assistant-bubble ol { padding-left: 18px; margin: 4px 0; }

.review-typing {
  color: var(--text-muted);
  animation: reviewBlink 1s infinite;
}

@keyframes reviewBlink {
  50% { opacity: 0.3; }
}

/* 입력 영역 */
.harness-review-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.harness-review-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  resize: none;
  box-sizing: border-box;
}

.harness-review-input:focus {
  outline: none;
  border-color: var(--accent);
}

.harness-review-input:disabled {
  opacity: 0.5;
}

.harness-review-send {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
}

.harness-review-send:hover { opacity: 0.9; }
.harness-review-send:disabled { opacity: 0.5; cursor: default; }

/* 확정 버튼 */
.harness-review-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* 리허설 모드 선택 (하네스 + 팩토리 공용) */
.rehearsal-mode-select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
}

.harness-review-confirm {
  background: var(--status-online);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 150ms;
}

.harness-review-confirm:hover {
  opacity: 0.9;
}

/* ===== Discussion Progress ===== */
.harness-progress {
  margin-top: 10px;
  padding: 8px 0;
}

.harness-progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.harness-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
}

.harness-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Discussion Entries ===== */
.harness-discussion-entry {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}

.harness-discussion-entry.discussion-agent-seoyeon { border-left-color: #8B5CF6; }
.harness-discussion-entry.discussion-agent-jihyun { border-left-color: #06B6D4; }
.harness-discussion-entry.discussion-agent-sori { border-left-color: #F59E0B; }

.harness-discussion-speaker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.harness-discussion-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.harness-discussion-round {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.harness-discussion-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}

.harness-discussion-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: 8px;
}

.harness-discussion-active {
  background: var(--accent-light);
  color: var(--accent);
}

.harness-discussion-done {
  background: rgba(16,185,129,0.1);
  color: var(--status-online);
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
  .harness-scroll {
    padding: 16px;
  }

  .harness-input-form {
    flex-direction: column;
  }

  .harness-submit-btn {
    width: 100%;
    padding: 12px;
  }

  .harness-phase-step {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .harness-research-modal {
    width: 95%;
    max-height: 85vh;
    border-radius: var(--radius-lg);
  }

  .harness-research-body {
    padding: 16px;
  }

  .harness-review-popup {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .harness-review-docs {
    max-height: 35%;
  }
}

/* ===== Implementation Progress ===== */

.harness-impl-progress {
  padding: 10px 0;
  border-top: 1px solid var(--border-primary);
  margin-top: 8px;
}

.impl-empty {
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: center;
  padding: 8px 0;
}

.impl-phase {
  margin-bottom: 6px;
}

.impl-phase-header {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.impl-phase-active .impl-phase-header {
  color: var(--accent-primary);
}

.impl-phase-done .impl-phase-header {
  color: var(--status-online);
}

.impl-step {
  font-size: 12px;
  padding: 2px 0 2px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.impl-step-active {
  color: var(--accent-primary);
}

.impl-step-done {
  color: var(--status-online);
}

.impl-step-error {
  color: var(--status-offline, #e74c3c);
}

.harness-action-status.harness-action-blocked {
  color: var(--status-offline, #e74c3c);
  font-weight: 600;
}

/* ===== Hardening Progress ===== */

.harness-hardening-progress {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.hardening-msg {
  font-size: 12px;
  padding: 3px 0 3px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.hardening-msg-active {
  color: var(--accent);
  font-weight: 500;
}

.hardening-msg-done {
  color: var(--status-online);
}

.hardening-msg-error {
  color: var(--status-offline, #e74c3c);
}

/* ===== Assumptions & Rehearsal Overlays ===== */

.harness-assumptions-overlay,
.harness-rehearsal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.harness-assumptions-popup,
.harness-rehearsal-popup {
  background: var(--bg-primary);
  border-radius: var(--radius-xl, 16px);
  width: min(500px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.harness-assumptions-header,
.harness-rehearsal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-primary);
}

.harness-assumptions-title,
.harness-rehearsal-title {
  font-size: 16px;
  font-weight: 700;
}

.harness-popup-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
}

.harness-assumptions-body,
.harness-rehearsal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.harness-assumptions-footer,
.harness-rehearsal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-primary);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Assumption Cards */

.assumptions-intro {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}

.assumption-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.assumption-text {
  font-size: 14px;
  margin-bottom: 8px;
}

.assumption-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.assumption-reason {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.assumption-evaluated {
  opacity: 0.45;
  transition: opacity 200ms ease;
}

.assumption-evaluated:hover {
  opacity: 0.8;
}

.assumption-redefine {
  border-left: 3px solid var(--accent-primary);
}

.assumption-chips {
  display: flex;
  gap: 6px;
}

.eval-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-primary);
  background: var(--bg-primary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.eval-chip:hover {
  border-color: var(--accent-primary);
}

.eval-chip.eval-active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Rehearsal Risk Cards */

.rehearsal-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.risk-count {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-secondary);
}

.rehearsal-agent {
  margin-bottom: 14px;
}

.rehearsal-agent-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

/* Rehearsal/Risk card styles moved to factory.css */

/* Direction Choice Buttons */

.assumption-direction-choices {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  width: 100%;
}

.direction-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-primary);
  background: var(--bg-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.direction-btn:hover {
  border-color: var(--accent-primary);
}

.direction-btn.direction-active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  font-weight: 600;
}

/* ===== Retrospective Overlay ===== */

.harness-retro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.harness-retro-popup {
  background: var(--bg-primary);
  border-radius: var(--radius-xl, 16px);
  width: min(580px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.harness-retro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.harness-retro-title {
  font-size: 16px;
  font-weight: 700;
}

.harness-retro-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Summary bar */
.retro-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.retro-stat {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.retro-stat-new {
  background: rgba(16, 185, 129, 0.1);
  color: var(--status-online);
}

.retro-stat-dup {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.retro-stat-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #F59E0B;
}

/* Warning badge in action button */
.retro-warning-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  margin-left: 4px;
}

/* Section */
.retro-section {
  margin-bottom: 18px;
}

.retro-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.retro-section-warn {
  color: #F59E0B;
}

/* Funnel */
.retro-funnel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.retro-funnel-stage {
  display: grid;
  grid-template-columns: 64px 1fr 32px 40px;
  align-items: center;
  gap: 8px;
}

.retro-funnel-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

.retro-funnel-bar-wrap {
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.retro-funnel-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 400ms ease;
  min-width: 4px;
}

.retro-funnel-stored { background: var(--accent); }
.retro-funnel-retrieved { background: #8B5CF6; }
.retro-funnel-referenced { background: #06B6D4; }
.retro-funnel-changed { background: var(--status-online); }

.retro-funnel-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.retro-funnel-drop {
  font-size: 10px;
  font-weight: 600;
  color: #EF4444;
  text-align: center;
}

/* Pattern card */
.retro-pattern-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--status-online);
}

.retro-pattern-flagged {
  border-left-color: #F59E0B;
}

.retro-pattern-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.retro-pattern-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.retro-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.retro-badge-new {
  background: rgba(16, 185, 129, 0.1);
  color: var(--status-online);
}

.retro-badge-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #F59E0B;
}

.retro-pattern-context {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.retro-confidence-bar-wrap {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  position: relative;
  margin: 6px 0 2px;
}

.retro-confidence-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
}

.retro-confidence-label {
  position: absolute;
  right: 0;
  top: -14px;
  font-size: 10px;
  color: var(--text-muted);
}

.retro-pattern-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.retro-tag {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Counterexample card */
.retro-counter-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 3px solid #EF4444;
}

.retro-counter-memory {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 4px;
}

.retro-counter-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.retro-counter-source {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Duplicate card */
.retro-dup-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: 6px;
  font-size: 12px;
}

.retro-dup-new {
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retro-dup-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

.retro-dup-existing {
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 11px;
  flex-shrink: 0;
}

.retro-dup-sim {
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Summary text */
.retro-summary-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Retro progress (reuses hardening styles) */
.harness-retro-progress {
  max-height: 200px;
  overflow-y: auto;
}

@media (max-width: 767px) {
  .retro-funnel-stage {
    grid-template-columns: 52px 1fr 28px 36px;
    gap: 4px;
  }

  .harness-retro-popup {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}
