:root {
  color-scheme: light;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef3f1;
  --ink: #14181f;
  --muted: #64707d;
  --soft: #8a94a1;
  --line: #d9dfe6;
  --line-strong: #c3ccd5;
  --nav: #18212b;
  --nav-2: #202b37;
  --accent: #0f6b5e;
  --accent-2: #274c9a;
  --good: #157647;
  --bad: #bd3b36;
  --warn: #9a6a00;
  --shadow: 0 18px 46px rgba(30, 41, 55, 0.10);
  --shadow-soft: 0 8px 24px rgba(30, 41, 55, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Aptos", "IBM Plex Sans", "Helvetica Neue", sans-serif;
  letter-spacing: 0;
  margin: 0;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 750;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:not(.secondary-button, .icon-button, .tab, .request-row, .history-row, .thumb, .small-button, .outline-good, .outline-bad, .request-list-card, .latest-feed-card, .contender-item, .contender-filter button, .run-chip, .link-button) {
  background: var(--ink);
  color: #fff;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-width: 0;
  outline: none;
  padding: 10px 11px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 107, 94, 0.12);
}

textarea {
  line-height: 1.45;
  resize: vertical;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 23px;
  line-height: 1.12;
  margin-bottom: 0;
}

h2 {
  font-size: 13px;
  letter-spacing: 0.02em;
  margin-bottom: 0;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.app-nav {
  background: linear-gradient(180deg, var(--nav), var(--nav-2));
  color: #dce4ec;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: #f5f8f7;
  border-radius: 10px;
  color: var(--nav);
  display: inline-flex;
  font-weight: 850;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup span {
  color: #9dacba;
  font-size: 12px;
  margin-top: 2px;
}

.nav-stack {
  display: grid;
  gap: 5px;
}

.nav-link {
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: #b9c5d0;
  display: block;
  font-size: 13px;
  font-weight: 720;
  justify-content: flex-start;
  min-height: 0;
  padding: 10px 11px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.nav-link:focus {
  outline: none;
}

.nav-link:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: none;
}

.app-main {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(238, 241, 244, 0.88);
  border-bottom: 1px solid rgba(195, 204, 213, 0.72);
  backdrop-filter: blur(18px);
  display: flex;
  justify-content: space-between;
  padding: 18px 22px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.workspace {
  display: block;
  padding: 18px 22px 28px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.page-heading {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto 16px;
  max-width: 1180px;
}

.page-heading h2 {
  color: var(--ink);
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
}

.request-workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: 340px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1180px;
}

.request-workspace.edit-mode {
  grid-template-columns: minmax(0, 860px);
  max-width: 900px;
}

.request-workspace.edit-mode .selected-request-panel {
  display: none;
}

/* Review mode: single full-width column. The request summary becomes a compact
   top bar (not a tall left sidebar) so the recommendations get the full width. */
.request-workspace.review-mode {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1320px;
}

.request-workspace.review-mode .selected-request-panel {
  max-height: none;
  overflow: visible;
  position: static;
  top: auto;
}

/* Review-mode context card = the "frozen" control-panel sibling of the new-run
   form: green accent strip, tinted header band, entity meta as read-only fields,
   then the full-width context, re-run, and ask history stacked below. */
.request-workspace.review-mode .selected-request-card {
  display: block;
  padding: 0;                              /* header band bleeds to the edges */
  overflow: hidden;
  border-top: 3px solid var(--accent);     /* green control-panel accent */
  box-shadow: var(--shadow);
}
.request-workspace.review-mode .selected-card-top {
  background: var(--surface-3);            /* light green-grey header */
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  margin: 0;
}
/* body blocks get consistent side padding (card padding is 0 for the header bleed) */
.request-workspace.review-mode .selected-request-card > :not(.selected-card-top) {
  padding-left: 18px;
  padding-right: 18px;
}
.request-workspace.review-mode .selected-request-card > :last-child { padding-bottom: 18px; }

/* entity meta rendered as read-only form fields, 2-up (entity spans full width) */
.request-workspace.review-mode .selected-card-actions { margin-top: 14px; }
.card-top-date { color: var(--muted); font-size: 11.5px; font-weight: 600; margin-top: 3px; }

/* Clickable Request Context header (collapses the box to just this bar); chevron left */
.request-workspace.review-mode .selected-card-top {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}
.request-workspace.review-mode .selected-card-top strong { display: block; font-size: 15px; }
.ctx-collapse-chevron { color: var(--muted); flex: none; font-size: 13px; }
.selected-request-card.collapsed .card-body { display: none; }
.selected-request-card.collapsed .selected-card-top { border-bottom: none; }

/* Recommendations pane mirrors the Request Context card: green accent strip on top,
   a full-width green banner, then a padded body. */
.request-workspace.review-mode .run-pane {
  border-top: 3px solid var(--accent);
  padding: 0;
}
.request-workspace.review-mode .run-pane > .pane-heading { display: none; }  /* green bar replaces it */
.request-workspace.review-mode .run-pane > #runProgress:not(.hidden),
.request-workspace.review-mode .run-pane > #bulkActions:not(.hidden) { margin: 14px 16px; }
.section-head-bar {
  background: var(--surface-3);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}
.section-head-bar strong { display: block; font-size: 15px; }
.rec-body { padding: 14px 16px 4px; }
/* Each column scrolls independently and bounded, so the page doesn't run forever and
   the two tiers move separately; hitting the bottom unlocks the next batch. */
.rec-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
}
.rec-more {
  cursor: default;
  padding: 12px 6px;
  text-align: center;
}
.rec-more .rationale-generating { justify-content: center; }
.rec-end {
  color: var(--muted);
  font-size: 11px;
  padding: 10px 6px;
  text-align: center;
}

.request-gallery {
  display: block;
  margin: 0 auto;
  max-width: 1180px;
}

.request-home-actions {
  align-items: center;
  background: linear-gradient(145deg, #17212b, #263342);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  color: #fff;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 18px;
}

.request-home-actions div {
  display: grid;
  gap: 5px;
}

.request-home-actions span {
  color: #9ed1c8;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.request-home-actions strong {
  font-size: 20px;
  line-height: 1.15;
}

.request-home-actions small {
  color: #b8c5d1;
  font-weight: 560;
  line-height: 1.45;
}

.request-home-actions button {
  background: #f7fbfa;
  color: #17212b;
  flex: 0 0 auto;
}

.rec-feed-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: 0.7fr 0.7fr 1.6fr;
  margin-bottom: 14px;
}

.rec-feed-summary > div,
.rec-feed-summary > button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 13px;
  text-align: left;
}

.rec-feed-summary > button {
  align-items: stretch;
  color: var(--ink);
  display: block;
  min-height: 0;
}

.rec-feed-summary > button:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.rec-feed-summary span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rec-feed-summary strong {
  display: block;
  font-size: 26px;
  line-height: 1;
  margin-top: 7px;
}

.rec-feed-summary small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  margin-top: 6px;
}

.rec-feed-summary .latest-feed-card {
  background: linear-gradient(145deg, #fbfcfd, #edf4f1);
  border-color: #cfe0dc;
}

.latest-feed-card strong {
  font-size: 18px;
  line-height: 1.2;
}

.request-index-toolbar {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 12px;
}

.request-index-toolbar strong,
.request-index-toolbar span {
  display: block;
}

.request-index-toolbar span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.index-controls {
  align-items: end;
  display: flex;
  gap: 9px;
}

.index-controls label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 780;
  gap: 5px;
  text-transform: uppercase;
}

.index-controls select {
  min-height: 36px;
  min-width: 160px;
  padding-bottom: 7px;
  padding-top: 7px;
}

.request-index {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.request-list-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  padding: 18px;
  text-align: left;
  width: 100%;
}

.request-list-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.request-list-card {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  min-height: 0;
  overflow: hidden;
}

.request-list-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.request-list-head span {
  background: #edf4f1;
  border-radius: 999px;
  color: var(--accent);
  display: block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  padding: 6px 8px;
  width: fit-content;
  text-transform: uppercase;
}

.request-list-head strong {
  display: block;
  font-size: 17px;
  line-height: 1.22;
}

.request-list-head em {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 12px;
  font-style: normal;
  font-weight: 680;
  padding-top: 2px;
}

.request-list-main dl {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0 0;
}

.request-list-main dt,
.request-top-recs > span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.request-list-main dd {
  color: #29323d;
  font-size: 12px;
  font-weight: 700;
  margin: 4px 0 0;
}

.request-top-recs {
  background: linear-gradient(180deg, #f7f9fb, #f1f5f4);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
}

.request-top-recs p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.top-rec {
  align-items: center;
  background: #fff;
  border: 1px solid #e4e9ee;
  border-radius: 9px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 6px 8px;
}

/* Both-tiers preview: top 8 of each tier, side by side. */
.top-rec-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.top-rec-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.top-rec-coltitle {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--soft); padding-left: 2px;
}
.top-rec-col .top-rec strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-rec strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.top-rec small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 560;
  line-height: 1.3;
  margin-top: 3px;
}

.top-rec span {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 750;
}

.pane {
  background: var(--surface);
  border: 1px solid rgba(217, 223, 230, 0.95);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  min-height: 0;
  overflow: hidden;
  padding: 16px;
}

.selected-request-panel {
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow: auto;
  position: sticky;
  top: 88px;
}

.selected-request-card {
  animation: selected-card-in 260ms ease both;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.selected-card-top span {
  background: #edf4f1;
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding: 6px 8px;
  text-transform: uppercase;
}

.selected-card-top strong {
  display: block;
  font-size: 19px;
  line-height: 1.18;
}

.selected-request-card dl {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.selected-request-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selected-request-card dd {
  color: #29323d;
  font-size: 12px;
  font-weight: 720;
  margin: 3px 0 0;
}

.selected-request-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.selected-card-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

@keyframes selected-card-in {
  from {
    opacity: 0;
    transform: translate(28px, 18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

.entity-pane,
.metrics-pane {
  margin: 0 auto;
  max-width: 1180px;
}

/* Run pane fills the review-mode workspace width (no narrow cap). */
.run-pane {
  margin: 0 auto;
  max-width: none;
}

.request-main {
  display: grid;
  gap: 16px;
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.summary-grid div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.summary-grid strong {
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

.summary-context {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 12px 0 0;
}

.summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pane-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 4px 0 0;
}

.request-list,
.entity-layer-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding-right: 6px;
}

.request-row,
.history-row {
  align-items: flex-start;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  display: grid;
  gap: 4px;
  justify-content: stretch;
  padding: 11px;
  text-align: left;
  width: 100%;
}

.request-row {
  border-radius: 10px;
}

.request-row span,
.history-row span {
  font-weight: 780;
}

.request-row small,
.history-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 1.35;
}

.request-row.active,
.request-row:hover,
.history-row.active,
.history-row:hover {
  background: #f3f7f6;
  border-color: #cfe0dc;
}

.request-form {
  display: grid;
  gap: 13px;
}

.field,
.type-grid {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 760;
  gap: 7px;
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.type-grid {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 12px;
}

.type-grid legend {
  color: var(--muted);
  padding: 0 6px;
}

.type-grid label {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
}

.editor-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 2px;
}

.secondary-button,
.icon-button,
.small-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover,
.icon-button:hover,
.small-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.compact-select {
  max-width: 220px;
}

.status-pill,
.type-pill,
.score-pill,
.stage-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.status-pill {
  background: #e7f3ef;
  color: var(--accent);
}

.type-pill {
  background: #eef1f4;
  color: #52606d;
}

.score-pill {
  background: #e8f4ed;
  color: var(--good);
}

.tabs {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 13px;
  padding: 4px;
}

.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  min-height: 34px;
  padding: 8px 10px;
}

.tab.active {
  background: #fff;
  box-shadow: 0 1px 6px rgba(30, 41, 55, 0.08);
  color: var(--ink);
}

.bulk-actions {
  align-items: center;
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto auto;
  margin-bottom: 12px;
  padding: 10px;
}

.bulk-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.outline-good,
.outline-bad,
.thumb {
  background: #fff;
}

.outline-good,
.thumb.good {
  border-color: rgba(21, 118, 71, 0.45);
  color: var(--good);
}

.outline-bad,
.thumb.bad {
  border-color: rgba(189, 59, 54, 0.45);
  color: var(--bad);
}

.recommendation-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 290px;
  margin-bottom: 10px;
}

.rec-display-card,
.rec-action-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(30, 41, 55, 0.05);
}

.rec-display-card {
  padding: 12px;
}

.rec-action-card {
  align-self: stretch;
  display: grid;
  gap: 8px;
  padding: 10px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.rec-action-card.is-good {
  background: #edf9f1;
  border-color: rgba(21, 118, 71, 0.52);
  box-shadow: 0 0 0 4px rgba(21, 118, 71, 0.12), 0 12px 24px rgba(21, 118, 71, 0.12);
}

.rec-action-card.is-bad {
  background: #fff0ef;
  border-color: rgba(189, 59, 54, 0.52);
  box-shadow: 0 0 0 4px rgba(189, 59, 54, 0.12), 0 12px 24px rgba(189, 59, 54, 0.12);
}

.recommendation-row:hover .rec-display-card,
.recommendation-row:hover .rec-action-card {
  border-color: var(--line-strong);
}

.rec-head,
.entity-card-head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.rec-title-group {
  align-items: flex-start;
  display: flex;
  gap: 9px;
}

.rec-check {
  padding-top: 2px;
}

.rec-title {
  font-size: 14px;
  font-weight: 850;
  margin-bottom: 2px;
}

.rec-meta,
.entity-card p,
.feedback-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.score-block {
  display: flex;
  gap: 6px;
}

/* per-card quick links: Contender profile + inline AI entity-card popover */
.rec-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rec-links .rec-link {
  align-items: center;
  background: var(--surface-2) !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  box-sizing: border-box;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  gap: 5px;
  height: 26px;
  line-height: 1;
  letter-spacing: 0;
  margin: 0;
  min-height: 0;
  padding: 0 10px;
  text-decoration: none;
}
.rec-links .rec-link svg { flex: none; opacity: 0.85; }
.rec-links .rec-link:hover { background: #eef3f1 !important; border-color: #1e6fd9; color: #0f6b5e; }

/* inline entity-card modal */
.entity-card-modal { max-width: 720px; width: 92%; }
.ecm-head { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 10px; }
.ecm-head strong { font-size: 16px; }
.ecm-card { max-height: 48vh; overflow: auto; }

/* "Card sources" — provenance per section in the entity-card view */
.card-sources { margin-top: 12px; }
.card-sources > summary { color: #1e6fd9; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.cs-section { margin-top: 10px; }
.cs-section-name {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.cs-row {
  align-items: baseline;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 5px 0;
}
.cs-text { color: #3a4150; font-size: 12px; line-height: 1.4; }
.cs-srcs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

.rationale-headline {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  margin: 9px 0 2px;
}

.rationale-list {
  color: #303943;
  display: grid;
  font-size: 12px;
  gap: 5px;
  line-height: 1.4;
  margin: 6px 0 0;
  padding-left: 18px;
}

.rationale-pending { color: var(--muted); font-size: 12px; margin: 9px 0 0; }
.rationale-generating { align-items: center; color: var(--accent); display: inline-flex; font-size: 12px; gap: 7px; }
.mini-spinner {
  animation: mini-spin 0.7s linear infinite;
  border: 2px solid rgba(15, 107, 94, 0.25);
  border-radius: 50%;
  border-top-color: var(--accent);
  display: inline-block;
  height: 11px;
  width: 11px;
}
@keyframes mini-spin { to { transform: rotate(360deg); } }

/* per-bullet source citation chip (honest, document-level) */
.src-cite {
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  text-decoration: none;
  white-space: nowrap;
}
.src-cite.src-contender { background: #eef3f1; color: #0f6b5e; }
.src-cite.src-notion { background: #eef0fb; color: #3a44a0; }
a.src-cite:hover { text-decoration: underline; }
.src-cite.src-nolink { cursor: default; }   /* type label, not a link */

.rationale-caution {
  background: #fbf6ec;
  border-left: 3px solid #d8a13a;
  border-radius: 0 6px 6px 0;
  color: #6b5526;
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 8px;
  padding: 6px 9px;
}
.rationale-caution strong { color: #8a6d1f; }

.rationale-sources {
  color: var(--muted);
  font-size: 11px;
  margin-top: 8px;
}
.rationale-sources a { color: var(--accent-2); }

.source-ref {
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 850;
  margin-left: 3px;
  text-decoration: none;
  vertical-align: super;
}

.source-ref:hover {
  text-decoration: underline;
}

.rec-action-card > div:first-child span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rec-action-card > div:first-child strong {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.source-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.source-chip,
.tag-row span {
  background: #f4f6f8;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4c5967;
  font-size: 11px;
  font-weight: 720;
  padding: 5px 7px;
  text-decoration: none;
}

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

.feedback-row,
.feedback-composer {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.recommendation-action-row,
.feedback-actions {
  display: flex;
  gap: 6px;
  margin-top: 11px;
}

.recommendation-action-row button {
  flex: 1 1 0;
  font-size: 11px;
  min-height: 32px;
  padding: 6px 7px;
}

.recommendation-action-row .outline-good {
  background: #15814d;
  border-color: #15814d;
  color: #fff;
}

.recommendation-action-row .outline-bad {
  background: #c9433d;
  border-color: #c9433d;
  color: #fff;
}

.recommendation-action-row .outline-good:hover,
.recommendation-action-row .outline-bad:hover {
  filter: brightness(1.03);
  transform: translateY(-2px) rotate(-1deg);
}

.recommendation-action-row .outline-bad:hover {
  transform: translateY(-2px) rotate(1deg);
}

.feedback-composer {
  margin-top: 0;
}

.feedback-composer textarea {
  min-height: 80px;
  padding: 8px;
}

.feedback-composer div {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1fr;
}

.feedback-note {
  background: #f6f8fa;
  border-left: 3px solid var(--line-strong);
  border-radius: 8px;
  margin-top: 10px;
  padding: 8px 10px;
}

.run-progress {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.progress-step,
.stage-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 11px;
}

.progress-step p,
.stage-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 4px 0 0;
}

.progress-step.running {
  border-color: rgba(15, 107, 94, 0.38);
  box-shadow: inset 3px 0 0 var(--accent);
}

.progress-step.complete {
  box-shadow: inset 3px 0 0 var(--good);
}

.stage-row {
  grid-template-columns: auto 1fr auto;
  margin-bottom: 8px;
}

/* Live engine trace (SSE). A linear, scrollable log of real backend phases. */
.run-log {
  background: #0f1c19;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #d7e4df;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
}

.run-log-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.run-log-line.is-phase {
  color: #7fd1be;
  font-weight: 600;
  margin-top: 8px;
}

.run-log-line.is-detail {
  color: #9fb2ac;
  padding-left: 14px;
}

/* Run selector (segmented control at the top of the run pane) */
.runs-bar {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
}

.runs-bar-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.runs-bar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Inactive chips are uniform gray (no special "Latest" coloring); only the selected
   chip is highlighted. */
.run-chip {
  background: #f4f5f7;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  gap: 1px;
  justify-items: start;
  padding: 6px 12px;
  text-align: left;
}

.run-chip strong { color: var(--muted); font-size: 13px; }
.run-chip span { color: var(--muted); font-size: 11px; }

.run-chip.active {
  background: #e7f4ec;
  border-color: #9bcfb1;
}

.run-chip.active strong { color: #1f6b4e; }
.run-chip.active span { color: #2f7a52; }

/* In-flight run chip — dashed border + spinner until recs land */
.run-chip.running { border-style: dashed; }
.run-spinner {
  animation: run-spin 0.7s linear infinite;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  border-top-color: var(--accent);
  display: inline-block;
  height: 9px;
  margin-right: 4px;
  vertical-align: -1px;
  width: 9px;
}
@keyframes run-spin { to { transform: rotate(360deg); } }

/* Section names — hidden until the dev toggle is on, then a tiny blue caption */
body.show-section-labels [data-section] { position: relative; }
body.show-section-labels [data-section]::before {
  content: attr(data-section);
  color: #1e6fd9;
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

/* Lock review-mode sections to one consistent width so the recs never resize
   relative to the context panel above them. */
.request-workspace.review-mode > * { min-width: 0; width: 100%; }
.request-workspace.review-mode .run-pane,
.request-workspace.review-mode .request-main { min-width: 0; width: 100%; }

/* REQUEST CONTEXT: editable / frozen context + re-run control */
.ctx-field { display: block; margin: 14px 0 6px; }
.ctx-label { color: var(--ink); display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.ctx-hint { color: var(--muted); font-size: 11px; font-weight: 500; }
.ctx-frozen { color: #8a6d1f; }
.ctx-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}
.ctx-readonly {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #3a4150;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  white-space: pre-wrap;
}
.rerun-row { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }

.selected-request-card .link-button {
  background: none;
  border: none;
  box-shadow: none;
  color: #1e6fd9;
  display: inline;
  font-size: 12px;
  font-weight: 600;
  height: auto;
  letter-spacing: 0;
  padding: 0;
  width: auto;
}

/* Uniform labeled mini-sections (Requesting entity / Requesting entity info /
   Recommending) — consistent subheader + boxed value, 2-up grid. */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0 0;
}
.info-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.info-field.half { grid-column: span 1; }
.info-field.full { grid-column: 1 / -1; }
.info-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.info-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 11px;
}
.info-box.requestor-box { font-weight: 400; padding: 0; }

/* Requestor info = the full entity card text, untruncated (scrolls if long). */
.rd-card {
  color: #3a4150;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Ask-history timeline (oldest → newest), shown only on the latest run when a prior
   run exists. Each node = a run's context + the feedback it drew; arrows = re-runs. */
.ctx-history { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.ctx-history-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-transform: uppercase;
}
/* Light, non-interactive bubbles joined by a thin connector line. */
.ctx-timeline { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.tl-card {
  background: #f7f8fa;
  border: 1px solid #e7eaef;
  border-radius: 9px;
  display: block;
  padding: 7px 10px;
}
.tl-head { align-items: baseline; display: flex; gap: 8px; justify-content: space-between; }
.tl-head strong { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.tl-head span { color: var(--muted); font-size: 10.5px; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0; }
.tl-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 7px;
}
.tl-chip.up { background: #eef7f1; border-color: #cfe6d7; color: #2f7a52; }
.tl-chip.down { background: #fbeeed; border-color: #ecd0cd; color: #a64640; }
.tl-nofeedback { color: var(--muted); font-size: 10.5px; font-style: italic; margin: 5px 0; }
.tl-ctx {
  color: #7a828d;
  display: -webkit-box;
  font-size: 11.5px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
/* thin vertical line connecting consecutive run bubbles */
.tl-line {
  background: #aab2bd;
  height: 14px;
  margin: 0 auto;
  width: 1px;
}

/* Dev-mode slider, fixed bottom-left — reveals the section names */
.dev-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  bottom: 16px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: inline-flex;
  gap: 7px;
  left: 16px;
  padding: 5px 11px 5px 7px;
  position: fixed;
  z-index: 50;
}
.dev-toggle-track {
  background: #d7dce3;
  border-radius: 999px;
  height: 14px;
  position: relative;
  transition: background 140ms ease;
  width: 26px;
}
.dev-toggle-knob {
  background: #fff;
  border-radius: 50%;
  height: 10px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: left 140ms ease;
  width: 10px;
}
.dev-toggle-text { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.dev-toggle.on .dev-toggle-track { background: #1e6fd9; }
.dev-toggle.on .dev-toggle-knob { left: 14px; }
.dev-toggle.on .dev-toggle-text { color: #1e6fd9; }

/* Historical run = read-only, grayed archive */
.rec-historical {
  filter: grayscale(0.4);
  opacity: 0.7;
}

.rec-action-card.is-readonly {
  background: #f7f8fa;
}

/* Past-run banner */
.past-run-banner {
  align-items: center;
  background: #fff7e6;
  border: 1px solid #f0d292;
  border-radius: 12px;
  color: #7a5b12;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 14px;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

/* Stored run-log viewer */
.run-log-viewer {
  margin-bottom: 12px;
}

.run-log-viewer summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 8px;
}

/* Re-run bar (context editor + big button) */
.rerun-bar {
  background: #f4f8f6;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.rerun-hint {
  color: var(--muted);
  font-weight: 400;
}

.rerun-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

.rerun-button {
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 22px;
  box-shadow: 0 6px 18px rgba(15, 107, 94, 0.32);
}

.rerun-button:disabled {
  background: #c4d2cd;
  box-shadow: none;
  cursor: not-allowed;
}

.rerun-gate {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* Two-column candidate layout */
.rec-columns {
  display: grid;
  gap: 18px;
  /* minmax(0,1fr) prevents long unbroken card content from blowing the grid wider
     than its container — that was making the recs area resize vs. the panel above. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.rec-columns.rec-columns-single { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 900px) {
  .rec-columns { grid-template-columns: 1fr; }
}

.rec-column-head {
  align-items: center;
  display: flex;
  font-size: 14px;
  gap: 8px;
  margin: 0 0 10px;
}

.rec-column-head span {
  background: var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 1px 8px;
}

/* In the two-column candidate layout, stack each card's display + action panels
   vertically so they use the full column width (the side-by-side 290px action
   card would otherwise squish the display card to ~100px). The action ("Review")
   box hugs its candidate (small gap), with a clear gap before the next candidate. */
.rec-columns .recommendation-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  margin-bottom: 22px;
}

/* Tier pill on a candidate card */
.tier-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
}

.tier-pill.tier-tier1 {
  background: rgba(15, 107, 94, 0.14);
  color: var(--accent);
}

.tier-pill.tier-tier3 {
  background: #eef1f5;
  color: #4a5568;
}

.tier-pill.tier-other {
  background: #f1eef5;
  color: #6b5b86;
}

/* AI Entity Layer: list + card-inspection detail panel */
.entity-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: start;
}

@media (max-width: 900px) {
  .entity-layout { grid-template-columns: 1fr; }
}

.entity-card {
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.entity-card:hover {
  border-color: var(--line-strong);
}

.entity-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 94, 0.14);
}

.entity-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 16px;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.entity-detail-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.entity-detail-head strong { font-size: 17px; }
.entity-detail-head p { color: var(--muted); font-size: 12px; margin: 2px 0 0; }

.entity-detail h4 {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  margin: 16px 0 6px;
  text-transform: uppercase;
}

.entity-detail .card-meta {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.fact-list { display: grid; gap: 6px; margin: 0; }
.fact-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
.fact-row dt { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.fact-row dd { color: #29323d; font-size: 13px; margin: 0; }

.card-preview {
  background: #0f1720;
  border-radius: 10px;
  color: #cfe3dc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.entity-type-badge {
  background: #eef1f6;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* "How these cards are built" explainer */
.card-explainer {
  background: linear-gradient(180deg, #fbfcfe, #fff);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}
.card-explainer > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 9px;
  list-style: none;
  padding: 11px 14px;
  user-select: none;
}
.card-explainer > summary::-webkit-details-marker { display: none; }
.info-dot {
  align-items: center;
  background: #1e6fd9;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font: italic 700 11px Georgia, serif;
  height: 17px;
  justify-content: center;
  width: 17px;
}
.explainer-chevron { color: var(--muted); margin-left: auto; transition: transform 0.15s ease; }
.card-explainer[open] .explainer-chevron { transform: rotate(90deg); }
.card-explainer-body {
  border-top: 1px solid var(--line);
  padding: 14px;
}
.explain-summary { margin: 0 0 12px; color: var(--ink); font-size: 13px; }
.explain-layers { display: flex; flex-direction: column; gap: 10px; }
.explain-layer {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
}
.explain-layer-head { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.method-badge {
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  text-transform: uppercase;
}
.method-llm { background: #f1ebfd; color: #7b3fe4; }
.method-det { background: #e7f8f1; color: #0f9d6b; }
.explain-meta { color: var(--muted); font-size: 11px; margin-left: auto; }
.explain-produces { color: #2c3640; font-size: 12.5px; margin-top: 5px; }
.explain-note { font-size: 11.5px; margin-top: 3px; }
.explain-assembly { font-size: 12.5px; margin: 14px 0 6px; }
.explain-version code { background: #eef1f6; border-radius: 4px; padding: 1px 5px; }
.card-explainer .link-button {
  background: none;
  border: none;
  color: #1e6fd9;
  cursor: pointer;
  font-size: 11.5px;
  margin-top: 7px;
  padding: 0;
}
.prompt-text {
  background: #1b2433;
  border-radius: 8px;
  color: #d7dee8;
  font-size: 11.5px;
  line-height: 1.5;
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* per-type tabs in the explainer */
.explainer-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}
.card-explainer-body .explainer-tab {
  background: none !important;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: -1px;
  padding: 7px 12px;
}
.card-explainer-body .explainer-tab.active {
  border-bottom-color: #1e6fd9;
  color: #1e6fd9 !important;
}

/* worked example */
.explain-example {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 16px;
  padding: 12px 14px;
}
.explain-example h5 { font-size: 13px; margin: 0 0 6px; }
.explain-example a { color: #1e6fd9; }
.example-sections { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.example-section { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.example-section-head {
  align-items: baseline;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
}
.example-section-head strong { font-size: 12.5px; }
.example-source { color: var(--muted); font-size: 11px; font-style: italic; margin-left: auto; }
.example-section-text {
  background: #fff;
  font-size: 11.5px;
  line-height: 1.5;
  margin: 0;
  max-height: 200px;
  overflow: auto;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.example-full, .example-notes { margin-top: 10px; }
.example-full > summary, .example-notes > summary { color: #1e6fd9; cursor: pointer; font-size: 12px; }
.example-note-list { font-size: 12px; line-height: 1.7; margin: 8px 0 0; max-height: 220px; overflow: auto; padding-left: 18px; }
.example-note-list a { color: #1e6fd9; }

/* per-entity Sources & provenance panel */
.entity-sources { margin-top: 14px; }
.entity-sources > summary { color: #1e6fd9; cursor: pointer; font-size: 13px; font-weight: 600; }
.entity-sources-body { margin-top: 10px; }
.src-totals { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.src-chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; padding: 2px 9px; }
.src-block { margin-top: 12px; }
.src-block h5 { font-size: 12.5px; margin: 0 0 4px; }
.src-block h5 a { color: #1e6fd9; }
.src-list { font-size: 12px; line-height: 1.8; margin: 6px 0 0; padding-left: 4px; list-style: none; }
.src-list li { align-items: baseline; display: flex; flex-wrap: wrap; gap: 6px; }
.src-list a { color: #1e6fd9; }
.src-notes { max-height: 260px; overflow: auto; }

/* Target picker (which candidate groups to search) */
.target-field {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
}

.target-field legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 4px;
}

.target-option {
  align-items: center;
  display: flex;
  font-size: 14px;
  gap: 8px;
}

.target-option input {
  width: auto;
}

/* Re-run confirmation modal */
.modal-shell {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 50;
}

.modal-backdrop {
  background: rgba(15, 23, 32, 0.45);
  inset: 0;
  position: absolute;
}

.modal-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 32, 0.3);
  max-height: 82vh;
  max-width: 560px;
  overflow-y: auto;
  padding: 22px 24px;
  position: relative;
  width: calc(100% - 48px);
  z-index: 1;
}

.modal-card h3 { margin: 0 0 6px; font-size: 19px; }
.modal-card h4 {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  margin: 16px 0 6px;
  text-transform: uppercase;
}

.rerun-context-note {
  background: #eef6f2;
  border-radius: 10px;
  color: var(--accent);
  font-size: 13px;
  margin: 12px 0 0;
  padding: 8px 12px;
}

.signal-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.signal-row {
  align-items: baseline;
  background: #f7f8fa;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 12px;
}

.signal-row.pos { background: #eef9f1; }
.signal-row.neg { background: #fdf0ef; }
.signal-name { font-weight: 700; font-size: 13px; }
.signal-name em { color: var(--accent); font-style: normal; font-weight: 600; }
.signal-run { color: var(--muted); font-size: 12px; }
.signal-note { color: var(--muted); flex-basis: 100%; font-size: 12px; font-style: italic; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.stage-index {
  align-items: center;
  background: #e7f3ef;
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 820;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.history-row {
  border-radius: 12px;
  margin-bottom: 8px;
}

.entity-filter {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  margin-bottom: 10px;
}

.entity-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
}

.ai-profile {
  color: #303943;
  margin-top: 8px;
}

.memory-box {
  background: #fff8eb;
  border: 1px solid #ecd9b4;
  border-radius: 10px;
  margin-top: 10px;
  padding: 9px;
}

.memory-box strong {
  color: #745016;
  font-size: 12px;
}

.entity-feedback {
  border-top: 1px solid #ecd9b4;
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding-top: 8px;
}

.entity-feedback span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.entity-feedback strong {
  color: #2d333b;
  font-size: 12px;
}

.entity-feedback small {
  color: #7a6848;
  font-size: 11px;
  font-weight: 680;
}

.entity-feedback p {
  color: #534631;
  font-size: 12px;
  line-height: 1.4;
  margin: 3px 0 0;
}

.metric-grid {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 12px;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 760;
}

.metric-card strong {
  display: block;
  font-size: 25px;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

.pipeline-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.pipeline-row {
  align-items: center;
  background: #fff;
  display: grid;
  gap: 8px;
  grid-template-columns: 1.6fr repeat(5, minmax(56px, auto));
  padding: 11px;
}

.pipeline-row + .pipeline-row {
  border-top: 1px solid var(--line);
}

.pipeline-row span,
.pipeline-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.empty-state {
  align-content: center;
  background: #fafbfc;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  display: grid;
  min-height: 160px;
  padding: 20px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.drawer-backdrop {
  background: rgba(20, 24, 31, 0.28);
  position: absolute;
  inset: 0;
}

.contender-drawer {
  animation: drawer-in 180ms ease both;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 42px rgba(30, 41, 55, 0.16);
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto 1fr auto;
  height: 100%;
  margin-left: auto;
  max-width: 420px;
  padding: 18px;
  position: relative;
  width: min(420px, 92vw);
}

.drawer-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.drawer-head span,
.drawer-head p {
  color: var(--muted);
}

.drawer-head span {
  display: block;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-head strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  margin-top: 4px;
}

.drawer-head p {
  font-size: 12px;
  margin: 5px 0 0;
}

.contender-filter {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
}

.contender-filter button {
  background: transparent;
  color: var(--muted);
  min-height: 32px;
}

.contender-filter button.active {
  background: #fff;
  box-shadow: 0 1px 6px rgba(30, 41, 55, 0.08);
  color: var(--ink);
}

.contender-items {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.contender-item {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 4px;
  justify-content: stretch;
  padding: 11px;
  text-align: left;
}

.contender-item.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.contender-item strong,
.contender-item span {
  display: block;
}

.contender-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.35;
}

.confirm-contender {
  width: 100%;
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-nav {
    align-items: center;
    flex-direction: row;
    gap: 18px;
    height: auto;
    justify-content: space-between;
    padding: 12px 16px;
    position: static;
  }

  .nav-stack {
    display: flex;
    gap: 4px;
    overflow-x: auto;
  }

  .nav-link {
    white-space: nowrap;
    width: auto;
  }

  .request-workspace {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .selected-request-panel {
    max-height: none;
    position: static;
  }
}

@media (max-width: 720px) {
  .app-nav {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }

  .nav-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .nav-link {
    font-size: 12px;
    padding: 9px 6px;
    text-align: center;
    white-space: normal;
  }

  .topbar,
  .topbar-actions,
  .form-grid,
  .type-grid,
  .bulk-actions,
  .feedback-row,
  .metric-grid,
  .pipeline-row,
  .rec-feed-summary,
  .request-index,
  .request-list-main dl,
  .recommendation-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }

  .workspace {
    padding: 12px;
  }

  .request-home-actions,
  .request-index-toolbar,
  .index-controls,
  .request-list-head {
    align-items: stretch;
    display: grid;
  }
}

/* ── Request wizard: requesting-entity preview + gated config stage ───────── */
.entity-preview {
  margin: 4px 0 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.entity-preview .ep-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ep-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.ep-badge.ep-ok    { background: rgba(21,118,71,0.10);  color: var(--good); border-color: rgba(21,118,71,0.25); }
.ep-badge.ep-built { background: rgba(39,76,154,0.10);  color: var(--accent-2); border-color: rgba(39,76,154,0.25); }
.ep-badge.ep-warn  { background: rgba(154,106,0,0.12);  color: var(--warn); border-color: rgba(154,106,0,0.30); }
.ep-badge.ep-loading { background: var(--surface-3); color: var(--muted); }
.ep-name { font-size: 14px; color: var(--ink); }
.ep-meta { font-size: 11px; color: var(--soft); }
.ep-hint { margin: 8px 0 0; font-size: 12px; }
.ep-card {
  margin: 10px 0 0;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 12px/1.5 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.config-stage { display: flex; flex-direction: column; gap: 18px; }
.config-stage.hidden { display: none; }

/* In-flight tier column header indicator (per-tier streaming). */
.rec-generating { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; }
.rec-generating .mini-spinner { width: 12px; height: 12px; }

/* Build stamp inside the dev toggle — visible only when dev mode is on. */
.dev-version { display: none; margin-left: 8px; font-size: 11px; font-weight: 600;
  color: var(--accent-2); letter-spacing: 0.02em; }
body.show-section-labels .dev-version { display: inline; }
