:root {
  --bg: #FFFBDE;
  --surface: #fffef8;
  --surface-2: #fff5ef;
  --surface-3: #FFE3FC;
  --line: #ebd4d1;
  --line-strong: #d9b9bd;
  --text: #493941;
  --muted: #806c74;
  --muted-2: #a08791;
  --mint: #FFADBB;
  --mint-soft: #FFCCBD;
  --blue: #a87fae;
  --amber: #FFB28F;
  --coral: #FFB28F;
  --danger: #d95670;
  --sans: "Manrope", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --brand: "Space Grotesk", "Manrope", sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
}

.hidden {
  display: none !important;
}

.chat-app {
  min-height: 100vh;
}

.app-header {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 248, 0.92);
  padding: 0 24px;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
  font-family: var(--brand);
}

.brand strong {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.brand-mark {
  display: grid;
  position: relative;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #FFCCBD;
}

.brand-mark img {
  width: 37px;
  height: 37px;
  object-fit: contain;
  transform: scale(1.34) translateY(-2%);
}

.header-actions,
.system-status,
.new-chat {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 10px;
}

.system-status {
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.system-status.ready {
  color: var(--mint);
}

.system-status.ready .status-dot {
  background: var(--mint);
  box-shadow: 0 0 10px rgba(111, 255, 211, 0.6);
}

.system-status.error {
  color: var(--danger);
}

.system-status.error .status-dot {
  background: var(--danger);
}

.new-chat {
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  padding: 7px 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  transition: border-color 150ms ease, background 150ms ease;
}

.new-chat:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.new-chat svg {
  width: 14px;
}

.chat-main {
  width: min(100%, 1280px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 64px 34px 0;
}

.welcome {
  display: flex;
  min-height: calc(100vh - 210px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 0 44px;
  text-align: center;
  animation: enter 420ms ease both;
}

.hero-symbol {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 22px;
  border: 1px solid var(--line-strong);
}

.hero-symbol::before,
.hero-symbol::after {
  position: absolute;
  background: var(--mint);
  content: "";
  opacity: 0.75;
}

.hero-symbol::before {
  top: 35px;
  left: 12px;
  width: 48px;
  height: 1px;
  transform: rotate(-22deg);
}

.hero-symbol::after {
  top: 12px;
  left: 35px;
  width: 1px;
  height: 48px;
  transform: rotate(26deg);
}

.hero-symbol span,
.hero-symbol i,
.hero-symbol b,
.hero-symbol em {
  position: absolute;
  z-index: 1;
  width: 8px;
  height: 8px;
  border: 1px solid var(--mint);
  background: var(--bg);
}

.hero-symbol span { top: 40px; left: 7px; }
.hero-symbol i { top: 7px; left: 31px; }
.hero-symbol b { top: 17px; right: 6px; }
.hero-symbol em { right: 15px; bottom: 5px; }

.eyebrow {
  margin: 0;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.15em;
}

.welcome h1 {
  margin: 15px 0 12px;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -0.045em;
}

.welcome-copy {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.suggestions-title {
  width: min(100%, 760px);
  margin: 32px 0 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.suggestions {
  display: grid;
  width: min(100%, 760px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}

.suggestion {
  display: grid;
  min-height: 82px;
  grid-template-columns: 26px 1fr 18px;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.suggestion:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.suggestion-index {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 8px;
}

.suggestion p {
  margin: 0;
  color: #c2d1d2;
  font-size: 10px;
  line-height: 1.55;
}

.suggestion > svg {
  width: 14px;
  color: var(--muted-2);
}

.suggestion-skeleton {
  height: 82px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  animation: breathe 1.25s ease-in-out infinite;
}

.messages {
  padding-top: 34px;
}

.message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 13px;
  margin-bottom: 32px;
  animation: enter 260ms ease both;
}

.user-message {
  display: flex;
  justify-content: flex-end;
  padding-left: 80px;
}

.user-bubble {
  max-width: 76%;
  border: 1px solid var(--line-strong);
  border-radius: 9px 9px 2px 9px;
  background: var(--surface-2);
  padding: 12px 15px;
  color: #e2eceb;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.avatar {
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.agent-avatar {
  border-color: rgba(111, 255, 211, 0.45);
}

.agent-avatar > span {
  position: relative;
  width: 18px;
  height: 18px;
}

.agent-avatar i {
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1px solid var(--mint);
  background: var(--surface);
}

.agent-avatar i:nth-child(1) { top: 7px; left: 0; }
.agent-avatar i:nth-child(2) { top: 0; left: 7px; }
.agent-avatar i:nth-child(3) { right: 0; bottom: 0; }

.agent-avatar > span::before,
.agent-avatar > span::after {
  position: absolute;
  height: 1px;
  background: var(--mint);
  content: "";
  transform-origin: left center;
}

.agent-avatar > span::before {
  top: 9px;
  left: 4px;
  width: 9px;
  transform: rotate(-40deg);
}

.agent-avatar > span::after {
  top: 4px;
  left: 10px;
  width: 9px;
  transform: rotate(56deg);
}

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

.message-author {
  display: flex;
  height: 34px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.message-author strong {
  font-size: 11px;
  font-weight: 600;
}

.run-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.run-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1s ease-in-out infinite;
}

.run-state.complete {
  color: var(--mint);
}

.run-state.complete i {
  animation: none;
}

.run-state.error {
  color: var(--danger);
}

.agent-response {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.workflow-block {
  background: var(--surface);
}

.workflow-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
}

.workflow-toggle > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workflow-toggle svg {
  width: 14px;
}

.workflow-toggle > span svg {
  color: var(--mint);
}

.workflow-content {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-step {
  position: relative;
  min-width: 0;
  padding-top: 28px;
  color: var(--muted-2);
  text-align: center;
}

.workflow-step:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 10px;
  left: calc(50% + 10px);
  width: calc(100% - 20px);
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.step-marker {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  display: flex;
  width: 21px;
  height: 21px;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 7px;
}

.workflow-step strong {
  display: block;
  overflow: hidden;
  padding: 0 3px;
  font-size: 8px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-step.running {
  color: var(--amber);
}

.workflow-step.running .step-marker {
  border-color: var(--amber);
  animation: stage-pulse 1s ease-in-out infinite;
}

.workflow-step.complete {
  color: #a9c1c3;
}

.workflow-step.complete .step-marker {
  border-color: var(--mint);
  background: var(--mint);
  color: #493941;
}

.workflow-step.complete:not(:last-child)::after {
  background: rgba(111, 255, 211, 0.45);
}

.process-output {
  margin-top: 13px;
  border-left: 2px solid var(--line-strong);
  background: #fff9f3;
  padding: 10px 11px;
  animation: fade 180ms ease both;
}

.output-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.output-title > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.output-title svg {
  width: 12px;
  color: var(--mint);
}

.output-title code {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.normalized-question {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.entity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff5ef;
  padding: 4px 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 7px;
}

.entity-chip::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mint);
  content: "";
}

.entity-chip small {
  color: var(--muted-2);
  font-size: 6px;
}

.retrieval-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.metric {
  border: 1px solid var(--line);
  padding: 7px;
}

.metric span,
.metric strong {
  display: block;
  font-family: var(--mono);
}

.metric span {
  color: var(--muted-2);
  font-size: 6px;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 3px;
  color: var(--mint-soft);
  font-size: 12px;
  font-weight: 500;
}

.kg-explorer {
  margin-top: 13px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.kg-explorer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--mint-soft);
  font-family: var(--mono);
  font-size: 8px;
}

.kg-explorer-title small {
  color: var(--muted-2);
  font-size: 7px;
}

.graph-layout {
  display: grid;
  overflow: hidden;
  height: 560px;
  min-height: 560px;
  grid-template-columns: minmax(0, 1.65fr) minmax(440px, 1fr);
  border: 1px solid var(--line);
  background: #fffdf8;
}

.kg-graph {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.graph-inspector {
  overflow: auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.graph-inspector > p {
  margin: 0;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.6;
}

.inspector-node,
.inspector-edge {
  display: grid;
  gap: 12px;
}

.inspector-node small,
.inspector-edge small {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 7px;
}

.inspector-node strong,
.inspector-edge strong {
  color: var(--text);
  font-size: 11px;
}

.inspector-node code,
.inspector-node span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
}

.edge-layer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.edge-layer-badges span {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 4px 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.edge-layer-badges .paper_l1 {
  border-color: rgba(182, 150, 255, 0.55);
  color: #c9afff;
}

.inspector-edge > button {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-2);
  padding: 7px;
  color: var(--mint-soft);
  cursor: pointer;
  font-size: 8px;
}

.relation-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.relation-badges {
  gap: 4px;
}

.relation-badge {
  border-radius: 2px;
  background: rgba(125, 186, 255, 0.1);
  padding: 2px 5px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 6px;
}

.relation-badge.muted {
  color: var(--muted-2);
}

.edge-detail {
  border-top: 1px solid var(--line);
  padding: 9px;
}

.edge-detail-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 6px;
}

.edge-detail-header svg {
  width: 11px;
}

.relation-group,
.edge-level-pmids,
.unmapped-evidence {
  border: 1px solid var(--line);
  background: #fffdf8;
}

.relation-group + .relation-group,
.edge-level-pmids,
.unmapped-evidence {
  margin-top: 6px;
}

.relation-group summary,
.edge-level-pmids summary,
.unmapped-evidence summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  color: var(--blue);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 7px;
  list-style: none;
}

.relation-group summary small {
  color: var(--muted-2);
  font-size: 6px;
}

.raw-relations {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 8px 7px;
}

.raw-relations span {
  width: 100%;
  color: var(--muted-2);
  font-size: 7px;
}

.raw-relations code {
  border: 1px solid var(--line);
  padding: 2px 4px;
  color: #9eb0b5;
  font-size: 6px;
}

.paper-list {
  display: grid;
  gap: 5px;
  padding: 0 8px 8px;
}

.paper-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.paper-item a,
.edge-level-pmids a {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 7px;
  text-decoration: none;
}

.paper-item a:hover,
.edge-level-pmids a:hover {
  text-decoration: underline;
}

.paper-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 6px;
}

.condition-button {
  align-self: start;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface-2);
  padding: 5px 6px;
  color: var(--mint-soft);
  cursor: pointer;
  font-size: 7px;
}

.condition-button:disabled {
  color: var(--muted-2);
  cursor: wait;
}

.condition-result {
  grid-column: 1 / -1;
  border-left: 2px solid var(--blue);
  background: var(--surface);
  padding: 8px;
}

.condition-disclosure {
  border: 1px solid var(--line);
  background: #fffdf8;
}

.condition-disclosure > summary {
  padding: 9px 10px;
  color: var(--blue);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
}

.condition-disclosure-body {
  border-top: 1px solid var(--line);
  padding: 10px;
}

.condition-paper {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
}

.condition-paper strong {
  color: #dce9e8;
  font-size: 9px;
  line-height: 1.5;
}

.condition-paper small {
  color: var(--muted);
  font-size: 7px;
}

.condition-set + .condition-set {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.condition-set > strong {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 7px;
}

.condition-set dl {
  display: grid;
  gap: 5px;
  margin: 7px 0;
}

.condition-set dl > div {
  display: grid;
  grid-template-columns: minmax(95px, 0.35fr) minmax(0, 1fr);
  gap: 7px;
}

.condition-set dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 6px;
}

.condition-set dd {
  margin: 0;
  color: #c3d1d2;
  font-size: 7px;
  line-height: 1.5;
}

.condition-set q,
.condition-set blockquote {
  display: block;
  margin: 4px 0 0;
  color: #839aa2;
  font-size: 7px;
  font-style: normal;
  line-height: 1.5;
}

.condition-set blockquote {
  border-left: 1px solid var(--line-strong);
  padding-left: 7px;
}

.condition-status {
  margin-right: 4px;
  border-radius: 2px;
  padding: 1px 3px;
  background: rgba(111, 255, 211, 0.08);
  color: var(--mint);
  font-family: var(--mono);
  font-size: 6px;
}

.condition-status.not_reported,
.condition-status.not_applicable {
  background: rgba(138, 160, 170, 0.08);
  color: var(--muted);
}

.edge-level-pmids,
.unmapped-evidence {
  padding: 0 8px 8px;
  color: var(--muted);
  font-size: 7px;
  line-height: 1.55;
}

.edge-level-pmids summary,
.unmapped-evidence summary {
  margin: 0 -8px;
}

.edge-level-pmids > .paper-list {
  display: grid;
  gap: 6px;
}

.unmapped-relation-block + .unmapped-relation-block {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.unmapped-relation-block > p {
  margin: 0 0 7px;
}

.paper-score {
  color: #c9afff !important;
}

.conflict-panel {
  margin-bottom: 10px;
  border: 1px solid rgba(255, 94, 112, 0.48);
  background: rgba(255, 94, 112, 0.06);
  padding: 11px;
}

.conflict-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conflict-heading span {
  color: #ff8492;
  font-family: var(--mono);
  font-size: 11px;
}

.conflict-heading strong {
  color: #ffc1c8;
  font-size: 13px;
}

.conflict-panel > p {
  margin: 8px 0;
  color: #e4adb3;
  font-family: var(--mono);
  font-size: 11px;
}

.conflict-panel > p span {
  margin: 0 5px;
  color: var(--muted);
}

.conflict-decision {
  border-left: 3px solid var(--amber);
  background: var(--surface);
  padding: 9px;
}

.conflict-decision.TRUE_CONFLICT {
  border-left-color: var(--danger);
}

.conflict-decision.CONTEXT_DEPENDENT_DIFFERENCE {
  border-left-color: var(--blue);
}

.conflict-decision.RELATION_MAPPING_ERROR {
  border-left-color: var(--amber);
}

.conflict-decision strong {
  color: var(--text);
  font-size: 13px;
}

.conflict-decision p {
  margin: 6px 0;
  color: #c3d1d2;
  font-size: 12px;
  line-height: 1.6;
}

.conflict-decision small {
  color: var(--muted);
  font-size: 11px;
}

.conflict-paper-summary {
  margin-top: 7px;
}

.conflict-paper-summary summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.conflict-paper-summary > div {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.conflict-paper-summary a {
  color: var(--mint);
  font-size: 11px;
  text-decoration: none;
}

.unmapped-evidence code {
  color: var(--amber);
}

.paper-empty,
.condition-empty,
.loading-evidence,
.evidence-error {
  margin: 0;
  color: var(--muted-2);
  font-size: 7px;
  line-height: 1.6;
}

.evidence-error {
  color: var(--danger);
}

.answer-block {
  border-top: 1px solid var(--line);
  padding: 20px 18px 11px;
  animation: enter 240ms ease both;
}

.answer-text {
  margin: 0;
  color: #e4eeec;
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.answer-points {
  display: grid;
  gap: 7px;
  margin-top: 17px;
}

.answer-point {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 7px;
  color: #a6b9be;
  font-size: 10px;
  line-height: 1.6;
}

.answer-point span:first-child {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 8px;
}

.answer-caveat {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  border-left: 2px solid var(--amber);
  background: rgba(239, 199, 120, 0.05);
  padding: 9px 10px;
  color: #b8aa88;
}

.answer-caveat svg {
  width: 13px;
  flex: 0 0 auto;
}

.answer-caveat p {
  margin: 0;
  font-size: 9px;
  line-height: 1.55;
}

.evidence-details {
  margin-top: 17px;
  border-top: 1px solid var(--line);
}

.evidence-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  list-style: none;
}

.evidence-details summary::-webkit-details-marker {
  display: none;
}

.evidence-details summary > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.evidence-details summary svg {
  width: 13px;
}

.evidence-total {
  font-family: var(--mono);
  font-size: 7px;
}

.evidence-list {
  display: grid;
  gap: 6px;
  padding-bottom: 5px;
}

.evidence-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px;
}

.evidence-index {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 7px;
}

.evidence-triple {
  color: #becfd0;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.55;
}

.evidence-triple strong {
  color: var(--mint-soft);
  font-weight: 500;
}

.evidence-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 7px;
}

.answer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
}

.answer-meta > div {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.confidence-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
}

.icon-button {
  position: relative;
  display: inline-flex;
  width: 29px;
  height: 29px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.icon-button svg {
  width: 13px;
}

[data-tooltip]::after {
  position: absolute;
  z-index: 50;
  top: calc(100% + 5px);
  left: 50%;
  visibility: hidden;
  width: max-content;
  transform: translateX(-50%) translateY(-2px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-3);
  padding: 4px 6px;
  color: var(--text);
  content: attr(data-tooltip);
  font-size: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

[data-tooltip]:hover::after {
  visibility: visible;
  transform: translateX(-50%);
  opacity: 1;
}

.bottom-space {
  height: 185px;
}

.composer-dock {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(255, 254, 248, 0.95);
  padding: 13px 24px 10px;
  backdrop-filter: blur(15px);
}

.composer {
  width: min(100%, 880px);
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-2);
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.2);
  padding: 12px 12px 9px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.composer:focus-within {
  border-color: rgba(111, 255, 211, 0.7);
  box-shadow: 0 0 0 3px rgba(111, 255, 211, 0.05), 0 -16px 42px rgba(0, 0, 0, 0.2);
}

.composer textarea {
  width: 100%;
  max-height: 150px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.composer textarea::placeholder {
  color: #647b86;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
}

.composer-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.5;
}

.composer-hint svg {
  width: 12px;
  flex-shrink: 0;
}

.send-button {
  display: inline-flex;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mint);
  border-radius: 6px;
  background: var(--mint);
  color: #493941;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.send-button:hover {
  transform: translateY(-1px);
  background: var(--mint-soft);
}

.send-button:disabled {
  transform: none;
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--muted);
  cursor: wait;
}

.send-button svg {
  width: 16px;
}

.disclaimer {
  width: min(100%, 880px);
  margin: 7px auto 0;
  color: var(--muted-2);
  font-size: 7px;
  text-align: center;
}

@keyframes enter {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.78; }
}

@keyframes stage-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 199, 120, 0); }
  50% { box-shadow: 0 0 0 4px rgba(239, 199, 120, 0.08); }
}

@media (max-width: 680px) {
  .app-header {
    padding: 0 14px;
  }

  .brand small,
  .system-status,
  .new-chat span {
    display: none;
  }

  .new-chat {
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
  }

  .chat-main {
    padding-right: 15px;
    padding-left: 15px;
  }

  .welcome {
    padding-top: 45px;
  }

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

  .message {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
  }

  .avatar {
    width: 30px;
    height: 30px;
  }

  .user-message {
    padding-left: 30px;
  }

  .user-bubble {
    max-width: 90%;
  }

  .workflow-steps {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .workflow-step {
    min-height: 39px;
    padding: 3px 0 0 30px;
    text-align: left;
  }

  .workflow-step:not(:last-child)::after {
    top: 19px;
    bottom: 0;
    left: 10px;
    width: 1px;
    height: 23px;
  }

  .step-marker {
    top: 0;
    left: 10px;
  }

  .workflow-step strong {
    padding-top: 3px;
  }

  .retrieval-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .graph-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .kg-graph {
    height: 360px;
    min-height: 360px;
  }

  .graph-inspector {
    min-height: 220px;
    height: auto;
    max-height: 440px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .paper-item {
    grid-template-columns: 1fr;
  }

  .condition-result,
  .condition-set dl > div {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .composer-dock {
    padding-right: 14px;
    padding-left: 14px;
  }
}

/* Readable application typography. The original prototype used 6–10 px
   labels; these sizes follow normal web UI ranges while keeping metadata
   visually secondary. */
.brand strong { font-size: 18px; }
.brand small { font-size: 11px; }
.system-status { font-size: 12px; }
.new-chat { font-size: 14px; }
.eyebrow { font-size: 12px; }
.welcome-copy { font-size: 16px; }
.suggestion-index { font-size: 12px; }
.suggestion p { font-size: 15px; }
.user-bubble { font-size: 16px; }
.message-author strong { font-size: 15px; }
.run-state { font-size: 12px; }
.workflow-toggle > span { font-size: 13px; }
.step-marker { font-size: 12px; }
.workflow-step strong { font-size: 13px; }
.output-title { font-size: 13px; }
.output-title code { font-size: 12px; }
.normalized-question { font-size: 14px; }
.entity-chip { font-size: 13px; }
.entity-chip small { font-size: 11px; }
.metric span { font-size: 12px; }
.metric strong { font-size: 20px; }
.kg-explorer-title { font-size: 14px; }
.kg-explorer-title small { font-size: 12px; }
.graph-inspector > p { font-size: 14px; }
.inspector-node small,
.inspector-edge small { font-size: 12px; }
.inspector-node strong,
.inspector-edge strong { font-size: 16px; }
.inspector-node code,
.inspector-node span { font-size: 12px; }
.relation-badge { font-size: 11px; }
.edge-detail-header { font-size: 11px; }
.relation-group summary,
.edge-level-pmids summary,
.unmapped-evidence summary { font-size: 12px; }
.relation-group summary small { font-size: 11px; }
.raw-relations span { font-size: 12px; }
.raw-relations code { font-size: 11px; }
.paper-item a,
.edge-level-pmids a { font-size: 12px; }
.paper-item small { font-size: 11px; }
.condition-button { font-size: 12px; }
.condition-paper strong { font-size: 14px; }
.condition-paper small { font-size: 12px; }
.condition-set > strong { font-size: 12px; }
.condition-set dt { font-size: 11px; }
.condition-set dd { font-size: 13px; }
.condition-set q,
.condition-set blockquote { font-size: 12px; }
.condition-status { font-size: 11px; }
.edge-level-pmids,
.unmapped-evidence { font-size: 12px; }
.paper-empty,
.condition-empty,
.loading-evidence,
.evidence-error { font-size: 12px; }
.answer-text { font-size: 16px; }
.answer-point { font-size: 14px; }
.answer-point span:first-child { font-size: 12px; }
.answer-caveat p { font-size: 13px; }
.evidence-details summary { font-size: 14px; }
.evidence-total { font-size: 12px; }
.evidence-index { font-size: 12px; }
.evidence-triple { font-size: 13px; }
.evidence-item small { font-size: 12px; }
.answer-meta { font-size: 12px; }
[data-tooltip]::after { font-size: 12px; }
.composer { width: min(100%, 1120px); }
.composer textarea { font-size: 16px; }
.composer-hint,
.disclaimer { font-size: 12px; }
.disclaimer { width: min(100%, 1120px); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Bright macaron / Morandi visual system. */
body {
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 227, 252, 0.72), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(255, 204, 189, 0.62), transparent 30%),
    linear-gradient(180deg, #fffef8 0%, #FFFBDE 100%);
}

.app-header {
  box-shadow: 0 8px 32px rgba(121, 87, 98, 0.08);
}

.brand strong {
  font-family: var(--brand);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand small {
  color: #8d737d;
  font-family: var(--brand);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.hero-symbol {
  display: grid;
  width: 98px;
  height: 98px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 30px;
  background: linear-gradient(145deg, #FFCCBD, #FFE3FC);
  box-shadow: 0 18px 42px rgba(119, 83, 96, 0.16);
}

.hero-symbol::before,
.hero-symbol::after {
  display: none;
}

.hero-symbol img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  transform: scale(1.32) translateY(-2%);
}

.eyebrow {
  color: #9b6c7b;
  font-family: var(--brand);
  font-weight: 600;
}

.welcome h1 {
  color: #47363e;
}

.suggestion {
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(119, 83, 96, 0.07);
}

.suggestion:nth-child(4n + 1) { background: rgba(255, 204, 189, 0.58); }
.suggestion:nth-child(4n + 2) { background: rgba(255, 227, 252, 0.58); }
.suggestion:nth-child(4n + 3) { background: rgba(255, 178, 143, 0.34); }
.suggestion:nth-child(4n) { background: rgba(255, 173, 187, 0.32); }

.suggestion:hover {
  border-color: #d7b2ba;
  background: #fffef9;
  box-shadow: 0 18px 38px rgba(119, 83, 96, 0.12);
}

.suggestion p,
.user-bubble,
.message {
  color: var(--text);
}

.user-bubble {
  border: 1px solid rgba(217, 185, 189, 0.8);
  background: linear-gradient(135deg, #FFCCBD, #FFE3FC);
  box-shadow: 0 10px 24px rgba(119, 83, 96, 0.08);
}

.agent-avatar {
  border-color: #d7b2ba;
  background: #FFFBDE;
}

.agent-response,
.process-output,
.answer-block {
  box-shadow: 0 12px 34px rgba(119, 83, 96, 0.07);
}

.workflow-step.complete .step-marker,
.send-button {
  background: #FFADBB;
  border-color: #FFADBB;
  color: #493941;
}

.entity-list {
  display: grid;
  gap: 14px;
}

.recognized-entities,
.query-targets,
.linked-entities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recognized-entities > p,
.query-targets > p,
.linked-entities > p {
  width: 100%;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.query-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px dashed #8A91A0;
  border-radius: 14px;
  background: rgba(205, 211, 222, 0.5);
  padding: 7px 10px;
  color: #38445A;
  font-size: 12px;
}

.query-target-chip small {
  border-radius: 999px;
  background: #59677F;
  padding: 3px 7px;
  color: #F2E5E0;
  font-family: var(--mono);
  font-size: 9px;
}

.recognized-entities article {
  display: grid;
  grid-template-columns: auto 15px auto auto;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  padding: 8px 10px;
  color: var(--text);
}

.recognized-entities article svg {
  width: 13px;
  color: #b88a99;
}

.recognized-entities article strong {
  font-family: var(--brand);
  font-size: 14px;
}

.recognized-entities article small {
  border-radius: 10px;
  background: #FFE3FC;
  padding: 3px 6px;
  color: #725e67;
  font-size: 10px;
}

.entity-chip {
  border-radius: 14px;
  background: #FFFBDE;
  box-shadow: 0 5px 16px rgba(119, 83, 96, 0.06);
}

.kg-explorer-title {
  gap: 14px;
  color: var(--text);
  font-family: var(--brand);
}

.kg-explorer-title > div:first-child {
  display: grid;
  gap: 3px;
}

.graph-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
}

.graph-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
}

.legend-line {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: #68758C;
}

.legend-line.paper {
  height: 4px;
  background: #D3A26F;
}

.legend-line.l1 {
  background: #B98E99;
}

.legend-line.conflict {
  height: 4px;
  background: #C86F7D;
}

.legend-line.regular {
  background: #A9B2C4;
}

.graph-view-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #222838;
}

.graph-controls .graph-view-toggle button {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.graph-controls .graph-view-toggle button + button {
  border-left: 1px solid var(--line);
}

.graph-controls .graph-view-toggle button.active {
  background: #59677F;
  color: #F2E5E0;
}

.graph-controls button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 7px 10px;
  color: #725e67;
  cursor: pointer;
  font-family: var(--brand);
  font-size: 12px;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.graph-controls button:hover {
  transform: translateY(-1px);
  background: #FFE3FC;
  box-shadow: 0 8px 18px rgba(119, 83, 96, 0.1);
}

.graph-controls svg {
  width: 14px;
  height: 14px;
}

.graph-layout {
  height: 640px;
  min-height: 640px;
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 16px 42px rgba(119, 83, 96, 0.1);
}

.kg-graph {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 251, 222, 0.95), transparent 42%),
    radial-gradient(circle at 24% 24%, rgba(255, 227, 252, 0.52), transparent 35%),
    radial-gradient(circle at 78% 78%, rgba(255, 204, 189, 0.45), transparent 34%),
    #fffefb;
}

.graph-inspector {
  background: rgba(255, 254, 248, 0.94);
}

.feature-summary {
  margin: 0;
  border-radius: 12px;
  background: #FFFBDE;
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.feature-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
}

.feature-section + .feature-section {
  margin-top: 8px;
}

.feature-section > summary {
  padding: 10px 12px;
  background: linear-gradient(90deg, rgba(255, 204, 189, 0.5), rgba(255, 227, 252, 0.42));
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.feature-section > p {
  margin: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}

.feature-record {
  display: grid;
  gap: 6px;
  margin: 9px;
  border: 1px solid #efdedb;
  border-radius: 12px;
  background: #fffefb;
  padding: 10px;
}

.feature-record header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.feature-record strong {
  color: var(--text);
  font-size: 13px;
}

.feature-record small,
.feature-record p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.feature-record code {
  overflow-wrap: anywhere;
  color: #956d7a;
  font-size: 10px;
}

.feature-json {
  overflow: auto;
  max-height: 280px;
  margin: 2px 0 0;
  border-radius: 9px;
  background: #fff7f1;
  padding: 9px;
  color: #5e4a52;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.edge-feature-section {
  margin-top: 9px;
}

.source-file-records {
  margin: 9px;
  color: var(--muted);
  font-size: 11px;
}

.composer {
  border-radius: 20px;
  background: rgba(255, 254, 248, 0.96);
  box-shadow: 0 -8px 38px rgba(119, 83, 96, 0.1);
}

.composer:focus-within {
  border-color: #FFADBB;
  box-shadow: 0 0 0 4px rgba(255, 173, 187, 0.14), 0 -8px 38px rgba(119, 83, 96, 0.1);
}

.composer textarea::placeholder {
  color: #a58d96;
}

@media (max-width: 900px) {
  .graph-layout {
    height: auto;
    min-height: 0;
  }

  .kg-graph {
    height: 520px;
  }

  .graph-controls span {
    display: none;
  }
}

/* Information-first color system.
   Large UI fills use only four colors:
   #fffef8 (content), #FFFBDE (canvas), #FFCCBD (primary accent),
   and #FFE3FC (secondary accent). Red remains a semantic conflict signal
   on narrow strokes/text only, never as a large content block. */
:root {
  --bg: #FFFBDE;
  --surface: #fffef8;
  --surface-2: #fffef8;
  --surface-3: #FFE3FC;
  --text: #2F272B;
  --muted: #62565C;
  --muted-2: #7B6D74;
  --mint: #73545E;
  --mint-soft: #493D43;
  --blue: #655767;
  --amber: #8A6151;
  --coral: #73545E;
  --line: #E4D8D4;
  --line-strong: #CDBDBA;
}

/* Keep the atmospheric page gradient, but make information containers quiet. */
.suggestion:nth-child(n),
.user-bubble,
.agent-response,
.workflow-block,
.process-output,
.answer-block,
.answer-caveat,
.evidence-item,
.metric,
.graph-inspector,
.relation-group,
.edge-level-pmids,
.unmapped-evidence,
.condition-result,
.condition-disclosure,
.feature-section,
.feature-record,
.composer {
  color: var(--text);
}

.suggestion:nth-child(odd) {
  background: rgba(255, 204, 189, 0.52);
}

.suggestion:nth-child(even) {
  background: rgba(255, 227, 252, 0.5);
}

.user-bubble {
  background: #FFCCBD;
}

.agent-response,
.workflow-block,
.process-output,
.answer-block,
.graph-inspector,
.relation-group,
.edge-level-pmids,
.unmapped-evidence,
.condition-result,
.condition-disclosure,
.feature-section,
.feature-record,
.evidence-item {
  background: #fffef8;
}

.process-output {
  border-color: var(--line);
}

.workflow-step.complete {
  color: var(--muted);
}

.workflow-step.complete .step-marker,
.send-button {
  border-color: #CDBDBA;
  background: #FFCCBD;
  color: var(--text);
}

.workflow-step.complete:not(:last-child)::after {
  background: #CDBDBA;
}

.normalized-question,
.entity-chip,
.metric,
.feature-summary,
.condition-status,
.answer-caveat {
  background: #FFFBDE;
}

.recognized-entities article,
.graph-controls button {
  background: #fffef8;
}

.recognized-entities article small,
.relation-badge,
.feature-section > summary {
  background: #FFE3FC;
  color: #514550;
}

.entity-chip::before {
  background: #73545E;
}

.metric strong,
.output-title > span,
.workflow-toggle > span,
.kg-explorer-title,
.inspector-node strong,
.inspector-edge strong {
  color: var(--text);
}

.kg-graph {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 251, 222, 0.92), transparent 44%),
    radial-gradient(circle at 26% 25%, rgba(255, 227, 252, 0.4), transparent 36%),
    radial-gradient(circle at 76% 76%, rgba(255, 204, 189, 0.36), transparent 35%),
    #fffef8;
}

.graph-controls button:hover {
  background: #FFE3FC;
}

/* Answers and evidence carry the highest text contrast. */
.answer-text {
  color: #2F272B;
  font-weight: 600;
}

.answer-point,
.answer-point strong,
.answer-caveat,
.evidence-triple,
.evidence-triple strong,
.condition-paper strong,
.condition-set dd,
.condition-set q,
.condition-set blockquote {
  color: #3A3035;
}

.answer-point span:first-child,
.evidence-index,
.paper-item a,
.edge-level-pmids a {
  color: #654B55;
}

.answer-meta,
.evidence-item small,
.paper-item small,
.condition-paper small,
.condition-set dt {
  color: var(--muted);
}

.feature-json {
  background: #FFFBDE;
  color: #3A3035;
}

.composer:focus-within {
  border-color: #CDBDBA;
  box-shadow: 0 0 0 4px rgba(255, 204, 189, 0.28),
    0 -8px 38px rgba(119, 83, 96, 0.08);
}

.graph-layout,
.suggestion:hover,
.conflict-panel,
.conflict-decision {
  background: #fffef8;
}

.conflict-panel {
  border-color: var(--danger);
}

.condition-status.not_reported,
.condition-status.not_applicable {
  background: #FFFBDE;
}

.send-button:hover,
.icon-button:hover {
  background: #FFE3FC;
  color: var(--text);
}

.edge-layer-badges .paper_l1,
.paper-score,
.relation-group summary,
.edge-level-pmids summary,
.unmapped-evidence summary,
.condition-disclosure > summary,
.condition-set > strong {
  color: #655767 !important;
}

.conflict-decision p {
  color: #3A3035;
}

/* Calm 2D graph viewport. Nodes use fixed concentric layers; dragging pans the
   canvas and clicking a node recentres the viewport without disturbing it. */
.kg-graph {
  position: relative;
  overflow: hidden;
  cursor: grab;
  isolation: isolate;
  touch-action: none;
}

.kg-graph:active {
  cursor: grabbing;
}

.kg-graph canvas {
  display: block;
  outline: 0;
}

/* Screen-facing labels projected from the frozen XYZ graph. The DOM hit areas
   are intentionally larger than the rendered spheres and lines. */
.graph-label-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.graph-node-label,
.graph-link-label {
  position: absolute;
  max-width: 180px;
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid transparent;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease,
    color 120ms ease, box-shadow 120ms ease;
}

/* In 2D the label is visual only so pointer input reaches the canvas node
   underneath it. This keeps click-to-focus and node dragging reliable. */
.graph-mode-2d .graph-node-label {
  pointer-events: none;
}

.graph-node-label {
  z-index: 2;
  border-color: rgba(238, 218, 211, 0.5);
  border-radius: 9px;
  background: rgba(238, 218, 211, 0.88);
  padding: 4px 8px;
  color: #222838;
  box-shadow: 0 3px 12px rgba(17, 21, 31, 0.2);
  font-family: var(--brand);
  font-size: 11px;
  font-weight: 600;
}

.graph-link-label {
  z-index: 1;
  border-color: rgba(126, 140, 165, 0.5);
  border-radius: 7px;
  background: rgba(34, 40, 56, 0.82);
  padding: 3px 7px;
  color: #EEDAD3;
  font-family: var(--mono);
  font-size: 9px;
}

.graph-link-label.l1 {
  border-color: rgba(185, 142, 153, 0.78);
}

.graph-link-label.paper-evidence {
  border-color: #D3A26F;
  color: #F2D2A8;
  box-shadow: 0 0 0 1px rgba(211, 162, 111, 0.16);
}

.graph-link-label.conflict {
  border-color: #C86F7D;
  color: #F1C3C9;
}

.graph-node-label:hover,
.graph-node-label.hovered,
.graph-node-label.selected,
.graph-link-label:hover,
.graph-link-label.hovered,
.graph-link-label.selected {
  z-index: 6;
  border-color: #EEDAD3;
  box-shadow: 0 5px 18px rgba(13, 17, 26, 0.34);
}

.graph-node-label.selected {
  border-color: #FFCE74;
  background: #FFCE74;
  color: #222838;
}

.graph-node-label.central {
  border-color: #F08DA6;
  background: #F08DA6;
  color: #222838;
  box-shadow: 0 0 0 3px rgba(240, 141, 166, 0.2),
    0 5px 18px rgba(13, 17, 26, 0.28);
}

.graph-node-label.central.selected {
  border-color: #FFCE74;
  background: #FFCE74;
}

.graph-node-label.connected,
.graph-link-label.connected {
  border-color: #B98E99;
}

/* Long-session theme: deep blue-grey + muted nude pink, with only subdued
   analogous blue and pink supporting tones. */
:root {
  --bg: #EEDAD3;
  --surface: #F2E5E0;
  --surface-2: #E7D3CF;
  --surface-3: #CDD3DE;
  --line: #CDB8B5;
  --line-strong: #AFA0A3;
  --text: #222838;
  --muted: #5E6270;
  --muted-2: #777784;
  --mint: #59677F;
  --mint-soft: #39445A;
  --blue: #59677F;
  --amber: #9B6F78;
  --coral: #A97581;
  --danger: #C86F7D;
}

body {
  background: #D8D1D2;
  color: #222838;
}

.app-header {
  border-bottom-color: #39445A;
  background: rgba(34, 40, 56, 0.96);
  box-shadow: 0 8px 30px rgba(24, 29, 42, 0.18);
}

.brand,
.brand strong,
.brand small,
.system-status,
.system-status.ready {
  color: #EEDAD3;
}

.brand-mark,
.hero-symbol,
.agent-avatar {
  border-color: #BFA9A7;
  background: #EEDAD3;
}

.brand-mark img,
.hero-symbol img,
.agent-avatar img {
  object-fit: contain;
  transform: scale(1.34) translateY(-1%);
}

.agent-avatar img {
  width: 100%;
  height: 100%;
}

.agent-avatar > span {
  display: none;
}

.new-chat {
  border-color: #596277;
  background: #30384B;
  color: #EEDAD3;
}

.new-chat:hover {
  border-color: #8F9AAF;
  background: #39445A;
}

.welcome h1,
.welcome-copy,
.eyebrow {
  color: #222838;
}

.suggestion:nth-child(n) {
  border-color: rgba(74, 82, 103, 0.22);
  background: rgba(238, 218, 211, 0.74);
  color: #222838;
}

.suggestion:nth-child(even) {
  background: rgba(205, 211, 222, 0.68);
}

.suggestion:hover {
  border-color: #7E8CA5;
  background: #E7D3CF;
}

.user-bubble {
  border-color: #222838;
  background: #222838;
  color: #EEDAD3;
  box-shadow: 0 10px 26px rgba(34, 40, 56, 0.18);
}

.agent-response,
.workflow-block,
.process-output,
.answer-block,
.relation-group,
.edge-level-pmids,
.unmapped-evidence,
.condition-result,
.condition-disclosure,
.feature-section,
.feature-record,
.evidence-item,
.composer {
  border-color: #CDB8B5;
  background: #F2E5E0;
  color: #222838;
}

.process-output,
.normalized-question,
.entity-chip,
.metric,
.feature-summary,
.condition-status,
.answer-caveat {
  background: #E7D3CF;
}

.recognized-entities article,
.graph-controls button {
  background: #F2E5E0;
}

.recognized-entities article small,
.relation-badge,
.feature-section > summary,
.graph-controls button:hover,
.send-button:hover,
.icon-button:hover {
  background: #CDD3DE;
  color: #222838;
}

.workflow-step.complete .step-marker,
.send-button {
  border-color: #222838;
  background: #222838;
  color: #EEDAD3;
}

.workflow-step.complete:not(:last-child)::after {
  background: #8A91A0;
}

.answer-text,
.answer-point,
.answer-point strong,
.answer-caveat,
.evidence-triple,
.evidence-triple strong,
.condition-paper strong,
.condition-set dd,
.condition-set q,
.condition-set blockquote {
  color: #222838;
}

.answer-point span:first-child,
.evidence-index,
.paper-item a,
.edge-level-pmids a,
.output-title > span {
  color: #4C5A73;
}

.graph-layout {
  border-color: #4D566B;
  background: #222838;
  box-shadow: 0 16px 40px rgba(34, 40, 56, 0.2);
}

.kg-graph {
  background: #222838;
}

.graph-inspector {
  border-color: #AFA0A3;
  background: #E7D3CF;
  color: #222838;
}

.feature-json,
.condition-status.not_reported,
.condition-status.not_applicable {
  background: #D9C8C5;
  color: #222838;
}

/* Structured node/edge attributes replace raw JSON in the inspector. */
.readable-features {
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid #CDB8B5;
  border-radius: 10px;
  background: rgba(242, 229, 224, 0.72);
}

.readable-features h5 {
  margin: 0;
  border-bottom: 1px solid #CDB8B5;
  background: #D9C8C5;
  padding: 8px 10px;
  color: #4C5A73;
  font-family: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.feature-fields {
  display: grid;
  margin: 0;
}

.feature-fields.nested {
  width: 100%;
  border: 1px solid rgba(175, 160, 163, 0.55);
  border-radius: 8px;
  background: rgba(231, 211, 207, 0.42);
}

.feature-field {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
}

.feature-field + .feature-field {
  border-top: 1px solid rgba(205, 184, 181, 0.7);
}

.feature-field dt,
.feature-field dd {
  min-width: 0;
  margin: 0;
}

.feature-field dt {
  color: #5E6270;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
}

.feature-field dd,
.feature-value {
  overflow-wrap: anywhere;
  color: #222838;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.55;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.feature-tags > span,
.feature-boolean {
  border-radius: 999px;
  background: #CDD3DE;
  padding: 3px 7px;
  color: #38445A;
  font-size: 11px;
}

.feature-boolean.no {
  background: #D9C8C5;
  color: #777784;
}

.feature-empty {
  color: #777784;
  font-size: 11px;
  font-style: italic;
}

.feature-list {
  display: grid;
  width: 100%;
  gap: 7px;
}

.feature-list-item {
  display: grid;
  min-width: 0;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.feature-list-index {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: #59677F;
  color: #F2E5E0;
  font-family: var(--mono);
  font-size: 9px;
}

.provenance-definition {
  margin: 2px 0;
  border-left: 3px solid #8A91A0;
  border-radius: 0 8px 8px 0;
  background: rgba(205, 211, 222, 0.46);
  padding: 9px 11px;
  color: #38445A;
  font-size: 12px;
  line-height: 1.65;
}

.xref-section {
  overflow: hidden;
  margin-top: 3px;
  border: 1px solid #CDB8B5;
  border-radius: 11px;
  background: rgba(242, 229, 224, 0.72);
}

.xref-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #CDB8B5;
  background: #D9C8C5;
  padding: 8px 10px;
}

.xref-section > header strong {
  color: #38445A;
  font-size: 12px;
}

.xref-section > header span {
  color: #5E6270;
  font-family: var(--mono);
  font-size: 9px;
}

.xref-groups {
  display: grid;
}

.xref-group {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(112px, 0.34fr) minmax(0, 1fr);
  gap: 9px;
  padding: 9px 10px;
}

.xref-group + .xref-group {
  border-top: 1px solid rgba(205, 184, 181, 0.65);
}

.xref-database {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.xref-database strong {
  overflow-wrap: anywhere;
  color: #4C5A73;
  font-size: 11px;
  line-height: 1.45;
}

.xref-database small {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #CDD3DE;
  color: #38445A;
  font-family: var(--mono);
  font-size: 9px;
}

.xref-identifiers {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.xref-identifiers > a,
.xref-identifiers > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(175, 160, 163, 0.7);
  border-radius: 7px;
  background: #F2E5E0;
  padding: 4px 7px;
  color: #38445A;
  text-decoration: none;
}

.xref-identifiers > a:hover {
  border-color: #59677F;
  background: #CDD3DE;
}

.xref-identifiers code {
  overflow-wrap: anywhere;
  color: inherit;
  font-family: var(--mono);
  font-size: 10px;
}

.xref-identifiers small {
  color: #777784;
  font-size: 9px;
}

@media (max-width: 720px) {
  .xref-group {
    grid-template-columns: 1fr;
  }
}

.composer:focus-within {
  border-color: #59677F;
  box-shadow: 0 0 0 4px rgba(89, 103, 127, 0.16),
    0 -8px 36px rgba(34, 40, 56, 0.11);
}

/* Unified home canvas. Header, page and composer dock share one quiet color. */
.app-header,
.composer-dock {
  background: #D8D1D2;
  backdrop-filter: none;
}

.app-header {
  border-bottom-color: rgba(34, 40, 56, 0.14);
  box-shadow: 0 7px 24px rgba(34, 40, 56, 0.07);
}

.brand,
.brand strong,
.brand small,
.system-status,
.system-status.ready {
  color: #222838;
}

.composer-dock {
  border-top: 1px solid rgba(34, 40, 56, 0.1);
}

.composer {
  background: #D8D1D2;
  box-shadow: 0 8px 28px rgba(34, 40, 56, 0.1);
}

/* Four distinct cards from one restrained pink-blue family. */
.suggestion:nth-child(4n + 1) {
  background: #D5BFBC;
}

.suggestion:nth-child(4n + 2) {
  background: #C6CCD7;
}

.suggestion:nth-child(4n + 3) {
  background: #D1C1CA;
}

.suggestion:nth-child(4n) {
  background: #BEC8CC;
}

.suggestion:nth-child(n):hover {
  border-color: #69758D;
  filter: brightness(0.98);
}

/* Keep the welcome content clear of the fixed composer. */
.welcome {
  width: 100vw;
  min-height: calc(100vh - 64px);
  margin-left: calc(50% - 50vw);
  padding-right: max(34px, calc((100vw - 1212px) / 2));
  padding-bottom: 150px;
  padding-left: max(34px, calc((100vw - 1212px) / 2));
}

@media (max-width: 720px) {
  .welcome {
    padding-right: 15px;
    padding-bottom: 142px;
    padding-left: 15px;
  }
}

/* Restore the stronger dark masthead and a distinct warm-pink composer. */
.app-header {
  background: #222838;
  border-bottom-color: rgba(238, 218, 211, 0.16);
  box-shadow: 0 8px 26px rgba(34, 40, 56, 0.16);
}

.brand,
.brand strong,
.brand small,
.system-status,
.system-status.ready {
  color: #EEDAD3;
}

.composer {
  background: #EEDAD3;
  border-color: rgba(34, 40, 56, 0.2);
  box-shadow: 0 8px 30px rgba(34, 40, 56, 0.13);
}

/* Match all home examples to the composer and logo surface. */
.suggestion:nth-child(n) {
  background: #F3E7E2;
  border-color: rgba(34, 40, 56, 0.18);
}

.suggestion:nth-child(n):hover {
  background: #EBD9D4;
  border-color: #69758D;
}
