/* ── Reset & base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #222636;
  --border: #2e3245;
  --accent: #5b7cf6;
  --accent-dim: #3a4e9e;
  --text: #e2e8f0;
  --text-dim: #8892a4;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

html {
  font-size: 15px;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

.hidden {
  display: none !important;
}

/* ── App shell ────────────────────────────────────────────────────────────── */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Results section breaks out of the narrow app container */
.results-section {
  max-width: 95vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding-left: 2.5vw;
  padding-right: 2.5vw;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.header__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #5b7cf6, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header__subtitle {
  margin-top: 0.4rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ── Search form ──────────────────────────────────────────────────────────── */
.search-section {
  max-width: 700px;
  margin: 0 auto 1.5rem;
}
.search-form {
  display: flex;
  gap: 0.75rem;
}
.search-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-input::placeholder {
  color: var(--text-dim);
}

.trust-line {
  margin-top: 0.6rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.8;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 0.7rem 1.3rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    opacity 0.15s,
    background 0.15s;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-dim);
}
.btn--outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-dim);
}
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--text);
}
.btn--sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

/* ── Example chips ────────────────────────────────────────────────────────── */
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
  align-items: center;
  justify-content: center;
}
.examples__label {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-right: 0.25rem;
}
.example-chip {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.example-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ── Pipeline tracker ────────────────────────────────────────────────────── */
.pipeline-tracker {
  max-width: 800px;
  margin: 1.5rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
}

.pipeline-stages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 1rem;
}

/* connector line behind stages */
.pipeline-stages::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 24px;
  right: 24px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  z-index: 1;
  position: relative;
}

.stage-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-size: 0.65rem;
}

.stage-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.3s;
}

.stage--done .stage-dot {
  background: var(--green);
  border-color: var(--green);
}
.stage--done .stage-dot::after {
  content: "✓";
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
}
.stage--done .stage-label {
  color: var(--green);
}

.stage--active .stage-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(91, 124, 246, 0.5);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.stage--active .stage-label {
  color: var(--accent);
  font-weight: 600;
}

.stage--pending .stage-dot {
  background: var(--bg);
  border-color: var(--border);
}
.stage--pending .stage-label {
  color: var(--text-dim);
  opacity: 0.5;
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 6px rgba(91, 124, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 14px rgba(91, 124, 246, 0.7);
  }
}

.pipeline-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.pipeline-query {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pipeline-query:empty {
  display: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.phase-label {
  color: var(--text-dim);
  font-size: 0.85rem;
}
.elapsed-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ── Error / no-results banners ──────────────────────────────────────────── */
.error-banner {
  max-width: 700px;
  margin: 1rem auto;
  background: #3b1a1a;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  color: var(--red);
  font-size: 0.9rem;
}
.error-banner__title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}
.error-detail {
  color: #fca5a5;
  font-size: 0.85rem;
  line-height: 1.5;
}
.error-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
  color: #fca5a5;
}

.no-results-banner {
  max-width: 700px;
  margin: 1rem auto;
  background: #2a2a1a;
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-size: 0.9rem;
}
.no-results-title {
  font-weight: 700;
  color: var(--yellow);
  margin-bottom: 0.35rem;
}
.no-results-query {
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.no-results-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  max-width: 600px;
  margin: 2rem auto;
  text-align: left;
}
.empty-state h2 {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}
.how-it-works {
  padding-left: 1.4rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 2;
}
.how-it-works strong {
  color: var(--text);
}

/* ── Summary strip ───────────────────────────────────────────────────────── */
.summary-strip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.2rem;
  margin-bottom: 1rem;
}
.summary-strip__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.summary-query {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.summary-query::before {
  content: "\201c";
  color: var(--accent);
}
.summary-query::after {
  content: "\201d";
  color: var(--accent);
}
.summary-strip__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
}
.summary-item {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.summary-item strong {
  color: var(--text);
  font-weight: 600;
}
.summary-item:first-child {
  background: #1e2a6e;
  color: #a5b4fc;
  border: 1px solid #3b4ea6;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-strip__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Collapsible panels ─────────────────────────────────────────────────── */
.panels-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel__header {
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  user-select: none;
  list-style: none;
}
.panel__header::marker,
.panel__header::-webkit-details-marker {
  display: none;
}
.panel__header::before {
  content: "▶ ";
  font-size: 0.65rem;
  margin-right: 0.3rem;
}
details[open] > .panel__header::before {
  content: "▼ ";
}
details[open] > .panel__header {
  color: var(--text);
}

.panel__body {
  padding: 0.65rem 1rem 1rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Retrieval plan specifics */
.plan-row {
  margin-bottom: 0.4rem;
}
.plan-label {
  color: var(--text-dim);
  font-weight: 600;
}
.plan-value {
  color: var(--text);
}
.plan-facets {
  margin-top: 0.5rem;
}
.plan-rerank {
  margin-top: 0.5rem;
}
.facet-list {
  padding-left: 1rem;
  margin-top: 0.3rem;
  line-height: 1.8;
}
.facet-type {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: #c7d2fe;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 0.3rem;
}
.facet-query {
  color: var(--text);
}
.facet-cols {
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* Quality controls */
.qc-list {
  list-style: none;
  padding: 0;
}
.qc-list li {
  padding: 0.3rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  line-height: 1.5;
}
.qc-icon {
  flex-shrink: 0;
  font-size: 0.75rem;
  width: 1.2em;
  text-align: center;
}

/* Stats table */
.stats-table {
  width: 100%;
}
.stats-table td {
  padding: 0.25rem 0;
}
.stats-label {
  color: var(--text-dim);
  padding-right: 1rem;
}
.stats-value {
  color: var(--text);
  font-weight: 500;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  opacity: 0.7;
}
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 80vh;
}
.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  table-layout: auto;
}
.results-table th {
  background: var(--bg-card);
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.results-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.results-table tr:last-child td {
  border-bottom: none;
}
.results-table tbody tr:nth-child(even) td {
  background: rgba(30, 34, 50, 0.45);
}
.results-table tbody tr:hover td {
  background: var(--bg-hover);
}

/* Column sizing by priority tier */
.col-pri-highest {
  min-width: 180px;
  max-width: 300px;
  font-weight: 500;
}
.col-pri-high {
  min-width: 140px;
  max-width: 260px;
}
.col-pri-medium {
  min-width: 110px;
  max-width: 200px;
}
.col-pri-low {
  min-width: 100px;
  max-width: 280px;
}

/* Wide schema overrides — tighten when 7+ columns */
.wide-schema .col-pri-highest {
  min-width: 140px;
  max-width: 240px;
}
.wide-schema .col-pri-high {
  min-width: 100px;
  max-width: 200px;
}
.wide-schema .col-pri-medium {
  min-width: 80px;
  max-width: 160px;
}
.wide-schema .col-pri-low {
  min-width: 70px;
  max-width: 200px;
}

/* Compact view — hide low-priority columns, tighten padding */
.table-compact .col-pri-low {
  display: none;
}
.table-compact td,
.table-compact th {
  padding: 0.4rem 0.6rem;
}
.table-compact .col-pri-medium {
  min-width: 70px;
  max-width: 140px;
}

.cell-filled {
  cursor: pointer;
  position: relative;
}
.cell-filled:hover .cell-value {
  color: var(--accent);
}
.cell-value {
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 16px);
  transition: color 0.15s;
}
.cell-empty {
  color: var(--border);
  user-select: none;
}

/* URL cells — monospace truncated display */
.cell-url {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  word-break: break-all;
  white-space: nowrap;
  opacity: 0.85;
}

/* Long text cells — multi-line clamp */
.cell-text-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.4;
  max-height: 2.8em;
}

.conf-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 0.35rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.conf-high {
  background: var(--green);
}
.conf-medium {
  background: var(--yellow);
}
.conf-low {
  background: var(--red);
}

.col-idx {
  color: var(--text-dim);
  font-size: 0.8rem;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: right;
}
.col-trust {
  min-width: 170px;
  max-width: 220px;
  white-space: normal;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin: 1px;
  white-space: nowrap;
}
.badge--green {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.badge--blue {
  background: rgba(96, 165, 250, 0.15);
  color: var(--blue);
  border: 1px solid rgba(96, 165, 250, 0.3);
}
.badge--yellow {
  background: rgba(251, 191, 36, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.25);
}
.badge--red {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.badge--neutral {
  background: rgba(136, 146, 164, 0.12);
  color: var(--text-dim);
  border: 1px solid rgba(136, 146, 164, 0.2);
}
.badge--dim {
  background: rgba(136, 146, 164, 0.08);
  color: var(--text-dim);
  border: 1px solid rgba(136, 146, 164, 0.15);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 560px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
.modal__close:hover {
  color: var(--text);
}

.modal__header-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.modal__col-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}
.modal__source-badge {
  font-size: 0.7rem;
}

.modal__value-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.modal__value {
  font-size: 1.25rem;
  font-weight: 600;
  word-break: break-word;
  line-height: 1.3;
}
.modal__conf {
  font-size: 0.78rem;
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
}
.modal__conf.conf-high {
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.modal__conf.conf-medium {
  background: rgba(251, 191, 36, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.25);
}
.modal__conf.conf-low {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.modal__divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.modal__field {
  margin-bottom: 1rem;
}
.modal__field-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}
.modal__snippet {
  border-left: 3px solid var(--accent);
  padding: 0.65rem 0.85rem;
  background: rgba(91, 124, 246, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.6;
  word-break: break-word;
}
.modal__source-url {
  display: block;
  font-size: 0.85rem;
  word-break: break-all;
  margin-bottom: 0.25rem;
}
.modal__source-title {
  color: var(--text-dim);
  font-size: 0.82rem;
}
.modal__flags {
  margin-top: 0.5rem;
}
.flag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius);
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
  margin-right: 0.3rem;
}

.req-summary-panel {
  margin-bottom: 0.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(180deg, rgba(91, 124, 246, 0.08), rgba(91, 124, 246, 0.03)),
    var(--bg-card);
}
.req-summary-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.req-summary-subtitle {
  margin-top: 0.18rem;
  margin-bottom: 0.55rem;
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* ── Requirement filter bar ───────────────────────────────────────────────── */
.req-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
.req-filter-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-right: 0.15rem;
}
.req-filter-btn {
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}
.req-filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.req-filter-btn--active {
  background: rgba(91, 124, 246, 0.15);
  border-color: var(--accent);
  color: #c7d2fe;
  font-weight: 600;
}
.req-sort-note {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-left: auto;
  opacity: 0.75;
  white-space: nowrap;
}

/* ── Requirement satisfaction indicator (inside name cell) ───────────────── */
.req-sat {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.68rem;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  cursor: default;
  font-weight: 500;
  white-space: nowrap;
  width: fit-content;
}
.req-sat--green {
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.req-sat--orange {
  background: rgba(251, 191, 36, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.22);
}
.req-sat--red {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.22);
}
.req-sat--unknown {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-dim);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

/* ── Requirement hover tooltip ───────────────────────────────────────────── */
.req-tooltip {
  position: fixed;
  z-index: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.76rem;
  line-height: 1.6;
  min-width: 200px;
  max-width: 340px;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.req-tooltip-group + .req-tooltip-group {
  margin-top: 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.req-tooltip-heading {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.22rem;
}
.req-tooltip-sat {
  color: var(--green);
  margin-bottom: 0.35rem;
}
.req-tooltip-unsat {
  color: var(--red);
  margin-bottom: 0.35rem;
}
.req-tooltip-unknown {
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}
.req-tooltip-reason {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.1rem;
  font-style: italic;
}
.req-tooltip-matched {
  font-size: 0.7rem;
  opacity: 0.75;
  margin-top: 0.1rem;
}
.req-tooltip-evidence {
  font-size: 0.67rem;
  opacity: 0.65;
  margin-top: 0.1rem;
  font-style: italic;
  line-height: 1.4;
  border-left: 2px solid var(--border);
  padding-left: 0.4rem;
}
.req-tooltip-source {
  font-size: 0.66rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.rank-tooltip {
  position: fixed;
  z-index: 610;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  min-width: 260px;
  max-width: 420px;
  max-height: min(60vh, 520px);
  overflow: auto;
  pointer-events: none;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}
.rank-tooltip-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.rank-tooltip-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}
.rank-tooltip-score {
  font-size: 0.76rem;
  color: var(--accent-soft);
}
.rank-tooltip-meta {
  margin-top: 0.18rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.rank-tooltip-table {
  margin-top: 0.55rem;
  border-top: 1px solid var(--border);
  padding-top: 0.45rem;
}
.rank-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.16rem 0;
}
.rank-tooltip-label {
  font-size: 0.72rem;
  color: var(--text);
}
.rank-tooltip-value {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.badge--rank {
  cursor: help;
}

/* ── Requirements block inside Run Stats panel ───────────────────────────── */
.req-section {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}
.req-section-header {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}
.req-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.req-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.13rem 0.48rem;
  border-radius: 999px;
  background: rgba(91, 124, 246, 0.1);
  color: #a5b4fc;
  border: 1px solid rgba(91, 124, 246, 0.25);
  font-size: 0.72rem;
  font-weight: 500;
}
.req-badge--hard {
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.2);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .search-form {
    flex-direction: column;
  }
  .results-section {
    max-width: 100vw;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  .summary-strip {
    flex-direction: column;
    align-items: flex-start;
  }
  .summary-strip__top {
    flex-direction: column;
    align-items: flex-start;
  }
  .summary-strip__actions {
    width: 100%;
  }
  .panels-row {
    grid-template-columns: 1fr;
  }
  .pipeline-stages {
    gap: 0.1rem;
  }
  .stage-label {
    font-size: 0.55rem;
  }
  .stage-dot {
    width: 18px;
    height: 18px;
  }
}
