:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --surface: #ffffff;
  --surface-soft: #f3f5f1;
  --ink: #111b19;
  --muted: #5f6c69;
  --muted-light: #85908d;
  --line: #dfe4df;
  --line-strong: #cdd5cf;
  --teal: #087e78;
  --teal-dark: #05645f;
  --teal-soft: #dff5ef;
  --lime: #d8f35c;
  --lime-soft: #eff8bf;
  --warning: #91642b;
  --warning-soft: #fff6df;
  --page-pad: clamp(20px, 5vw, 72px);
  --content-width: 1440px;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(17, 27, 25, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 18%, rgba(216, 243, 92, 0.12), transparent 22rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar,
main,
footer {
  width: min(100%, var(--content-width));
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.topbar {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--lime);
  font-size: 0.68rem;
  font-weight: 900;
}

.brand-copy strong,
.brand-copy small,
.system-status strong,
.system-status small {
  display: block;
}

.brand-copy strong {
  font-size: 0.84rem;
  letter-spacing: -0.015em;
}

.brand-copy small,
.system-status small {
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 0.59rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.system-status strong {
  font-size: 0.7rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a9f74;
  box-shadow: 0 0 0 4px rgba(26, 159, 116, 0.12);
}

.status-label {
  margin-left: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

main {
  padding-top: clamp(52px, 7vw, 96px);
  padding-bottom: clamp(66px, 8vw, 108px);
}

.hero {
  display: grid;
  max-width: 1280px;
  margin: 0 auto clamp(44px, 6vw, 72px);
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  align-items: end;
  gap: clamp(42px, 7vw, 100px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 850px;
  margin: 0 0 24px;
  font-size: clamp(3.5rem, 7.4vw, 7.1rem);
  line-height: 0.88;
  letter-spacing: -0.075em;
}

h1 span {
  color: var(--teal);
}

.hero-intro {
  max-width: 680px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.68;
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-notes span {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.65rem;
  font-weight: 750;
}

.pipeline-card,
.chat-panel,
.evidence-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pipeline-card {
  padding: 26px;
}

.pipeline-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.pipeline-heading h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.pipeline {
  margin: 0;
  padding: 20px 0 0;
  list-style: none;
}

.pipeline li {
  position: relative;
  display: grid;
  min-height: 62px;
  grid-template-columns: 42px 1fr;
  gap: 12px;
}

.pipeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 0;
  left: 14px;
  width: 1px;
  background: var(--line);
}

.pipeline li > span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.56rem;
  font-weight: 900;
}

.pipeline li:nth-child(2) > span,
.pipeline li:nth-child(4) > span {
  color: #566214;
  background: var(--lime-soft);
}

.pipeline strong,
.pipeline small {
  display: block;
}

.pipeline strong {
  margin-bottom: 3px;
  font-size: 0.78rem;
}

.pipeline small {
  color: var(--muted-light);
  font-size: 0.65rem;
  line-height: 1.4;
}

.workspace {
  display: grid;
  min-height: 760px;
  grid-template-columns: minmax(470px, 1.08fr) minmax(410px, 0.92fr);
  gap: 18px;
}

.chat-panel,
.evidence-panel {
  min-width: 0;
  overflow: hidden;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(240px, 1fr) auto;
}

.panel-header {
  display: flex;
  min-height: 94px;
  padding: 24px 26px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header .eyebrow {
  margin-bottom: 7px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.clear-button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.65rem;
  font-weight: 750;
  cursor: pointer;
}

.clear-button:hover,
.clear-button:focus-visible {
  border-color: var(--teal);
  color: var(--teal-dark);
  outline: none;
}

.suggestion-block {
  padding: 14px 26px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.suggestion-block > span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted-light);
  font-size: 0.57rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.suggestions button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  font-size: 0.67rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.suggestions button:hover,
.suggestions button:focus-visible {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-soft);
  outline: none;
}

.messages {
  display: flex;
  min-height: 0;
  padding: 26px;
  overflow-y: auto;
  flex-direction: column;
  gap: 20px;
  scrollbar-color: var(--line-strong) transparent;
}

.message {
  display: flex;
  width: min(92%, 720px);
  align-items: flex-start;
  gap: 11px;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--lime);
  font-size: 0.58rem;
  font-weight: 900;
}

.message.user .avatar {
  color: #fff;
  background: var(--teal);
}

.message.error .avatar {
  color: var(--warning);
  background: var(--warning-soft);
}

.message-content {
  min-width: 0;
}

.message-label {
  display: block;
  margin: 0 0 5px 2px;
  color: var(--muted-light);
  font-size: 0.57rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.message.user .message-label {
  text-align: right;
}

.message-bubble {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px;
  background: var(--surface-soft);
}

.message.user .message-bubble {
  border-color: #bfe6dc;
  border-radius: 14px 4px 14px 14px;
  background: var(--teal-soft);
}

.message.error .message-bubble {
  border-color: #ecd9b3;
  background: var(--warning-soft);
}

.message-bubble p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.answer-section-title {
  margin: 15px 0 6px;
  color: var(--ink);
  font-size: 0.71rem;
  font-weight: 850;
  letter-spacing: 0.015em;
}

.answer-section-title:first-child {
  margin-top: 0;
}

.answer-text + .answer-text {
  margin-top: 9px;
}

.citation-link {
  display: inline-block;
  margin: 0 1px;
  color: var(--teal-dark);
  font-weight: 850;
  text-decoration: none;
}

.citation-link:hover,
.citation-link:focus-visible {
  color: var(--teal);
  text-decoration: underline;
  outline: none;
}

.answer-table-wrap {
  max-width: 100%;
  margin: 10px 0 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.answer-table-wrap table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.45;
}

.answer-table-wrap th,
.answer-table-wrap td {
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.answer-table-wrap th:last-child,
.answer-table-wrap td:last-child {
  border-right: 0;
}

.answer-table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.answer-table-wrap th {
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.composer {
  position: relative;
  display: grid;
  padding: 15px 18px 31px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.composer textarea {
  width: 100%;
  min-height: 50px;
  max-height: 132px;
  padding: 14px;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: none;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: var(--muted-light);
}

.composer textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 126, 120, 0.12);
}

.composer > button {
  display: flex;
  min-width: 114px;
  min-height: 50px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--teal);
  font-size: 0.75rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.composer > button:hover {
  transform: translateY(-1px);
  background: var(--teal-dark);
}

.composer > button:focus-visible {
  outline: 3px solid rgba(8, 126, 120, 0.25);
  outline-offset: 3px;
}

.composer > button:disabled,
.clear-button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.composer svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-note {
  position: absolute;
  bottom: 9px;
  left: 20px;
  margin: 0;
  color: var(--muted-light);
  font-size: 0.55rem;
}

.evidence-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.evidence-heading {
  flex: 0 0 auto;
}

.source-count {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.59rem;
  font-weight: 850;
  white-space: nowrap;
}

.empty-evidence {
  display: grid;
  min-height: 620px;
  padding: 50px 34px;
  flex: 1;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.vector-visual {
  position: relative;
  width: 172px;
  height: 112px;
  margin-bottom: 26px;
}

.vector-visual::before,
.vector-visual::after {
  content: "";
  position: absolute;
  border: 1px dashed rgba(8, 126, 120, 0.25);
  border-radius: 50%;
}

.vector-visual::before {
  inset: 7px 25px;
}

.vector-visual::after {
  inset: 26px 5px;
}

.vector-visual span {
  position: absolute;
  z-index: 1;
  width: 13px;
  height: 13px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 1px var(--line);
}

.vector-visual span:nth-child(1) { top: 5px; left: 80px; background: var(--lime); }
.vector-visual span:nth-child(2) { top: 34px; left: 25px; }
.vector-visual span:nth-child(3) { top: 36px; right: 20px; background: #6bbeb3; }
.vector-visual span:nth-child(4) { bottom: 15px; left: 53px; background: #b7ce4b; }
.vector-visual span:nth-child(5) { right: 51px; bottom: 8px; }
.vector-visual span:nth-child(6) { top: 50px; left: 80px; width: 20px; height: 20px; background: var(--ink); }

.empty-evidence h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.empty-evidence > p {
  max-width: 430px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.62;
}

.empty-flow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-flow span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.59rem;
  font-weight: 750;
}

.empty-flow i {
  color: var(--muted-light);
  font-size: 0.65rem;
  font-style: normal;
}

.evidence-content {
  min-height: 0;
  padding: 20px 22px 24px;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
}

.trace-stats {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trace-stats > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.trace-stats span,
.trace-stats strong {
  display: block;
}

.trace-stats span {
  margin-bottom: 5px;
  color: var(--muted-light);
  font-size: 0.54rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trace-stats strong {
  overflow: hidden;
  font-size: 0.69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-heading {
  display: flex;
  margin-bottom: 11px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-heading h3 {
  margin: 0;
  font-size: 0.82rem;
}

.source-heading span {
  color: var(--muted-light);
  font-size: 0.56rem;
}

.source-list {
  display: grid;
  gap: 9px;
}

.source-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 150ms ease, transform 150ms ease;
}

.source-card:hover {
  border-color: #b9cec7;
  transform: translateY(-1px);
}

.source-card-top {
  display: flex;
  margin-bottom: 9px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-rank {
  color: var(--teal);
  font-size: 0.63rem;
  font-weight: 900;
}

.source-score {
  padding: 5px 7px;
  border-radius: 999px;
  color: #566214;
  background: var(--lime-soft);
  font-size: 0.54rem;
  font-weight: 850;
}

.source-card h4 {
  margin-bottom: 7px;
  font-size: 0.76rem;
  line-height: 1.35;
}

.source-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 9px;
}

.source-metadata span {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.53rem;
  font-weight: 800;
}

.source-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
}

.source-location {
  margin-top: 9px !important;
  color: var(--teal-dark) !important;
  font-size: 0.59rem !important;
  font-weight: 800;
}

.source-reason {
  margin-top: 9px !important;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted) !important;
  font-size: 0.62rem !important;
}

.source-reason::before {
  content: "Why this source: ";
  color: var(--ink);
  font-weight: 850;
}

.source-quote {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.source-quote summary {
  padding: 8px 9px;
  color: var(--teal-dark);
  font-size: 0.6rem;
  font-weight: 850;
  cursor: pointer;
}

.source-quote blockquote {
  margin: 0;
  padding: 0 10px 10px;
  color: var(--muted);
  font-size: 0.63rem;
  font-style: italic;
  line-height: 1.55;
  white-space: pre-wrap;
}

.source-card a {
  display: inline-block;
  margin-top: 10px;
  color: var(--teal-dark);
  font-size: 0.61rem;
  font-weight: 800;
  text-decoration: none;
}

.source-card a:hover,
.source-card a:focus-visible {
  text-decoration: underline;
}

.learning-section {
  padding-top: clamp(70px, 9vw, 120px);
}

.learning-heading {
  max-width: 720px;
  margin-bottom: 30px;
}

.learning-heading h2 {
  margin: 0 0 14px;
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.learning-heading > p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

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

.learning-grid article {
  min-height: 230px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.learning-grid article:nth-child(2) {
  background: #f8fbe9;
}

.learning-grid article > span {
  display: inline-grid;
  width: 31px;
  height: 31px;
  margin-bottom: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 0.58rem;
  font-weight: 900;
}

.learning-grid article:nth-child(2) > span {
  color: #566214;
  background: var(--lime-soft);
}

.learning-grid h3 {
  margin-bottom: 9px;
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.learning-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

footer {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted-light);
  font-size: 0.62rem;
}

.is-hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .pipeline-card {
    max-width: 700px;
  }

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

  .chat-panel {
    min-height: 720px;
  }

  .evidence-panel {
    min-height: 650px;
  }
}

@media (max-width: 720px) {
  :root {
    --page-pad: 15px;
  }

  .topbar {
    min-height: 72px;
  }

  .system-status > span:not(.status-dot),
  .status-label {
    display: none;
  }

  main {
    padding-top: 48px;
  }

  h1 {
    font-size: clamp(3.15rem, 16vw, 5rem);
  }

  .hero {
    gap: 34px;
  }

  .pipeline-card {
    padding: 21px;
  }

  .chat-panel,
  .evidence-panel {
    border-radius: 15px;
  }

  .panel-header {
    min-height: 86px;
    padding: 20px 18px;
  }

  .suggestion-block {
    padding: 14px 18px;
  }

  .suggestions {
    flex-wrap: nowrap;
    padding-bottom: 3px;
    overflow-x: auto;
  }

  .suggestions button {
    flex: 0 0 auto;
  }

  .messages {
    padding: 21px 18px;
  }

  .message {
    width: 97%;
  }

  .answer-table-wrap {
    margin-right: -2px;
  }

  .composer {
    padding: 13px 13px 31px;
    grid-template-columns: 1fr;
  }

  .composer textarea {
    min-height: 64px;
  }

  .composer > button {
    min-height: 46px;
  }

  .empty-evidence {
    min-height: 540px;
    padding: 42px 20px;
  }

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

  .learning-grid article {
    min-height: 205px;
  }

  footer {
    padding-top: 20px;
    padding-bottom: 20px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 7px;
  }
}

@media (max-width: 430px) {
  .brand-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .trace-stats {
    grid-template-columns: 1fr;
  }

  .empty-flow i {
    display: none;
  }

  .empty-flow {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
