/* QA Runs */
.qa-runs-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.qa-runs-page.policy-detail-view {
  overflow: visible;
  flex: none;
  min-height: auto;
}
.qa-runs-page .page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.qa-runs-page .page-head h1 { margin: 0; font-size: 21px; font-weight: 600; }
.qa-runs-page .page-head-lead { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: none; }

.qa-runs-list-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* KPI cards */
.qa-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 760px) { .qa-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.qa-kpi-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--panel);
}
.qa-kpi-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.qa-kpi-card-head svg { width: 18px; height: 18px; color: var(--muted); }
.qa-kpi-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.qa-kpi-value { font-size: 26px; font-weight: 700; margin: 0; line-height: 1.1; }
.qa-kpi-hint { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.qa-kpi-card--passed .qa-kpi-value { color: #2d6b3a; }
.qa-kpi-card--failed .qa-kpi-value { color: #9b3b30; }
.qa-kpi-card--pending .qa-kpi-value { color: var(--muted); }

/* Progress bar */
.qa-progress-wrap { margin-bottom: 20px; }
.qa-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #eae8e4;
  overflow: hidden;
  display: flex;
}
.qa-progress-seg { height: 100%; transition: width 0.3s; }
.qa-progress-seg--passed { background: #5cb176; }
.qa-progress-seg--failed { background: #e06b5e; }
.qa-progress-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.qa-progress-legend span::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.qa-legend-passed::before { background: #5cb176; }
.qa-legend-failed::before { background: #e06b5e; }
.qa-legend-pending::before { background: #d4d2cd; }

/* Badges */
.qa-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.qa-badge--open { background: #dbeafe; color: #1d4ed8; }
.qa-badge--passed { background: #edf7ef; color: #2d6b3a; }
.qa-badge--failed { background: #fdf0f0; color: #9b3b30; }
.qa-badge--closed { background: #f1f5f9; color: #475569; }
.qa-badge--pending { background: #f5f5f4; color: #706f6a; }
.qa-badge--in_progress { background: #fef9c3; color: #854d0e; }

/* Mini progress in list */
.qa-mini-progress { display: inline-flex; align-items: center; gap: 6px; }
.qa-mini-bar { width: 60px; height: 6px; border-radius: 999px; background: #eae8e4; overflow: hidden; display: flex; }
.qa-mini-bar .seg-p { background: #5cb176; height: 100%; }
.qa-mini-bar .seg-f { background: #e06b5e; height: 100%; }
.qa-mini-text { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Result banner */
.qa-result-banner {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.qa-result-banner--passed { background: #edf7ef; border: 1px solid #b8d4be; }
.qa-result-banner--failed { background: #fdf0f0; border: 1px solid #e8b8b8; }
.qa-result-banner-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.qa-result-banner--passed .qa-result-banner-icon { background: #2d6b3a; color: #fff; }
.qa-result-banner--failed .qa-result-banner-icon { background: #9b3b30; color: #fff; }
.qa-result-banner h3 { margin: 0; font-size: 14px; font-weight: 700; }
.qa-result-banner--passed h3 { color: #2d6b3a; }
.qa-result-banner--failed h3 { color: #9b3b30; }
.qa-result-banner p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

/* Scenario cards (decision-card style) */
.qa-scenario-cards {
  margin-bottom: 20px;
}
.qa-cards-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  table-layout: fixed;
}
.qa-cards-table tbody tr.qa-scenario-card td {
  background: var(--decision-card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  vertical-align: top;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  word-break: break-word;
}
.qa-cards-table tbody tr.qa-scenario-card:hover td {
  background: var(--decision-card-bg-hover, var(--panel-soft));
  border-color: var(--border-strong, #ccc);
}
.qa-cards-table tbody tr.qa-scenario-card--expanded td {
  background: #f9f8f6;
  border-color: var(--border-strong, #ccc);
}

/* Card content layout */
.qa-card-content {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.qa-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.qa-card-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--panel-soft, #f5f3ef);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.qa-card-title {
  margin: 0;
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.45;
  color: var(--td-color, var(--text));
  padding-top: 1px;
}
.qa-card-head .qa-badge {
  flex-shrink: 0;
  margin-top: 2px;
}
.qa-card-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--td-secondary-color, var(--subtle));
  padding-left: 34px;
}
.qa-card-meta {
  margin: 0;
  font-size: 11px;
  color: #7a7974;
  line-height: 1.35;
  padding-left: 34px;
}
.qa-card-source,
.qa-card-tester {
  font-size: 11px;
}

/* Note display in cards */
.qa-note-display {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
  padding-left: 34px;
}
.qa-note-display::before { content: "Note: "; font-weight: 600; font-style: normal; }

/* Scenario expanded (inside card) */
.qa-scenario-expanded {
  margin-top: 10px;
  padding-top: 10px;
  padding-left: 34px;
  border-top: 1px solid var(--border);
}
.qa-scenario-notes textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  background: var(--panel);
  color: var(--text);
}
.qa-scenario-notes textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.qa-scenario-notes-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 5px; }
.qa-scenario-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn-pass { background: #edf7ef; border-color: #b8d4be; color: #2d6b3a; font-weight: 600; }
.btn-pass:hover { background: #d4edda; }
.btn-fail { background: #fdf0f0; border-color: #e8b8b8; color: #9b3b30; font-weight: 600; }
.btn-fail:hover { background: #f8d7d7; }
.btn-reset { background: #f5f5f4; border-color: #d4d4d4; color: #525252; font-weight: 600; }
.btn-reset:hover { background: #e7e5e4; }

/* Participants */
.qa-participants {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.qa-participant-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--subtle);
}
.qa-participant-pill--owner { border-color: var(--accent); background: rgba(201, 169, 98, 0.1); }

/* Detail header */
.qa-detail-header { margin-bottom: 20px; }
.qa-detail-header h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.qa-detail-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.qa-detail-description { margin: 6px 0 0; font-size: 14px; color: var(--subtle); line-height: 1.5; }

/* Floating selection bar */
.qa-selection-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  z-index: 50;
}
.qa-selection-bar .btn {
  height: 30px; min-height: 30px;
  font-size: 12.5px;
  border-color: rgba(255,255,255,0.3);
  color: #fff;
  background: rgba(255,255,255,0.12);
}
.qa-selection-bar .btn:hover { background: rgba(255,255,255,0.2); }

/* Decision picker in create modal */
.qa-decision-picker {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--panel-soft);
}
.qa-pick-topic {
  padding: 8px 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.qa-pick-topic:first-child { padding-top: 0; }
.qa-pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--subtle);
  border-top: 1px solid var(--border);
}
.qa-pick-item:first-child { border-top: none; }
.qa-pick-actions .btn-sm {
  height: 26px;
  min-height: 26px;
  font-size: 11.5px;
  padding: 0 10px;
}

/* Tab bar for topic selection */
.qa-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.qa-tab-btn {
  padding: 5px 12px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}
.qa-tab-btn:hover {
  border-color: var(--accent-deep);
  color: var(--text);
}
.qa-tab-btn.active {
  background: var(--accent-deep);
  color: #fff;
  border-color: var(--accent-deep);
}
.qa-tab-inherited {
  font-style: italic;
}
.qa-pick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

/* Inherit-picker override for QA modal */
#qaCreateRunModal .inherit-picker,
#qaAssigneePickerWrap {
  display: grid;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  background: var(--panel-soft, #f5f3ef);
}
#qaCreateRunModal .inherit-picker-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, #ddd);
  cursor: pointer;
  margin: 0;
  font-family: inherit;
}
#qaCreateRunModal .inherit-picker-row:last-child { border-bottom: 0; }
#qaCreateRunModal .inherit-picker-row:hover { background: var(--panel, #fff); }
#qaCreateRunModal .inherit-picker-row input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--text);
}
#qaCreateRunModal .inherit-picker-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
#qaCreateRunModal .inherit-picker-name {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
  text-transform: none;
  word-break: break-word;
}
#qaCreateRunModal .inherit-picker-meta {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  text-transform: none;
}

/* QA modal close button override — lighter style */
#qaCreateRunModal .reco-modal-close,
#qaAssignModal .reco-modal-close,
#qaAddScenariosModal .reco-modal-close {
  background: var(--panel, #fff);
  color: var(--text, #333);
  border-color: var(--border-strong, #ccc);
}
#qaCreateRunModal .reco-modal-close:hover,
#qaAssignModal .reco-modal-close:hover,
#qaAddScenariosModal .reco-modal-close:hover {
  background: var(--panel-soft, #f5f3ef);
  color: var(--text, #333);
  border-color: var(--text, #333);
  opacity: 1;
}

