:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #6f6b64;
  --line: #dedad2;
  --line-strong: #242424;
  --paper: #f7f5ef;
  --surface: #fffdf8;
  --wash: #efede6;
  --red: #c94b3f;
  --gold: #e5b84f;
  --blue: #315f9d;
  --green: #277460;
  --shadow: 0 18px 50px rgba(24, 24, 24, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Aptos", "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 360;
  color: var(--ink);
  background: var(--paper);
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
  align-items: start;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

body.tracker-collapsed .workspace {
  grid-template-columns: minmax(0, 1fr) 72px;
}

body.tracker-collapsed .tracker {
  padding: 18px 12px;
  overflow: hidden;
}

body.tracker-collapsed .tracker-head {
  border-bottom: 0;
  padding-bottom: 0;
}

body.tracker-collapsed .tracker-head .eyebrow,
body.tracker-collapsed .tracker-head h3,
body.tracker-collapsed #agentMode,
body.tracker-collapsed .tracker > .muted,
body.tracker-collapsed .agent-grid {
  display: none;
}

body.tracker-collapsed #toggleTracker {
  writing-mode: vertical-rl;
  min-height: 120px;
  width: 44px;
  padding: 10px 0;
}

body.landing-view .workspace,
body.landing-view.tracker-collapsed .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.landing-view .tracker {
  display: none;
}

body.landing-view main {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.sidebar {
  background: #fbfaf5;
  color: var(--ink);
  border-right: 1px solid var(--line);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--surface);
  font-weight: 760;
  border-radius: 0;
}

.sidebar h1,
.sidebar p,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: 0;
}

.sidebar h1 {
  font-size: 25px;
  line-height: 1.02;
  font-weight: 560;
}

.sidebar p {
  color: var(--muted);
  line-height: 1.35;
}

nav {
  display: grid;
  border-top: 1px solid var(--line);
}

nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 430;
}

nav a:hover,
nav a.active {
  color: var(--red);
}

.limit {
  margin-top: auto;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
  display: grid;
  gap: 8px;
}

.limit span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 650;
}

main {
  padding: 24px 28px 36px;
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 1360px;
  height: 100vh;
  overflow: auto;
  align-content: start;
  scroll-padding: 24px;
}

.topbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.topbar {
  min-height: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: linear-gradient(180deg, var(--red) 0 34%, var(--gold) 34% 68%, var(--blue) 68%);
  border-right: 1px solid var(--line);
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  max-width: 760px;
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1.04;
  font-weight: 520;
}

h3 {
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.1;
  font-weight: 520;
}

h4 {
  font-size: 18px;
  font-weight: 560;
}

h5 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
}

.panel {
  padding: 22px;
}

.view-panel {
  display: none;
}

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

.workflow-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  width: fit-content;
}

.workflow-tabs a {
  color: var(--ink);
  text-decoration: none;
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
  font-size: 12px;
  font-weight: 470;
}

.workflow-tabs a.active {
  background: var(--ink);
  color: var(--surface);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(310px, 0.8fr) minmax(0, 1.2fr);
  gap: 0;
  padding: 0;
  min-width: 0;
}

.two-col > div {
  padding: 24px;
  min-width: 0;
}

.two-col > div + div {
  border-left: 1px solid var(--line);
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.45;
}

.form-grid,
.profile,
.report {
  display: grid;
  gap: 12px;
}

.schedule-box {
  border: 1px solid var(--line);
  margin: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
  background: #fbfaf5;
}

.schedule-box legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 680;
  text-transform: uppercase;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  text-transform: none;
  font-size: 13px;
  font-weight: 520;
}

.inline-check input {
  min-height: auto;
  width: 18px;
  height: 18px;
  padding: 0;
}

.mini-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: var(--ink);
  font-weight: 650;
  text-transform: uppercase;
}

input,
textarea {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fffdfa;
  padding: 10px 12px;
  font: inherit;
  font-weight: 420;
}

textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.35;
}

select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fffdfa;
  padding: 10px 12px;
  font: inherit;
  font-weight: 440;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 0;
}

button,
.button-link {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font-weight: 560;
  cursor: pointer;
  padding: 0 16px;
  box-shadow: inset 0 -4px 0 var(--wash);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--gold);
}

.button-link.primary,
button.primary,
form button {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
  box-shadow: inset 0 -4px 0 var(--red);
}

button.danger {
  border-color: var(--red);
  color: var(--red);
  background: #fffdfa;
  box-shadow: inset 0 -4px 0 #f0d8d3;
}

button.danger:hover {
  background: var(--red);
  color: var(--surface);
}

.button-link.primary:hover,
button.primary:hover,
form button:hover {
  background: var(--red);
}

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

.status-line {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 1.35;
  text-transform: none;
}

.status-line.ok {
  color: var(--green);
}

.status-line.error {
  color: var(--red);
}

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

.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 4px 10px;
  color: var(--ink);
  background: var(--wash);
  font-size: 12px;
  font-weight: 520;
  white-space: nowrap;
}

.profile-card,
.project-card,
.question,
.answer,
.rank,
.metric,
.agent-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0;
}

.project-list {
  margin-top: 18px;
  display: block;
}

.empty-state {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
  display: grid;
  gap: 14px;
  max-width: 560px;
}

.empty-state strong {
  font-size: 20px;
  font-weight: 520;
}

.project-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.project-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
}

.project-table th,
.project-table td {
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

.project-table th {
  background: #f4f1e9;
  font-size: 11px;
  font-weight: 560;
  text-transform: uppercase;
  color: var(--muted);
}

.project-table tr.active {
  box-shadow: inset 4px 0 0 var(--red);
  background: #fffdfa;
}

.project-table td strong {
  display: block;
  font-size: 15px;
  font-weight: 540;
}

.project-table td span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.project-table button {
  min-height: 34px;
  width: 86px;
  box-shadow: none;
}

.profile-card {
  padding: 13px;
  min-width: 0;
  overflow: hidden;
}

.profile-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 520;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.chip {
  padding: 5px 7px;
  border-radius: 0;
  background: var(--wash);
  color: var(--ink);
  font-size: 12px;
  font-weight: 430;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tracker {
  position: relative;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fbfaf5;
  padding: 24px;
  box-shadow: -20px 0 50px rgba(24, 24, 24, 0.04);
}

.tracker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 16px;
}

.tracker-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.agent-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.agent-card {
  border-top: 0;
  border-left: 0;
  padding: 13px;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.agent-number {
  color: var(--red);
  font-size: 12px;
  font-weight: 650;
}

.agent-card p {
  margin: 0;
  color: inherit;
  line-height: 1.32;
  font-size: 12px;
}

.agent-card small {
  color: var(--muted);
  font-weight: 520;
  font-size: 12px;
}

.question-list {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.question.is-new {
  box-shadow: inset 4px 0 0 var(--gold);
}

.question.is-user-seed {
  box-shadow: inset 4px 0 0 var(--blue);
}

.question.is-new.is-user-seed {
  box-shadow: inset 4px 0 0 var(--green);
}

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

.analytics-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.analytics-card.wide {
  grid-column: 1 / -1;
}

.analytics-head,
.topic-row,
.progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.analytics-head strong {
  font-size: 16px;
  font-weight: 560;
}

.analytics-head span,
.progress-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.progress-row {
  grid-template-columns: minmax(120px, 0.6fr) minmax(120px, 1fr) 48px 32px;
  font-size: 13px;
}

.progress-row div {
  height: 12px;
  background: var(--wash);
  border: 1px solid var(--line);
}

.progress-row em {
  display: block;
  height: 100%;
  background: var(--blue);
}

.topic-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.topic-row {
  border-top: 1px solid var(--line);
  padding: 9px 0;
  font-size: 13px;
}

.topic-row span {
  overflow-wrap: anywhere;
}

.question {
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border-top: 0;
  border-left: 0;
}

.question p {
  margin: 0;
  line-height: 1.42;
  font-size: 14px;
  font-weight: 430;
}

.question small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
  line-height: 1.3;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  margin: 18px 0;
}

.dashboard-controls {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.run-picker {
  max-width: 440px;
}

.result-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  background: #fbfaf5;
  padding: 12px;
}

.result-filters label {
  gap: 5px;
}

.result-filters select,
.result-filters input {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 13px;
}

.result-filters button {
  min-height: 36px;
  box-shadow: none;
  white-space: nowrap;
}

.mock-banner {
  border: 1px solid #b98319;
  background: #fff1c6;
  color: #5d3a00;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 720;
}

.mode-note {
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--muted);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 680;
}

.metric {
  padding: 16px;
  border-top: 0;
  border-left: 0;
  min-height: 120px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 0.95;
  margin-top: 14px;
  color: var(--ink);
  font-weight: 560;
}

.metric p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.delta {
  display: inline-flex;
  margin-top: 12px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  font-style: normal;
  font-size: 12px;
  font-weight: 560;
}

.delta.up {
  color: var(--green);
}

.delta.down {
  color: var(--red);
}

.delta.flat {
  color: var(--muted);
}

.metric:nth-child(1) strong {
  color: var(--red);
}

.split {
  display: block;
}

.results-head {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.rank-list,
.response-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  max-height: calc(100vh - 310px);
}

.results-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.results-table th,
.results-table td {
  border: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
}

.results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f1e9;
  color: var(--ink);
  font-size: 11px;
  font-weight: 560;
  text-transform: uppercase;
  white-space: nowrap;
}

.results-table td {
  max-width: 240px;
  line-height: 1.42;
}

.question-cell {
  min-width: 360px;
  font-weight: 430;
}

.url-list {
  display: grid;
  gap: 5px;
  min-width: 180px;
}

.url-list a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.mini-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  box-shadow: none;
}

.rank,
.answer {
  padding: 14px;
  border-top: 0;
}

.answer + .answer,
.rank + .rank {
  border-top: 1px solid var(--line);
}

.answer summary {
  cursor: pointer;
  font-weight: 560;
  line-height: 1.4;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.answer pre {
  white-space: pre-wrap;
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px;
  overflow: auto;
  max-height: 360px;
  line-height: 1.45;
  font-size: 13px;
}

.answer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.answer-meta span {
  background: var(--wash);
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 520;
}

.url-block {
  display: grid;
  gap: 5px;
  margin: 10px 0;
  padding: 10px;
  background: #fffdfa;
  border: 1px solid var(--line);
}

.url-block strong {
  font-size: 12px;
  text-transform: uppercase;
}

.url-block a {
  color: var(--blue);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.citation-group {
  display: grid;
  gap: 4px;
  padding-top: 6px;
}

.citation-group span {
  font-size: 12px;
  font-weight: 560;
}

.answer-modal {
  width: min(980px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 18px;
}

.answer-modal::backdrop {
  background: rgba(24, 24, 24, 0.35);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
}

.answer-modal pre {
  white-space: pre-wrap;
  max-height: 560px;
  overflow: auto;
  padding: 14px;
  background: #fffdfa;
  border: 1px solid var(--line);
  line-height: 1.45;
  font-size: 13px;
}

.co-mentions {
  margin-top: 18px;
}

.status-good {
  color: var(--green);
}

.status-risk {
  color: var(--red);
}

.report {
  margin-top: 12px;
  line-height: 1.5;
  max-width: 920px;
}

@media (max-width: 1180px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  body.tracker-collapsed .workspace {
    grid-template-columns: 1fr;
  }
  main {
    height: auto;
    overflow: visible;
  }
  .tracker {
    position: static;
    height: auto;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .two-col,
  .split,
  .project-card,
  .project-list,
  .question-list,
  .metrics,
  .result-filters,
  .agent-grid {
    grid-template-columns: 1fr;
  }
  .two-col > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .section-head,
  .actions,
  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  main {
    padding: 14px;
  }
  .panel,
  .two-col > div,
  .tracker {
    padding: 18px;
  }
}

/* shadcn-inspired product polish for the current vanilla app shell */
:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #111827;
  --paper: #f8fafc;
  --surface: #ffffff;
  --wash: #f3f4f6;
  --red: #c2410c;
  --gold: #d97706;
  --blue: #2563eb;
  --green: #047857;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px rgba(15, 23, 42, 0.06);
}

body {
  grid-template-columns: 220px minmax(0, 1fr);
  background: var(--paper);
  font-weight: 400;
}

.workspace {
  grid-template-columns: minmax(0, 1fr) 340px;
}

body.tracker-collapsed .workspace {
  grid-template-columns: minmax(0, 1fr) 56px;
}

.sidebar {
  background: #ffffff;
  padding: 22px 18px;
  gap: 20px;
}

.brand-mark {
  border-radius: var(--radius);
}

.sidebar h1 {
  font-size: 22px;
  font-weight: 650;
}

nav a {
  border-bottom: 0;
  border-radius: 6px;
  padding: 10px 11px;
  font-size: 13px;
}

nav a:hover,
nav a.active {
  background: #fff7ed;
  color: var(--red);
}

main {
  max-width: none;
  padding: 18px;
  gap: 14px;
}

.topbar,
.panel,
.analytics-card,
.profile-card,
.research-card,
.project-table-wrap,
.question-table-wrap,
.table-wrap,
.result-filters,
.mode-note,
.empty-state,
.schedule-box {
  border-radius: var(--radius);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 0;
  padding: 18px 20px;
}

.topbar::before {
  width: 4px;
  border-right: 0;
  background: linear-gradient(180deg, #ef4444, #f59e0b 48%, #2563eb);
}

h2 {
  max-width: 860px;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.12;
  font-weight: 620;
}

h3 {
  font-size: clamp(20px, 1.7vw, 26px);
  font-weight: 620;
}

h4 {
  font-size: 16px;
}

.workflow-tabs {
  gap: 6px;
  border: 0;
  margin-top: 16px;
}

.workflow-tabs a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 11px;
  font-size: 12px;
}

.workflow-tabs a.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.panel {
  padding: 18px;
}

.setup-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(280px, 0.64fr);
  gap: 18px;
  align-items: start;
}

.setup-aside {
  display: grid;
  gap: 12px;
}

.aside-card,
.research-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px;
}

.aside-card strong,
.research-card strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.step-dot {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  margin-bottom: 12px;
  background: #f3f4f6;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
}

label,
.schedule-box legend,
.eyebrow,
h5,
.limit span {
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 650;
}

input,
textarea,
select {
  border-radius: 6px;
  background: #ffffff;
  min-height: 40px;
}

textarea {
  min-height: 84px;
}

button,
.button-link {
  border-radius: 6px;
  box-shadow: none;
  min-height: 38px;
  font-weight: 600;
}

.button-link.primary,
button.primary,
form button {
  box-shadow: none;
}

.pill,
.chip,
.answer-meta span,
.table-badge,
.delta {
  border-radius: 999px;
}

.research-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-top: 16px;
}

.signal-panel {
  display: grid;
  gap: 14px;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-list a,
.mini-list span {
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mini-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.mini-list a:hover {
  color: var(--blue);
}

.signal-groups {
  display: grid;
  gap: 8px;
}

.signal-groups details {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f9fafb;
}

.signal-groups summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 650;
  font-size: 13px;
}

.saved-projects-strip[hidden] {
  display: none;
}

.preview-table {
  margin-top: 14px;
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-table button {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  text-align: left;
}

.preview-table button:last-child {
  border-bottom: 0;
}

.preview-table button.active {
  background: #fff7ed;
}

.preview-table span,
.preview-table small,
.preview-table em {
  display: block;
}

.preview-table small,
.preview-table em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 450;
}

.project-table th,
.project-table td,
.results-table th,
.results-table td {
  border-left: 0;
  border-right: 0;
}

.project-table th,
.results-table th,
.question-table th {
  background: #f9fafb;
  color: #4b5563;
}

.question-list {
  display: block;
  border: 0;
}

.question-table-wrap {
  margin-top: 14px;
  overflow: auto;
  max-height: calc(100vh - 250px);
}

.question-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.question-table th,
.question-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.question-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 650;
}

.question-table input[type="checkbox"] {
  min-height: auto;
  width: 16px;
  height: 16px;
}

.question-table tr.is-new {
  background: #fffbeb;
}

.question-table tr.is-user-seed {
  background: #eff6ff;
}

.question-main {
  min-width: 360px;
}

.question-main strong {
  display: block;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.35;
}

.question-main span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.table-badge {
  display: inline-flex;
  align-items: center;
  margin: 0 4px 4px 0;
  padding: 3px 7px;
  background: #f3f4f6;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.metrics {
  gap: 12px;
  border: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 104px;
}

.metric strong {
  font-size: clamp(30px, 3vw, 42px);
}

.analytics-grid {
  grid-template-columns: 0.95fr 0.95fr 1.2fr;
}

.analytics-card.wide {
  grid-column: auto;
}

.result-filters {
  grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(190px, 1.2fr) auto;
}

.tracker {
  background: #ffffff;
  padding: 18px;
}

.tracker-head {
  border-bottom: 1px solid var(--line);
}

.agent-grid {
  border: 0;
  gap: 10px;
}

.agent-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.answer-modal,
.answer-modal pre {
  border-radius: var(--radius);
}

@media (max-width: 1180px) {
  .analytics-grid,
  .research-grid,
  .setup-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }
  .workspace,
  body.tracker-collapsed .workspace {
    grid-template-columns: 1fr;
  }
  .schedule-grid,
  .metrics,
  .result-filters {
    grid-template-columns: 1fr;
  }
}

/* Stability fixes after the workflow redesign */
body {
  min-height: 100vh;
  height: auto;
  overflow: auto;
}

.workspace {
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

main {
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

.tracker {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow: auto;
}

.view-panel.active.setup-shell {
  display: grid;
}

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

.setup-shell > div,
.research-grid > div,
.panel,
.project-table-wrap,
.question-table-wrap,
.table-wrap {
  min-width: 0;
}

.question-table-wrap,
.table-wrap,
.project-table-wrap {
  overflow: auto;
}

.question-table-wrap {
  max-height: none;
}

.analytics-grid {
  align-items: stretch;
}

.topbar {
  align-items: start;
}

body.tracker-collapsed .tracker {
  position: sticky;
  top: 0;
  max-height: 100vh;
}

@media (max-width: 1180px) {
  .tracker,
  body.tracker-collapsed .tracker {
    position: static;
    max-height: none;
  }
}

/* Professional polish: calmer hero, guided setup, readable activity tracker */
.topbar {
  padding: 20px 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.topbar::before {
  width: 3px;
  background: linear-gradient(180deg, var(--red), var(--gold) 52%, var(--blue));
}

.topbar h2 {
  max-width: 980px;
  font-size: clamp(24px, 2.1vw, 34px);
  line-height: 1.16;
  font-weight: 560;
}

.topbar .pill {
  align-self: start;
  background: #ffffff;
  color: var(--green);
  border-color: #cddfd8;
  font-weight: 620;
}

.workflow-tabs {
  gap: 8px;
}

.workflow-tabs a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 13px;
}

.setup-shell {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.form-grid {
  gap: 16px;
}

.landing-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 22px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.start-card {
  border-top: 3px solid var(--ink);
}

.explore-card {
  border-top: 3px solid var(--blue);
}

.setup-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.setup-step-card {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.setup-step-card legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

.setup-step-card legend span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--red);
  font-size: 12px;
  font-weight: 720;
}

.setup-step-card label {
  color: var(--muted);
}

.setup-step-card input,
.setup-step-card select,
.setup-step-card textarea {
  margin-top: 6px;
  width: 100%;
}

.setup-aside {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aside-card {
  box-shadow: none;
}

.project-workflow[hidden] {
  display: none;
}

.empty-state.compact {
  padding: 16px;
  box-shadow: none;
}

.baseline-card {
  border-top: 3px solid var(--green);
}

.baseline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.baseline-grid span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf5;
}

.baseline-grid b {
  font-size: 22px;
  line-height: 1;
}

.baseline-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
}

@media (max-width: 760px) {
  .baseline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tracker > .muted {
  font-size: 13px;
  line-height: 1.45;
}

.agent-card {
  gap: 8px;
  box-shadow: none;
}

.agent-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

.agent-card.status-complete .agent-status,
.agent-card.status-ready .agent-status {
  background: #edf7f3;
  color: var(--green);
}

.agent-card.status-fallback .agent-status,
.agent-card.status-fixed .agent-status,
.agent-card.status-waiting .agent-status {
  background: #fff7ed;
  color: var(--red);
}

.agent-card.status-running .agent-status {
  background: #eff6ff;
  color: var(--blue);
}

.agent-grid {
  display: grid;
  gap: 12px;
}

.agent-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.agent-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
}

.agent-message-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.agent-message-head strong {
  font-size: 14px;
  font-weight: 650;
}

.agent-message-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
}

.agent-message p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.agent-message.complete .agent-avatar {
  background: #ecfdf5;
  color: var(--green);
}

.agent-message.attention .agent-avatar {
  background: #fff7ed;
  color: var(--red);
}

.agent-message.running .agent-avatar {
  background: #eff6ff;
  color: var(--blue);
}

@media (max-width: 1280px) {
  .setup-stepper,
  .setup-aside {
    grid-template-columns: 1fr;
  }
}

/* Token-aligned copy and shell refinements */
.sidebar {
  background: #ffffff;
}

.limit {
  display: none;
}

.topbar {
  position: relative;
  padding: 22px 24px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04);
}

.topbar::before {
  width: 2px;
  background: var(--primary);
}

.topbar h2 {
  max-width: 920px;
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.18;
  font-weight: 560;
}

.landing-card,
.setup-step-card,
.panel,
.tracker,
.profile-card,
.metric,
.summary-card {
  border-radius: 8px;
}

.info-button {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  font-weight: 650;
  cursor: help;
}

.info-button:hover,
.info-button:focus-visible {
  color: var(--ink);
  border-color: var(--ring);
  outline: none;
}

.setup-step-card legend {
  width: 100%;
  justify-content: flex-start;
}

.setup-step-card legend .info-button {
  margin-left: auto;
}

.recommendation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.recommendation-summary span {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.recommendation-summary b {
  font-size: 28px;
  line-height: 1;
  font-weight: 620;
}

.recommendation-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

.recommendation-groups {
  display: grid;
  gap: 16px;
}

.recommendation-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.recommendation-group-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.recommendation-group-head h4 {
  font-size: 18px;
  font-weight: 600;
}

.recommendation-group-head a {
  color: var(--primary);
  font-size: 13px;
  word-break: break-all;
}

.recommendation-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.recommendation-table th,
.recommendation-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

.recommendation-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 650;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 620;
}

.priority-high {
  background: #fef2f2;
  color: #b91c1c;
}

.priority-medium {
  background: #fff7ed;
  color: #c2410c;
}

.priority-low {
  background: #ecfdf5;
  color: #047857;
}

.evidence-stack {
  display: grid;
  gap: 6px;
}

@media (max-width: 900px) {
  .recommendation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.view-panel:not(.active) {
  display: none !important;
}
