:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f2f4f1;
  color: #17201c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f2f4f1;
}

body.bokeh-mode .evidence-app {
  display: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
}

p,
.muted {
  color: #64726d;
}

a {
  color: #0b6f51;
  font-weight: 750;
}

.bokeh-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #10241f;
}

.bokeh-shell[hidden] {
  display: none;
}

.bokeh-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  background: #10241f;
  color: #f8fbf6;
  border-bottom: 1px solid #315048;
}

.bokeh-topbar p {
  margin-top: 4px;
  color: #cddbd5;
  font-size: 13px;
}

#bokehFrame {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 66px);
  border: 0;
  background: #ffffff;
}

.evidence-app {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 14px 9px;
  background: #ffffff;
  border-bottom: 1px solid #d9e1dd;
}

.title-block p {
  margin-top: 4px;
  color: #0d7765;
  font-size: 12px;
  font-weight: 750;
}

.header-actions,
.top-actions,
.finder-row,
.topic-search,
.abstract-placement-actions,
.summary-controls,
.panel-title-row,
.control-strip,
.map-control-grid {
  display: flex;
  align-items: end;
  gap: 10px;
}

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

.button {
  border: 1px solid #c9d4d0;
  background: #ffffff;
  color: #17201c;
  border-radius: 5px;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  min-height: 32px;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  background: #1f78b4;
  border-color: #1f78b4;
  color: #ffffff;
}

.button.ghost {
  background: #f8faf9;
  border-color: #d5dfdb;
  color: #17201c;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 1px solid #c5d1cd;
  border-radius: 999px;
  background: #f4f8f6;
  color: #345249;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  cursor: help;
  vertical-align: 1px;
}

.info-dot:hover,
.info-dot:focus {
  border-color: #1f78b4;
  color: #0f5e8f;
  outline: none;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: #d9e1dd;
  border-bottom: 1px solid #d9e1dd;
}

.status-row div {
  min-height: 38px;
  padding: 7px 12px;
  background: #f9fbfa;
}

.status-row span {
  display: block;
  color: #65736e;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.status-row strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.workbench {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 8px minmax(440px, min(var(--right-col-width, 620px), 54vw));
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}

.column-resizer {
  min-width: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, transparent 0, transparent 2px, #c9d4d0 2px, #c9d4d0 6px, transparent 6px);
  cursor: col-resize;
  touch-action: none;
}

.column-resizer:hover,
.column-resizer:focus {
  background: linear-gradient(90deg, transparent 0, transparent 1px, #1f78b4 1px, #1f78b4 7px, transparent 7px);
  outline: none;
}

.left-column,
  .right-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 8px;
  overflow: auto;
  overscroll-behavior: contain;
}

.left-column {
  grid-template-rows: auto auto auto;
  align-content: start;
}

.left-column > * {
  max-width: 100%;
}

.right-column {
  display: flex;
  flex-direction: column;
  align-content: stretch;
  overflow-y: auto;
}

.panel {
  min-width: 0;
  background: #ffffff;
  border: 1px solid #d9e1dd;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(16, 36, 31, 0.05);
}

.paper-finder,
.map-controls,
.summary-panel,
.analysis-card {
  padding: 10px;
}

.paper-finder,
.map-controls {
  padding: 7px;
}

.panel-title-row {
  justify-content: space-between;
  align-items: start;
}

.panel-title-row p,
.helper-text,
.control-copy p {
  margin-top: 3px;
  font-size: 11px;
}

label {
  display: grid;
  gap: 4px;
  color: #55645f;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

label.check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #26352f;
  text-transform: none;
  font-size: 12px;
  font-weight: 700;
}

.wide-control {
  flex: 1 1 320px;
}

select,
input,
textarea {
  height: 32px;
  border: 1px solid #c5d0cc;
  border-radius: 4px;
  background: #fbfcfb;
  color: #17201c;
  font: inherit;
  font-size: 12px;
  min-width: 160px;
  padding: 0 9px;
}

textarea {
  height: auto;
  min-height: 74px;
  padding: 8px 9px;
  resize: vertical;
  line-height: 1.35;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  accent-color: #1f78b4;
}

#paperSearch,
#topicSearch,
#abstractPlacementText,
#briefQuestion {
  width: 100%;
}

.finder-row,
.topic-search {
  margin-top: 5px;
  align-items: end;
  gap: 7px;
  flex-wrap: wrap;
}

.abstract-placement {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  border-top: 1px solid #dce5e1;
  padding-top: 8px;
}

.abstract-placement-meta {
  color: #5d6f68;
  font-size: 10.5px;
  font-weight: 760;
}

.abstract-placement-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 7px;
}

.abstract-placement-actions label {
  flex: 0 0 128px;
}

.abstract-placement-actions input {
  min-width: 96px;
  width: 100%;
}

.abstract-placement-result {
  color: #51635c;
  font-size: 11px;
  line-height: 1.35;
}

.abstract-placement-result ol {
  margin: 4px 0 0 18px;
  padding: 0;
}

.abstract-placement-result li + li {
  margin-top: 2px;
}

.abstract-placement-diagnostics {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  padding: 6px 7px;
  border: 1px solid #d7e4df;
  border-radius: 6px;
  background: #f8fbfa;
}

.abstract-placement-result strong {
  color: #17201c;
}

.abstract-placement-result a {
  color: #0f6fa8;
  font-weight: 760;
}

.helper-text {
  color: #5f6f69;
}

.search-table {
  margin-top: 6px;
  height: 86px;
  min-height: 58px;
}

.search-table[hidden] {
  display: none;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e3e9e6;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th,
td {
  border-bottom: 1px solid #edf1ef;
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8f6;
  color: #52625c;
  font-size: 9px;
  text-transform: uppercase;
}

.control-strip {
  justify-content: space-between;
  align-items: start;
}

.lane-select {
  width: 220px;
}

.lane-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
  overflow-x: visible;
  padding-bottom: 1px;
}

.lane-button,
.mode-button {
  min-height: 26px;
  border: 1px solid #d1dbd7;
  border-radius: 3px;
  background: #f8faf9;
  color: #26352f;
  font: inherit;
  font-size: 10px;
  font-weight: 780;
  padding: 4px 7px;
  cursor: pointer;
  white-space: nowrap;
}

.lane-button.active,
.mode-button.active {
  background: #1f78b4;
  border-color: #1f78b4;
  color: #ffffff;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 5px;
}

.mode-button {
  min-width: 0;
  background: #ffffff;
}

.map-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  align-items: end;
  margin-top: 5px;
  gap: 6px;
}

.map-control-grid select {
  width: 100%;
  min-width: 0;
  padding-inline: 6px;
}

.toggle-chip {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #d2ddda;
  border-radius: 4px;
  background: #fbfcfb;
}

.plot-panel {
  align-self: start;
  height: max-content;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  overflow: hidden;
}

.plot-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  grid-template-areas:
    "copy tools"
    "legend legend";
  align-items: start;
  gap: 6px 10px;
  min-height: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #2e3633;
  background: #0c1110;
  color: #f7faf8;
}

.plot-head > div:first-child {
  grid-area: copy;
  min-width: 0;
}

.plot-tools {
  grid-area: tools;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  max-width: 390px;
}

.tool-button {
  min-height: 27px;
  border: 1px solid #394642;
  border-radius: 3px;
  background: #151d1a;
  color: #d8e3df;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
  cursor: pointer;
}

.tool-button:hover,
.tool-button.active {
  border-color: #7ad2ff;
  background: #12324a;
  color: #ffffff;
}

.plot-head p,
.result-strip {
  margin-top: 3px;
  font-size: 11px;
  color: #bdc8c4;
}

.legend {
  grid-area: legend;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  max-width: 100%;
  max-height: 62px;
  overflow-y: auto;
  color: #cdd7d3;
  font-size: 10px;
  line-height: 1.45;
  text-align: left;
  scrollbar-width: thin;
}

.legend span {
  white-space: nowrap;
}

.legend-more {
  color: #8da09a;
  font-weight: 780;
}

.plot-wrap {
  position: relative;
  min-height: 500px;
  height: clamp(500px, calc(100vh - 360px), 680px);
  overflow: hidden;
  background: #080c0b;
  touch-action: none;
}

.height-resizer {
  height: 10px;
  flex: 0 0 10px;
  display: grid;
  place-items: center;
  cursor: row-resize;
  touch-action: none;
  user-select: none;
}

.height-resizer::before {
  content: "";
  width: min(150px, 36%);
  height: 3px;
  border-radius: 999px;
  background: #c8d4cf;
}

.search-table[hidden] + .height-resizer {
  display: none;
}

.height-resizer:hover::before,
.height-resizer:focus::before,
.height-resizer.dragging::before {
  background: #1f78b4;
}

.plot-panel .height-resizer {
  background: #0c1110;
  border-top: 1px solid #2e3633;
  border-bottom: 1px solid #2e3633;
}

.plot-panel .height-resizer::before {
  background: #51625d;
}

.plot-panel .height-resizer:hover::before,
.plot-panel .height-resizer:focus::before,
.plot-panel .height-resizer.dragging::before {
  background: #7ad2ff;
}

.mini-map {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: 154px;
  height: 118px;
  border: 1px solid rgba(122, 210, 255, 0.38);
  border-radius: 4px;
  background: rgba(8, 12, 11, 0.84);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  cursor: pointer;
}

.mini-map canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plot-wrap[data-tool="box"],
.plot-wrap[data-tool="lasso"] {
  cursor: crosshair;
}

.plot-wrap[data-tool="pan"] {
  cursor: grab;
}

.plot-wrap[data-tool="pan"].is-dragging {
  cursor: grabbing;
}

.plot-wrap[data-tool="zoom"] {
  cursor: zoom-in;
}

.plot-wrap.branch-lasso-target {
  box-shadow: 0 0 0 3px rgba(31, 120, 180, 0.34), 0 12px 28px rgba(31, 120, 180, 0.16);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tooltip {
  position: absolute;
  z-index: 4;
  max-width: 360px;
  pointer-events: none;
  border: 1px solid #7d8f89;
  border-radius: 4px;
  background: rgba(250, 252, 251, 0.98);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  color: #17201c;
  font-size: 12px;
  line-height: 1.35;
  padding: 9px 10px;
}

.tooltip b {
  display: block;
  margin-bottom: 4px;
}

.tooltip-meta {
  margin-bottom: 7px;
  color: #5c6b66;
  font-size: 10.5px;
  font-weight: 720;
}

.tooltip-lane-title {
  margin: 6px 0 4px;
  color: #0b6f51;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.tooltip-row {
  margin-top: 5px;
}

.tooltip-row span {
  display: block;
  color: #52625c;
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.tooltip-row p {
  margin-top: 1px;
  color: #17201c;
  font-size: 11.5px;
}

.tooltip-method {
  padding-top: 6px;
  border-top: 1px solid #e2e8e5;
}

.tooltip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.tooltip-chips span {
  display: inline-block;
  border: 1px solid #c8d5d0;
  border-radius: 999px;
  background: #f4f8f6;
  color: #26352f;
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1.2;
  padding: 2px 6px;
  text-transform: none;
}

.tooltip-note {
  margin-top: 6px;
  color: #5c6b66;
  font-size: 10.5px;
  font-weight: 760;
}

.result-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
  padding: 6px 10px;
  border-top: 1px solid #2e3633;
  background: #0c1110;
}

.selection-chips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(122, 210, 255, 0.28);
  border-radius: 999px;
  background: rgba(122, 210, 255, 0.08);
  color: #d9f3ff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
}

#paperLinks {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

#paperLinks a {
  color: #7ad2ff;
}

.paper-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.paper-detail-actions a {
  color: #0f6fa8;
  font-weight: 760;
}

.paper-chat-button {
  min-height: 28px;
  padding: 0 9px;
}

.summary-panel {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
}

.analysis-card {
  flex: 0 0 auto;
}

.summary-panel > * {
  min-width: 0;
}

.summary-controls {
  align-items: end;
  flex-wrap: wrap;
}

.summary-controls label {
  min-width: 0;
}

.summary-controls label:not(.check) {
  flex: 1 1 135px;
}

.summary-controls select {
  width: 100%;
  min-width: 0;
}

.openai-key-control {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  white-space: nowrap;
}

.openai-key-control .button.has-session-key {
  border-color: #2f8f68;
  color: #174d38;
  background: #e9f7ef;
}

.openai-key-control span {
  color: #5c6b66;
  font-size: 11px;
}

.brief-option {
  align-self: center;
  min-height: 34px;
  white-space: nowrap;
}

.brief-question {
  width: 100%;
}

.brief-question-row {
  display: flex;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.brief-question-row .brief-question {
  flex: 1 1 auto;
  min-width: 0;
}

.brief-question-row .button {
  flex: 0 0 auto;
  min-width: 116px;
}

.progress-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.progress-rail span {
  min-height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #d5dfdb;
  border-radius: 3px;
  background: #f7faf8;
  color: #61706a;
  font-size: 10px;
  font-weight: 820;
  text-align: center;
}

.progress-rail span.done,
.progress-rail span.active {
  background: #e5f2ff;
  border-color: #a8cdea;
  color: #1b5f8d;
}

.progress-rail span.active {
  box-shadow: inset 0 -2px 0 #1f78b4;
}

.progress-rail span.warning {
  background: #fff7ed;
  border-color: #f2b36d;
  color: #8a4b07;
}

.agent-process {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.agent-process-step {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  border: 1px solid #dbe5e1;
  border-radius: 4px;
  background: #fbfdfc;
  padding: 6px;
  min-width: 0;
}

.agent-process-step.done {
  border-color: #b8d8c8;
  background: #f0faf4;
}

.agent-process-step.active {
  border-color: #9cc9e8;
  background: #f1f8ff;
}

.agent-process-step.warning {
  border-color: #f2b36d;
  background: #fff8ef;
}

.agent-process-index {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e8efec;
  color: #455650;
  font-size: 10px;
  font-weight: 850;
}

.agent-process-step.done .agent-process-index,
.agent-process-step.active .agent-process-index {
  background: #1f78b4;
  color: #ffffff;
}

.agent-process-step.warning .agent-process-index {
  background: #d97706;
  color: #ffffff;
}

.agent-process-step strong,
.agent-process-step em {
  display: block;
  min-width: 0;
}

.agent-process-step strong {
  color: #21302a;
  font-size: 10px;
  line-height: 1.15;
}

.agent-process-step em {
  margin-top: 2px;
  color: #60716a;
  font-size: 10px;
  font-style: normal;
  line-height: 1.25;
}

.workbench-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  overflow-x: visible;
  padding-bottom: 2px;
}

.workbench-tab {
  flex: 0 0 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #d8e2de;
  border-radius: 4px;
  background: #f8faf9;
  color: #40504a;
  cursor: pointer;
  font-size: 11px;
  font-weight: 820;
  padding: 6px 9px;
  white-space: nowrap;
}

.workbench-tab.active,
.workbench-tab[aria-selected="true"] {
  border-color: #8bbdaf;
  background: #eaf5f1;
  color: #0e5f4e;
}

.workbench-tab-label {
  min-width: 0;
}

.workbench-tab-badge {
  min-width: 16px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #d8e2de;
  border-radius: 999px;
  background: #eef3f1;
  color: #4d5f58;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.35;
}

.workbench-tab-badge.ready {
  border-color: #b8d8c8;
  background: #ecf9f1;
  color: #0b6f51;
}

.workbench-tab-badge.warning {
  border-color: #f2b36d;
  background: #fff5e8;
  color: #8a4b07;
}

.workbench-tab-badge.muted {
  border-color: #dce4e1;
  background: #f4f7f6;
  color: #65756f;
}

.workbench-tab-panels {
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.workbench-tab-panel {
  min-width: 0;
  min-height: 0;
}

.workbench-tab-panel.active {
  display: grid;
  gap: 8px;
}

#workbenchTabAnswer.active {
  grid-template-rows: auto minmax(260px, 1fr);
}

.workbench-artifact-panel,
.download-md-preview {
  height: clamp(260px, 42vh, 520px);
  min-height: 220px;
  max-height: min(66vh, 640px);
  overflow: auto;
  border: 1px solid #d8e2de;
  border-radius: 4px;
  background: #fbfcfb;
  color: #26352f;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px;
}

.workbench-empty {
  display: grid;
  gap: 6px;
  align-content: start;
  color: #5f6f69;
  min-height: 120px;
}

.workbench-empty h3,
.workbench-artifact-panel h3 {
  margin: 0 0 6px;
  color: #17201c;
  font-size: 13px;
  line-height: 1.25;
}

.workbench-empty p,
.workbench-artifact-panel p {
  margin: 0 0 8px;
}

.workbench-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 9px;
}

.workbench-kpi {
  border: 1px solid #e1e8e5;
  border-radius: 4px;
  background: #ffffff;
  padding: 7px;
}

.workbench-kpi span {
  display: block;
  color: #687770;
  font-size: 10px;
  font-weight: 820;
  text-transform: uppercase;
}

.workbench-kpi strong {
  display: block;
  margin-top: 2px;
  color: #1e3029;
  font-size: 14px;
}

.workbench-table-wrap {
  overflow-x: auto;
  border: 1px solid #e1e8e5;
  border-radius: 4px;
  background: #ffffff;
}

.workbench-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 11px;
}

.workbench-table th,
.workbench-table td {
  border-bottom: 1px solid #edf2f0;
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
}

.workbench-table th {
  background: #f6faf8;
  color: #385048;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

.workbench-table tr:last-child td {
  border-bottom: 0;
}

.source-label {
  display: inline-block;
  border: 1px solid #d8e5df;
  border-radius: 999px;
  background: #f5faf7;
  color: #4a5f57;
  font-size: 10px;
  font-weight: 820;
  padding: 2px 6px;
  white-space: nowrap;
}

.source-label.direct {
  border-color: #8bbdaf;
  background: #eaf5f1;
  color: #0e5f4e;
}

.source-label.adjacent {
  border-color: #c3d7eb;
  background: #f0f7ff;
  color: #1b5f8d;
}

.source-label.demoted,
.source-label.invalid {
  border-color: #ebc5b9;
  background: #fff7f4;
  color: #8a3725;
}

.reviewer-check-panel {
  border: 1px solid #dbe7e2;
  border-radius: 4px;
  background: #fbfdfc;
  padding: 9px;
  margin: 0 0 10px;
}

.reviewer-check-panel.demoted,
.reviewer-check-panel.invalid {
  border-color: #ebc5b9;
  background: #fff8f5;
}

.reviewer-check-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.reviewer-check-heading strong {
  color: #5d3a2f;
  font-size: 11px;
}

.reviewer-check-panel p {
  margin: 5px 0;
  color: #4d5b56;
  font-size: 12px;
  line-height: 1.4;
}

.reviewer-check-panel ul {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.reviewer-check-panel li {
  border-top: 1px solid rgba(97, 80, 72, 0.12);
  padding-top: 5px;
}

.reviewer-check-panel li strong {
  display: block;
  color: #263b34;
  font-size: 11px;
}

.reviewer-check-panel li span {
  display: block;
  margin-top: 2px;
  color: #5b6964;
  font-size: 11px;
  line-height: 1.35;
}

.context-mode-control {
  display: grid;
  gap: 5px;
  border: 1px solid #dbe7e2;
  border-radius: 4px;
  background: #f7fbf9;
  padding: 8px;
  margin: 0 0 9px;
}

.context-mode-control label {
  display: grid;
  gap: 4px;
  color: #475b53;
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

.context-mode-control select {
  width: 100%;
  text-transform: none;
}

.context-mode-control p {
  color: #5d6f68;
  font-size: 11px;
}

.evidence-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-state-actions .button {
  min-height: 30px;
  padding: 6px 8px;
}

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

.fork-mode-card {
  display: grid;
  gap: 8px;
  align-content: space-between;
  border: 1px solid #dbe7e2;
  border-radius: 4px;
  background: #ffffff;
  padding: 9px;
}

.fork-mode-card.active {
  border-color: #82b9aa;
  background: #eef8f4;
}

.fork-mode-card span {
  display: block;
  color: #697b73;
  font-size: 9.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.fork-mode-card h4 {
  margin: 2px 0 4px;
  color: #17201c;
  font-size: 12px;
  line-height: 1.25;
}

.fork-mode-card p {
  margin: 0;
  color: #53655e;
  font-size: 11px;
}

.fork-run-meta {
  margin-top: 6px !important;
  color: #256e5d !important;
  font-weight: 760;
}

.fork-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fork-mode-actions .button {
  min-height: 30px;
  padding: 6px 8px;
}

.fork-comparison-panel {
  display: grid;
  gap: 6px;
  margin: 2px 0 10px;
}

.fork-comparison-panel h4 {
  margin: 0;
  color: #263b34;
  font-size: 12px;
  line-height: 1.25;
}

.fork-comparison-panel p {
  margin: 0;
  color: #596b64;
  font-size: 11px;
  line-height: 1.4;
}

.fork-comparison-table {
  min-width: 920px;
}

.fork-comparison-table .fork-not-run td {
  color: #7b8883;
  background: #fbfdfc;
}

.workbench-plan-list,
.run-log-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workbench-plan-list li,
.run-log-list li {
  border: 1px solid #e1e8e5;
  border-radius: 4px;
  background: #ffffff;
  padding: 8px;
}

.run-log-list time {
  display: block;
  color: #687770;
  font-size: 10px;
  font-weight: 760;
}

.run-log-list strong {
  color: #1e3029;
}

.download-md-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.download-md-head p {
  margin: 0;
  color: #5f6f69;
  font-size: 11px;
}

.download-md-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.branch-workbench {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-height: min(58vh, 660px);
  overflow: auto;
  border: 1px solid #d8e2de;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 9px;
}

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

.branch-head h3 {
  margin: 0;
  color: #17201c;
  font-size: 13px;
  line-height: 1.25;
}

.branch-head p {
  margin: 3px 0 0;
  color: #5d6f68;
  font-size: 11px;
  line-height: 1.35;
}

.branch-follow-up-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 7px;
}

.branch-follow-up {
  min-width: 0;
}

.branch-tree {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.branch-node {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 6px;
  margin-left: calc(var(--branch-depth, 0) * 16px);
  min-width: 0;
}

.branch-node-line {
  position: relative;
  min-height: 100%;
}

.branch-node-line::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9aa9a3;
  box-shadow: 0 0 0 3px #eef4f1;
}

.branch-node:not(.root) .branch-node-line::after {
  content: "";
  position: absolute;
  top: -8px;
  bottom: 8px;
  left: 10px;
  border-left: 1px solid #d2ddd8;
}

.branch-node.active .branch-node-line::before {
  background: #1f78b4;
  box-shadow: 0 0 0 3px #dceefb;
}

.branch-node-main {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid #dce6e2;
  border-radius: 4px;
  background: #ffffff;
  padding: 8px;
}

.branch-node.active .branch-node-main {
  border-color: #90bdd9;
  background: #f2f8fd;
}

.branch-node-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.branch-node-top span {
  flex: 0 0 auto;
  border: 1px solid #d8e5df;
  border-radius: 999px;
  background: #f3f7f5;
  color: #597069;
  font-size: 9px;
  font-weight: 850;
  padding: 1px 5px;
  text-transform: uppercase;
}

.branch-node-top h4 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #1d2b26;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-node p,
.branch-node em {
  margin: 0;
  color: #53655e;
  font-size: 11px;
  line-height: 1.35;
}

.branch-node em {
  color: #2b5f77;
  font-style: normal;
}

.branch-node-chips,
.branch-node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  position: relative;
}

.branch-node-chips span {
  border: 1px solid #dce7e2;
  border-radius: 999px;
  background: #f7faf9;
  color: #5a6d66;
  font-size: 9.5px;
  font-weight: 780;
  padding: 2px 6px;
}

.branch-node-actions .button,
.branch-follow-up-row .button {
  min-height: 30px;
  padding: 6px 8px;
  white-space: nowrap;
}

.branch-node-more {
  position: relative;
}

.branch-node-more > summary {
  display: inline-grid;
  place-items: center;
  list-style: none;
}

.branch-node-more > summary::-webkit-details-marker {
  display: none;
}

.branch-node-more-panel {
  position: absolute;
  z-index: 30;
  right: 0;
  top: calc(100% + 5px);
  display: grid;
  gap: 5px;
  width: 142px;
  border: 1px solid #cbd8d3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(26, 43, 36, 0.16);
  padding: 6px;
}

.branch-node-more-panel .button {
  width: 100%;
  justify-content: flex-start;
}

.branch-workbench {
  max-height: min(58vh, 660px);
}

.branch-flow-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
}

.branch-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  position: relative;
}

.branch-more-menu {
  position: relative;
}

.branch-more-menu > summary {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  list-style: none;
}

.branch-more-menu > summary::-webkit-details-marker {
  display: none;
}

.branch-more-menu-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  gap: 7px;
  width: min(330px, calc(100vw - 28px));
  border: 1px solid #d5e0dc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(26, 43, 36, 0.16);
  padding: 9px;
}

.branch-more-menu-panel .button,
.branch-more-menu-panel select {
  width: 100%;
}

.branch-more-menu-panel .saved-path-picker {
  min-width: 0;
}

.branch-inline-more {
  align-self: end;
}

.branch-inline-more .branch-more-menu-panel {
  width: 180px;
}

.branch-danger-action {
  border-color: rgba(190, 72, 25, 0.55);
  color: #8f3416;
  background: #fff2ec;
}

.branch-start-confirm {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(190, 72, 25, 0.22);
  border-radius: 6px;
  background: #fff7f2;
  color: #6f3017;
  font-size: 12px;
  line-height: 1.35;
}

.saved-path-picker {
  display: grid;
  gap: 2px;
  min-width: 190px;
  flex: 1 1 220px;
  text-transform: none;
}

.saved-path-picker span {
  color: #5d6f68;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.saved-path-picker select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding-inline: 7px;
}

.branch-flow-controls .branch-follow-up {
  flex: 1 0 100%;
}

.branch-flow-controls .button {
  flex: 0 0 auto;
}

.branch-question-input {
  width: 100%;
  min-width: min(100%, 420px);
  min-height: 50px;
  height: 50px;
  resize: vertical;
  line-height: 1.35;
  padding-top: 7px;
  padding-bottom: 7px;
}

.branch-lasso-armed {
  border: 1px solid #8abfdb;
  border-radius: 4px;
  background: #eef8fd;
  color: #18475c;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.35;
  padding: 7px 9px;
}

.branch-form-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 17, 16, 0.42);
}

.branch-form-dialog {
  display: grid;
  gap: 12px;
  width: min(720px, 100%);
  max-height: min(82vh, 680px);
  overflow: auto;
  border: 1px solid #cad9d4;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(16, 36, 31, 0.28);
  padding: 14px;
}

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

.branch-form-head h3 {
  margin: 0;
  color: #17201c;
  font-size: 15px;
  line-height: 1.25;
}

.branch-form-head p,
.branch-form-help {
  margin: 3px 0 0;
  color: #5d6f68;
  font-size: 11.5px;
  line-height: 1.4;
}

.branch-form-question {
  display: grid;
  gap: 5px;
  color: #52635d;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.branch-form-question textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  border: 1px solid #d2ded9;
  border-radius: 7px;
  background: #fbfdfc;
  color: #17201c;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.35;
  padding: 8px 9px;
  text-transform: none;
}

.branch-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.branch-form-option {
  display: grid;
  gap: 4px;
  min-height: 86px;
  border: 1px solid #d3dfda;
  border-radius: 8px;
  background: #fbfdfc;
  color: #17201c;
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.branch-form-option:hover,
.branch-form-option:focus {
  border-color: #1f78b4;
  background: #f1f8fd;
  outline: 0;
}

.branch-form-option strong {
  font-size: 12px;
  line-height: 1.25;
}

.branch-form-option span {
  color: #52635d;
  font-size: 11px;
  line-height: 1.35;
}

.branch-canvas-shell {
  min-height: 300px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid #d5e0dc;
  border-radius: 8px;
  background:
    linear-gradient(#f2f6f4 1px, transparent 1px),
    linear-gradient(90deg, #f2f6f4 1px, transparent 1px),
    #fbfdfc;
  background-size: 24px 24px;
}

.branch-flow-island-mount {
  display: none;
  min-height: 336px;
}

.branch-flow-react-ready .branch-flow-island-mount {
  display: block;
}

.branch-flow-react-ready .branch-canvas-shell {
  height: min(56vh, 560px);
  min-height: 360px;
  max-height: none;
  overflow: hidden;
}

.branch-flow-react-ready .branch-canvas-fallback {
  display: none;
}

.research-flow-shell {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr);
  min-height: 100%;
  height: 100%;
  color: #17201c;
}

.research-flow-fixed-mode {
  grid-template-rows: minmax(420px, 1fr);
}

.research-flow-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #dce7e2;
  background: rgba(251, 253, 252, 0.94);
  padding: 7px 8px;
}

.citation-network-panel {
  display: block;
  min-height: 96px;
  margin-top: 10px;
  border: 1px solid #d5e0dc;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.citation-network-panel.collapsed {
  background: #fbfdfc;
}

.citation-network-panel:not(.collapsed) {
  min-height: 770px;
}

.citation-network-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #dce7e2;
  background: #fbfdfc;
  padding: 9px 10px;
}

.citation-network-panel.collapsed .citation-network-panel-head {
  border-bottom: 0;
}

.citation-network-panel-head h4 {
  margin: 0;
  color: #17201c;
  font-size: 13px;
  font-weight: 880;
  line-height: 1.2;
}

.citation-network-panel-head p {
  margin: 3px 0 0;
  color: #60726b;
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1.25;
}

.citation-network-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.citation-network-island-mount {
  display: block;
  min-height: 675px;
  height: auto;
}

.branch-flow-react-ready .citation-network-island-mount {
  display: block;
}

.citation-network-island-mount .research-flow-shell,
.citation-network-island-mount .research-flow-canvas {
  height: auto;
  min-height: 0;
}

.citation-network-island-mount .research-flow-fixed-mode {
  grid-template-rows: auto;
}

.research-flow-toolbar strong {
  display: block;
  color: #17201c;
  font-size: 12px;
  line-height: 1.2;
}

.research-flow-toolbar span {
  display: block;
  margin-top: 2px;
  color: #60726b;
  font-size: 10.5px;
  font-weight: 740;
  line-height: 1.2;
}

.research-flow-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  position: relative;
}

.research-flow-options {
  position: relative;
}

.research-flow-options > summary {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #cbd8d3;
  border-radius: 7px;
  background: #ffffff;
  color: #273832;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 840;
  line-height: 1;
  list-style: none;
  padding: 6px 9px;
}

.research-flow-options > summary::-webkit-details-marker {
  display: none;
}

.research-flow-options[open] > summary,
.research-flow-options > summary:focus {
  border-color: #1f78b4;
  background: #eef7fc;
  color: #174d72;
  outline: 0;
}

.research-flow-options-panel {
  position: absolute;
  z-index: 36;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  gap: 6px;
  width: 188px;
  border: 1px solid #cbd8d3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(26, 43, 36, 0.16);
  padding: 7px;
}

.research-flow-options-panel button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.research-flow-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid #cbd8d3;
  border-radius: 999px;
  background: #f3f7f5;
  padding: 2px;
}

.research-flow-view-toggle button {
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #53655f;
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
}

.research-flow-view-toggle button.active {
  background: #ffffff;
  color: #17201c;
  box-shadow: 0 1px 4px rgba(26, 43, 36, 0.1);
}

.research-flow-toolbar-actions button {
  min-height: 28px;
  border: 1px solid #cbd8d3;
  border-radius: 7px;
  background: #ffffff;
  color: #273832;
  font: inherit;
  font-size: 10.5px;
  font-weight: 820;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
}

.research-flow-canvas {
  min-height: 280px;
  height: 100%;
}

.research-flow-mode-citations .research-flow-canvas {
  min-height: 500px;
}

.research-flow-mode-network .research-flow-canvas {
  min-height: 520px;
}

.research-flow-mode-citation_map .research-flow-canvas {
  min-height: 560px;
}

.research-flow-canvas .react-flow {
  background:
    linear-gradient(#f2f6f4 1px, transparent 1px),
    linear-gradient(90deg, #f2f6f4 1px, transparent 1px),
    #fbfdfc;
  background-size: 24px 24px;
}

.research-flow-canvas .react-flow__node {
  border-radius: 8px;
  overflow: visible;
}

.research-flow-canvas .react-flow__node:hover,
.research-flow-canvas .react-flow__node:focus-within {
  z-index: 1200 !important;
}

.research-flow-canvas .react-flow__edge-path {
  stroke: #9dad9e;
  stroke-width: 1.8;
}

.research-flow-canvas .react-flow__edge.edge-lasso_subset .react-flow__edge-path,
.research-flow-canvas .react-flow__edge.edge-abstract_nearest .react-flow__edge-path {
  stroke: #1f78b4;
}

.research-flow-canvas .react-flow__edge.edge-agent_hybrid .react-flow__edge-path,
.research-flow-canvas .react-flow__edge.edge-graph_expansion .react-flow__edge-path,
.research-flow-canvas .react-flow__edge.edge-neighbour_expansion .react-flow__edge-path {
  stroke: #8b6f11;
  stroke-dasharray: 5 4;
}

.research-flow-canvas .react-flow__edge-path.is-hovered,
.research-flow-canvas .react-flow__edge.is-hovered .react-flow__edge-path {
  stroke-width: 2.6;
}

.research-edge-hover-target {
  position: absolute;
  z-index: 18;
  transform-origin: center;
  pointer-events: all;
  user-select: none;
}

.research-edge-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #d7e2de;
  border-radius: 999px;
  background: rgba(251, 253, 252, 0.96);
  color: #30423b;
  font-size: 9.5px;
  font-weight: 880;
  line-height: 1;
  padding: 5px 7px;
  box-shadow: 0 5px 12px rgba(26, 43, 36, 0.1);
  white-space: nowrap;
}

.research-edge-hover-target:focus-visible .research-edge-label,
.research-edge-hover-target.is-open .research-edge-label {
  border-color: #1f78b4;
  background: #eff8fc;
  color: #174d72;
  outline: 0;
}

.research-edge-hover-target:focus-visible {
  outline: 0;
}

.research-edge-hover-card {
  position: absolute;
  z-index: 22;
  top: calc(100% + 7px);
  left: 50%;
  display: none;
  width: 304px;
  max-width: min(304px, calc(100vw - 34px));
  border: 1px solid #cbd8d3;
  border-top: 4px solid #8b6f11;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(26, 43, 36, 0.18);
  padding: 9px;
  transform: translateX(-50%);
  pointer-events: none;
}

.research-edge-hover-target.is-open .research-edge-hover-card,
.research-edge-hover-target:focus-within .research-edge-hover-card {
  display: grid;
  gap: 6px;
}

.research-edge-hover-card strong {
  color: #17201c;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.research-edge-hover-card span {
  display: grid;
  gap: 2px;
  color: #3f524b;
  font-size: 10.5px;
  font-weight: 740;
  line-height: 1.3;
}

.research-edge-hover-card b {
  color: #60726b;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.research-flow-canvas .react-flow__edge-text {
  fill: #30423b;
  font-size: 10px;
  font-weight: 850;
}

.research-flow-canvas .react-flow__edge-textbg {
  fill: #fbfdfc;
  stroke: #d7e2de;
  stroke-width: 1px;
}

.research-flow-canvas .react-flow__controls {
  border-radius: 7px;
  box-shadow: 0 6px 14px rgba(26, 43, 36, 0.12);
  overflow: hidden;
}

.research-flow-canvas .react-flow__minimap {
  border: 1px solid #d4e0dc;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(26, 43, 36, 0.1);
}

.research-path-node {
  position: relative;
  box-sizing: border-box;
  display: grid;
  gap: 7px;
  width: 286px;
  min-height: 152px;
  border: 1px solid #cad9d4;
  border-left: 5px solid var(--node-tone, #64748b);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  box-shadow: 0 9px 20px rgba(26, 43, 36, 0.1);
  overflow: hidden;
  padding: 10px 10px 9px;
}

.research-path-node *,
.research-path-node *::before,
.research-path-node *::after {
  box-sizing: border-box;
}

.research-path-node.is-active {
  border-color: #1f78b4;
  border-left-color: var(--node-tone, #1f78b4);
  background: linear-gradient(180deg, #f7fbfe 0%, #eff7fc 100%);
  box-shadow: 0 0 0 2px #d8eefb, 0 11px 22px rgba(31, 120, 180, 0.16);
}

.research-path-node:hover,
.research-path-node:focus-within {
  overflow: visible;
  z-index: 8;
}

.research-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.research-node-type,
.research-node-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 880;
  line-height: 1;
  padding: 4px 7px;
  text-transform: uppercase;
}

.research-node-type {
  background: color-mix(in srgb, var(--node-tone, #64748b) 14%, #ffffff);
  color: var(--node-tone, #475569);
}

.research-node-status {
  border: 1px solid #dce7e2;
  background: #ffffff;
  color: #53655f;
}

.research-node-status.status-failed,
.research-node-status.status-warning {
  color: #a33a18;
}

.research-node-status.status-running {
  color: #8b6f11;
}

.research-path-node h4 {
  margin: 0;
  color: #17201c;
  font-size: 13px;
  font-weight: 880;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.research-path-node p {
  min-height: 36px;
  margin: 0;
  color: #3f524b;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.research-node-question-editor {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #52635d;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.research-node-question-editor textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 74px;
  resize: vertical;
  border: 1px solid #d2ded9;
  border-radius: 6px;
  background: #fbfdfc;
  color: #17201c;
  font: inherit;
  font-size: 11.5px;
  font-weight: 720;
  line-height: 1.32;
  padding: 7px 8px;
  text-transform: none;
}

.research-node-question-editor textarea:focus {
  outline: 2px solid #b7d9ee;
  outline-offset: 1px;
  border-color: #1f78b4;
  background: #ffffff;
}

.research-node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.research-node-meta span {
  min-height: 20px;
  border: 1px solid #dce7e2;
  border-radius: 999px;
  background: #f7faf9;
  color: #53655f;
  font-size: 9.5px;
  font-weight: 780;
  line-height: 1;
  padding: 5px 7px;
}

.research-node-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px minmax(0, 0.82fr) 32px;
  gap: 5px;
  align-items: stretch;
  position: relative;
  z-index: 12;
}

.research-node-more {
  position: relative;
  min-width: 0;
}

.research-node-more > summary {
  display: grid;
  place-items: center;
  min-height: 30px;
  border: 1px solid #cbd8d3;
  border-radius: 6px;
  background: #ffffff;
  color: #273832;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  list-style: none;
  padding: 0 6px;
}

.research-node-more > summary::-webkit-details-marker {
  display: none;
}

.research-node-more[open] > summary,
.research-node-more > summary:focus {
  border-color: #1f78b4;
  background: #eef7fc;
  outline: 0;
}

.research-node-more-panel {
  position: absolute;
  z-index: 30;
  right: 0;
  top: calc(100% + 5px);
  display: grid;
  gap: 5px;
  width: 142px;
  border: 1px solid #cbd8d3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(26, 43, 36, 0.16);
  padding: 6px;
}

.research-node-more-panel .research-node-action {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.research-node-hover {
  position: absolute;
  z-index: 1600;
  top: 8px;
  left: calc(100% + 8px);
  display: none;
  width: 292px;
  max-width: min(292px, calc(100vw - 32px));
  border: 1px solid #cbd8d3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(26, 43, 36, 0.16);
  padding: 9px;
  pointer-events: none;
}

.research-path-node:hover .research-node-hover,
.research-path-node.is-open .research-node-hover,
.research-path-node:focus .research-node-hover,
.research-path-node:focus-within .research-node-hover {
  display: grid;
  gap: 6px;
}

.research-node-hover strong {
  color: #17201c;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.research-node-hover span {
  display: grid;
  gap: 2px;
  color: #3f524b;
  font-size: 10.5px;
  font-weight: 730;
  line-height: 1.28;
}

.research-node-hover b {
  color: #60726b;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.research-node-hover b::after,
.research-edge-hover-card b::after,
.citation-network-hover-card b::after {
  content: ":";
}

.citation-context-node {
  width: 306px;
  min-height: 162px;
  border-radius: 10px;
}

.citation-context-node.is-included {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf8 100%);
}

.citation-context-node .research-node-meta span {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-node-actions {
  grid-template-columns: minmax(0, 1fr) minmax(44px, 0.8fr) minmax(44px, 0.8fr);
}

.selection-network-node {
  width: 288px;
  min-height: 146px;
  border-radius: 9px;
}

.selection-network-node.type-network_paper {
  width: 276px;
  min-height: 132px;
}

.selection-network-node.type-network_paper h4 {
  font-size: 12px;
}

.selection-network-node .research-node-meta span {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-node-actions {
  grid-template-columns: minmax(0, 1fr) minmax(44px, 0.82fr) minmax(48px, 0.82fr);
}

.citation-network-view {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(420px, 1fr);
  height: auto;
  min-height: 650px;
  background: #fbfdfc;
}

.citation-network-corebar,
.citation-network-settings-popover {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid #dce7e2;
  background: #ffffff;
  padding: 7px 8px;
}

.citation-network-corebar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.citation-network-settings-popover {
  position: absolute;
  z-index: 12;
  top: 54px;
  right: 10px;
  left: auto;
  width: min(760px, calc(100% - 20px));
  box-sizing: border-box;
  grid-template-columns: minmax(144px, 0.34fr) minmax(280px, 1fr) auto auto;
  align-items: start;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(26, 43, 36, 0.12);
  margin: 7px 8px 0 0;
  max-height: min(440px, calc(100vh - 180px));
  overflow: auto;
}

.citation-network-controls-text strong {
  display: block;
  color: #17201c;
  font-size: 11px;
  font-weight: 880;
  line-height: 1.2;
}

.citation-network-controls-text span {
  display: block;
  margin-top: 2px;
  color: #60726b;
  font-size: 10px;
  font-weight: 760;
  line-height: 1.25;
}

.citation-network-role-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 6px;
  min-width: 0;
  overflow: visible;
  padding-bottom: 0;
}

.citation-network-core-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.citation-network-function-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.citation-network-legend-swatches {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.citation-network-legend-glyph {
  display: block;
  width: 13px;
  height: 13px;
  overflow: visible;
  filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
}

.citation-role-glyph-shape {
  transition: stroke-width 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.citation-role-glyph-detail {
  pointer-events: none;
}

.citation-network-role-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.citation-network-role-button-glyph {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  overflow: visible;
}

.citation-network-selected-tray {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #dce7e2;
  background: #f7fbfa;
  color: #33443e;
  padding: 7px 9px;
}

.citation-network-selected-tray strong {
  color: #17201c;
  font-size: 10.5px;
  font-weight: 880;
  line-height: 1.2;
  white-space: nowrap;
}

.citation-network-selected-tray span {
  min-width: 0;
  color: #60726b;
  font-size: 10.5px;
  font-weight: 740;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-network-selected-tray.empty {
  background: #fbfdfc;
}

.citation-network-corebar strong {
  display: block;
  color: #17201c;
  font-size: 12px;
  font-weight: 880;
  line-height: 1.2;
}

.citation-network-corebar span {
  display: block;
  margin-top: 2px;
  color: #60726b;
  font-size: 10.5px;
  font-weight: 740;
  line-height: 1.3;
}

.citation-network-corebar button,
.citation-network-settings-popover button,
.citation-network-expand-controls,
.citation-network-open-inspector,
.citation-network-inspector button {
  min-height: 28px;
  border: 1px solid #cbd8d3;
  border-radius: 7px;
  background: #ffffff;
  color: #273832;
  font: inherit;
  font-size: 10px;
  font-weight: 840;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
}

.citation-network-role-buttons button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  border-left-width: 4px;
  border-color: color-mix(in srgb, var(--role-tone, #64748b) 36%, #cbd8d3);
  color: color-mix(in srgb, var(--role-tone, #64748b) 88%, #17201c);
  line-height: 1.15;
  text-align: left;
  white-space: normal;
}

.citation-network-role-buttons button > span:first-child,
.citation-network-role-label > span {
  min-width: 0;
}

.citation-role-help {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid color-mix(in srgb, var(--role-tone, #64748b) 30%, #cbd8d3);
  border-radius: 999px;
  background: color-mix(in srgb, var(--role-tone, #64748b) 8%, #ffffff);
  color: color-mix(in srgb, var(--role-tone, #64748b) 86%, #17201c);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.citation-network-corebar button.active,
.citation-network-settings-popover button.active,
.citation-network-role-buttons button.active,
.citation-network-inspector button.primary {
  border-color: color-mix(in srgb, var(--role-tone, #1f78b4) 58%, #1f78b4);
  background: color-mix(in srgb, var(--role-tone, #1f78b4) 12%, #ffffff);
  color: #17201c;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--role-tone, #1f78b4) 12%, #ffffff);
}

.citation-network-expand-controls,
.citation-network-open-inspector {
  justify-self: start;
  margin: 7px 8px;
}

.citation-network-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(248px, 0.34fr);
  min-height: 390px;
  height: 100%;
  overflow: visible;
}

.citation-network-viewport-controls {
  position: absolute;
  z-index: 7;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d5e2dd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(26, 43, 36, 0.12);
  padding: 4px;
  pointer-events: auto;
}

.citation-network-viewport-controls button {
  display: grid;
  place-items: center;
  min-width: 30px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #ffffff;
  color: #273832;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1;
  padding: 0 8px;
}

.citation-network-viewport-controls button:hover,
.citation-network-viewport-controls button:focus {
  border-color: #1f78b4;
  background: #eef7fc;
  color: #174d72;
  outline: 0;
}

.citation-network-view.inspector-collapsed .citation-network-stage {
  grid-template-columns: minmax(0, 1fr);
}

.citation-network-svg {
  width: 100%;
  height: 100%;
  min-height: 390px;
  background:
    radial-gradient(circle at 18px 18px, rgba(23, 32, 28, 0.035) 1px, transparent 1.5px),
    linear-gradient(#f2f6f4 1px, transparent 1px),
    linear-gradient(90deg, #f2f6f4 1px, transparent 1px),
    #fbfdfc;
  background-size: 42px 42px, 24px 24px, 24px 24px;
  cursor: grab;
  touch-action: none;
}

.citation-network-stage.is-panning .citation-network-svg {
  cursor: grabbing;
}

.citation-network-stage.is-circle-mode .citation-network-svg {
  cursor: crosshair;
}

.citation-network-core-actions button.active {
  border-color: #1f78b4;
  background: #eaf6fc;
  color: #174d72;
}

.citation-network-lasso {
  fill: rgba(31, 120, 180, 0.1);
  stroke: #1f78b4;
  stroke-width: 2.4;
  stroke-dasharray: 7 5;
  pointer-events: none;
}

.citation-network-node {
  cursor: grab;
}

.citation-network-node.dragging {
  cursor: grabbing;
}

.citation-network-node:focus {
  outline: 0;
}

.citation-network-node:focus circle,
.citation-network-node:focus rect,
.citation-network-node:focus polygon,
.citation-network-node:focus path.citation-role-glyph-shape {
  stroke: #1f78b4;
  stroke-width: 5px;
}

.citation-network-link-hit {
  cursor: pointer;
  pointer-events: stroke;
}

.citation-network-link {
  pointer-events: none;
}

.citation-network-links g:focus {
  outline: 0;
}

.citation-network-links g:focus .citation-network-link {
  opacity: 0.95;
  stroke-width: 4px;
}

.citation-network-node text {
  fill: #17201c;
  stroke: #fbfdfc;
  stroke-width: 4px;
  paint-order: stroke;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  pointer-events: none;
}

.citation-network-node.source text {
  font-size: 12px;
  font-weight: 820;
}

.citation-network-node.active circle,
.citation-network-node.active rect,
.citation-network-node.active polygon,
.citation-network-node.active path.citation-role-glyph-shape {
  stroke: #facc15;
  stroke-width: 5px;
}

.citation-network-node.selected circle {
  stroke: #4ade80;
}

.citation-network-node.expanded circle,
.citation-network-node.expanded rect,
.citation-network-node.expanded polygon,
.citation-network-node.expanded path.citation-role-glyph-shape {
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.35));
}

.citation-network-node.included circle,
.citation-network-node.included rect,
.citation-network-node.included polygon,
.citation-network-node.included path.citation-role-glyph-shape {
  filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.45));
}

.citation-network-hover-card {
  position: absolute;
  z-index: 8;
  display: grid;
  gap: 6px;
  width: 306px;
  max-width: min(306px, calc(100vw - 34px));
  border: 1px solid #cbd8d3;
  border-top: 4px solid #64748b;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(26, 43, 36, 0.17);
  padding: 9px;
  pointer-events: none;
}

.citation-network-hover-card.kind-paper {
  border-top-color: #0f172a;
}

.citation-network-hover-card.kind-source {
  border-top-color: #2563eb;
}

.citation-network-hover-card.kind-edge {
  border-top-color: #8b6f11;
}

.citation-network-hover-card strong {
  color: #17201c;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.citation-network-hover-card span {
  display: grid;
  gap: 2px;
  color: #3f524b;
  font-size: 10.5px;
  font-weight: 740;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.citation-network-hover-card b {
  color: #60726b;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.citation-network-inspector {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 9px;
  border-left: 1px solid #dce7e2;
  background: #ffffff;
  min-width: 0;
  overflow: auto;
  padding: 10px;
}

.citation-network-inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.citation-network-inspector-head strong {
  display: block;
  color: #17201c;
  font-size: 13px;
  font-weight: 880;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.citation-network-inspector-head span {
  display: block;
  margin-top: 3px;
  color: #60726b;
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1.25;
}

.citation-network-warning,
.citation-network-warning-list {
  border: 1px solid #f3d3c4;
  border-radius: 8px;
  background: #fff8f4;
  color: #8a3519;
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1.35;
  margin: 0;
  padding: 8px;
}

.citation-network-warning-list {
  display: grid;
  gap: 5px;
  list-style: none;
}

.citation-network-inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.citation-network-inspector-grid div {
  min-width: 0;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 7px;
}

.citation-network-inspector-grid dt {
  color: #60726b;
  font-size: 9.5px;
  font-weight: 850;
  line-height: 1;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.citation-network-inspector-grid dd {
  color: #17201c;
  font-size: 11px;
  font-weight: 790;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: anywhere;
}

.citation-network-inspector-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, 0.7fr) minmax(70px, 0.8fr);
  gap: 6px;
}

.citation-network-inspector-actions button {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citation-network-evidence-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
}

.citation-network-evidence-list > strong {
  color: #17201c;
  font-size: 11px;
  font-weight: 880;
}

.citation-network-evidence-list article {
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 7px;
}

.citation-network-evidence-list article span {
  display: block;
  color: #1f78b4;
  font-size: 9.5px;
  font-weight: 880;
  line-height: 1.1;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.citation-network-evidence-list article p,
.citation-network-empty-note {
  color: #3f524b;
  font-size: 10.5px;
  font-weight: 720;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: anywhere;
}

.citation-network-empty {
  display: grid;
  place-items: center;
  min-height: 390px;
  color: #60726b;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.35;
  padding: 24px;
  text-align: center;
}

.citation-network-empty.warning {
  color: #8a3519;
}

.research-node-action {
  min-width: 0;
  min-height: 30px;
  border: 1px solid #c9d4d0;
  border-radius: 7px;
  background: #ffffff;
  color: #17201c;
  font: inherit;
  font-size: 10px;
  font-weight: 840;
  line-height: 1;
  overflow: hidden;
  padding: 5px 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.research-node-action.primary {
  border-color: #1f78b4;
  background: #1f78b4;
  color: #ffffff;
}

.research-node-action.icon {
  display: grid;
  place-items: center;
  border-color: color-mix(in srgb, var(--node-tone, #64748b) 44%, #c9d4d0);
  background: color-mix(in srgb, var(--node-tone, #64748b) 9%, #ffffff);
  color: var(--node-tone, #475569);
  font-size: 15px;
  font-weight: 950;
  padding: 0;
}

.research-node-handle {
  width: 7px;
  height: 7px;
  border: 1px solid #ffffff;
  background: var(--node-tone, #64748b);
}

.research-path-node .react-flow__handle-left {
  left: -1px;
}

.research-path-node .react-flow__handle-right {
  right: -1px;
}

.branch-canvas {
  position: relative;
  min-width: 100%;
  min-height: 240px;
}

.branch-edge-svg {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.branch-edge-svg .branch-edge-path {
  fill: none;
  stroke: #aebfb9;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.branch-edge-group.branch-edge-lasso_subset .branch-edge-path,
.branch-edge-group.branch-edge-abstract_nearest .branch-edge-path {
  stroke: #1f78b4;
}

.branch-edge-group.branch-edge-agent_hybrid .branch-edge-path,
.branch-edge-group.branch-edge-graph_expansion .branch-edge-path,
.branch-edge-group.branch-edge-neighbour_expansion .branch-edge-path {
  stroke: #7a6f22;
  stroke-dasharray: 4 4;
}

.branch-edge-svg .branch-edge-arrow {
  fill: #aebfb9;
  stroke: none;
}

.branch-edge-label {
  fill: #35453f;
  stroke: #fbfdfc;
  stroke-width: 4px;
  paint-order: stroke fill;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  pointer-events: none;
}

.branch-canvas-node {
  position: absolute;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 146px;
  border: 1px solid #cfddd8;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  box-shadow: 0 7px 18px rgba(26, 43, 36, 0.08);
  padding: 10px;
}

.branch-canvas-node::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: #94a8a0;
}

.branch-canvas-node.branch-node-type-selection_root::before {
  background: #2f855a;
}

.branch-canvas-node.branch-node-type-lasso_subset::before,
.branch-canvas-node.branch-node-type-abstract_probe::before {
  background: #1f78b4;
}

.branch-canvas-node.branch-node-type-context_expansion::before {
  background: #b08b00;
}

.branch-canvas-node.branch-node-type-source_audit::before {
  background: #c2410c;
}

.branch-canvas-node.active {
  z-index: 4;
  border-color: #1f78b4;
  background: linear-gradient(180deg, #f7fbfe 0%, #eff7fc 100%);
  box-shadow: 0 0 0 2px #d8eefb, 0 9px 20px rgba(31, 120, 180, 0.14);
}

.branch-canvas-node.dragging {
  z-index: 5;
  cursor: grabbing;
  opacity: 0.92;
}

.branch-node-drag {
  cursor: grab;
  user-select: none;
}

.branch-canvas-node.dragging .branch-node-drag {
  cursor: grabbing;
}

.branch-node-top small {
  display: block;
  margin-top: 1px;
  color: #6b7d76;
  font-size: 9.5px;
  font-weight: 720;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-node-question {
  margin: 0;
  color: #43554f;
  font-size: 11px;
  font-weight: 690;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.branch-node-question-label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #52635d;
  font-size: 9.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.branch-node-question-input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border: 1px solid #d2ded9;
  border-radius: 4px;
  background: #fbfdfc;
  color: #17201c;
  font: inherit;
  font-size: 11px;
  font-weight: 720;
  padding: 6px 7px;
}

.branch-canvas-node em {
  margin: 0;
  color: #2b5f77;
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.branch-canvas-node .branch-node-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px minmax(66px, 0.72fr) 32px;
  gap: 5px;
  width: 100%;
  min-width: 0;
  margin-top: 1px;
}

.branch-canvas-node .branch-node-actions .button {
  min-width: 0;
  min-height: 30px;
  padding: 5px 4px;
  font-size: 10px;
  border-radius: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-symbol-button {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  width: 100%;
}

.branch-off-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.branch-inspector {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  border: 1px solid #d5e0dc;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.branch-inspector-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.branch-inspector-head h4 {
  margin: 0;
  color: #17201c;
  font-size: 13px;
  line-height: 1.2;
}

.branch-inspector-head p {
  margin: 3px 0 0;
  color: #60726b;
  font-size: 11px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.branch-inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.branch-inspector-tab {
  min-height: 28px;
  border: 1px solid #d0ded8;
  border-radius: 7px;
  background: #ffffff;
  color: #42544e;
  font-size: 10.5px;
  font-weight: 850;
  padding: 5px 8px;
  cursor: pointer;
}

.branch-inspector-tab.active {
  border-color: #1f78b4;
  background: #e9f5fc;
  color: #15577f;
}

.branch-inspector-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.branch-inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.branch-inspector-grid > div,
.branch-profile-list > div {
  min-width: 0;
  border: 1px solid #e0e9e5;
  border-radius: 7px;
  background: #ffffff;
  padding: 7px 8px;
}

.branch-inspector-grid strong,
.branch-profile-list strong {
  display: block;
  color: #61736c;
  font-size: 9.5px;
  font-weight: 880;
  line-height: 1.2;
  text-transform: uppercase;
}

.branch-inspector-grid span,
.branch-profile-list span {
  display: block;
  margin-top: 2px;
  color: #17201c;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.branch-profile-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.branch-inspector-question,
.branch-inspector-note,
.branch-inspector-empty {
  margin: 0;
  border: 1px solid #e0e9e5;
  border-radius: 7px;
  background: #ffffff;
  color: #26352f;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
  padding: 8px;
}

.branch-inspector-note {
  color: #385148;
  font-weight: 650;
}

.branch-inspector-paper-list,
.branch-warning-list {
  margin: 0;
  max-height: 132px;
  overflow: auto;
  border: 1px solid #e0e9e5;
  border-radius: 7px;
  background: #ffffff;
  color: #26352f;
  font-size: 11px;
  line-height: 1.35;
  padding: 8px 8px 8px 26px;
}

.branch-inspector-paper-list a {
  color: #15577f;
  font-weight: 760;
  text-decoration: none;
}

.branch-inspector-paper-list a:hover {
  text-decoration: underline;
}

.branch-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.branch-inspector-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.research-modal-open {
  overflow: hidden;
}

.research-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(19, 32, 27, 0.58);
  padding: 16px;
}

.research-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  min-height: min(720px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid rgba(186, 202, 195, 0.92);
  border-radius: 12px;
  background: #fbfdfc;
  box-shadow: 0 28px 80px rgba(12, 23, 18, 0.28);
}

.research-modal-workbench {
  width: min(1360px, calc(100vw - 28px));
}

.research-modal-paper-chat {
  width: min(1120px, calc(100vw - 28px));
}

.research-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #d7e2de;
  background: #ffffff;
  padding: 12px 14px;
}

.research-modal-head h3 {
  margin: 0;
  color: #14211c;
  font-size: 15px;
  line-height: 1.25;
}

.research-modal-head p {
  margin: 3px 0 0;
  color: #5e7069;
  font-size: 11.5px;
  font-weight: 690;
  line-height: 1.35;
}

.research-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.research-modal-body {
  min-height: 0;
  overflow: auto;
}

.rendered-md-layout {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.rendered-markdown {
  min-width: 0;
  max-width: 860px;
  color: #21332c;
  font-size: 13px;
  line-height: 1.55;
}

.rendered-markdown h2,
.rendered-markdown h3,
.rendered-markdown h4,
.rendered-markdown h5 {
  margin: 16px 0 7px;
  color: #14211c;
  line-height: 1.25;
}

.paper-chat-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: #f6faf8;
}

.paper-chat-source,
.paper-chat-question,
.paper-chat-result {
  min-width: 0;
  border: 1px solid #d9e5e0;
  border-radius: 10px;
  background: #ffffff;
}

.paper-chat-source {
  padding: 12px;
}

.paper-chat-source h4 {
  margin: 0;
  color: #13231d;
  font-size: 15px;
  line-height: 1.25;
}

.paper-chat-source p {
  margin: 4px 0 0;
  color: #5b6d65;
  font-size: 12px;
  font-weight: 730;
}

.paper-chat-links {
  margin-top: 7px;
  color: #5c6b66;
  font-size: 12px;
}

.paper-chat-links a {
  color: #0f6fa8;
  font-weight: 800;
}

.paper-chat-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px;
}

.paper-chat-question textarea {
  width: 100%;
  min-height: 76px;
}

.paper-chat-result {
  overflow: auto;
  padding: 12px;
}

.paper-chat-empty,
.paper-chat-loading,
.paper-chat-error {
  color: #566860;
  font-size: 13px;
  line-height: 1.45;
}

.paper-chat-error {
  color: #8d2828;
  font-weight: 760;
}

.paper-chat-audit {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.paper-chat-audit span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 1px solid #d7e2de;
  border-radius: 999px;
  background: #f7fbf9;
  color: #5b6b65;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 760;
}

.paper-chat-audit strong {
  color: #163128;
  font-size: 12px;
}

.paper-chat-answer .brief-meta {
  margin-top: 0;
}

.rendered-markdown h2 {
  font-size: 18px;
}

.rendered-markdown h3 {
  font-size: 15px;
}

.rendered-markdown h4,
.rendered-markdown h5 {
  font-size: 13px;
}

.rendered-markdown p {
  margin: 0 0 9px;
}

.rendered-markdown ul,
.rendered-markdown ol {
  margin: 0 0 11px 18px;
  padding: 0;
}

.rendered-markdown li {
  margin: 4px 0;
}

.rendered-markdown a {
  color: #15577f;
  font-weight: 760;
  text-decoration: none;
}

.rendered-markdown a:hover {
  text-decoration: underline;
}

.rendered-markdown code {
  border: 1px solid #dce7e2;
  border-radius: 4px;
  background: #f4f8f6;
  color: #273832;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 4px;
}

.rendered-markdown pre,
.rendered-md-raw pre {
  overflow: auto;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #f4f8f6;
  color: #26352f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  padding: 10px;
  white-space: pre;
}

.rendered-md-table-wrap {
  max-width: 100%;
  overflow: auto;
  margin: 0 0 12px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #ffffff;
}

.rendered-markdown table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 11.5px;
}

.rendered-markdown th,
.rendered-markdown td {
  border-bottom: 1px solid #e4ece8;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.rendered-markdown th {
  background: #f4f8f6;
  color: #44574f;
  font-size: 10px;
  font-weight: 880;
  text-transform: uppercase;
}

.rendered-md-raw {
  max-width: 860px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.rendered-md-raw summary {
  color: #40544c;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
}

.research-modal-workbench-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.research-modal-workbench-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
}

.research-modal-workbench-intro strong,
.research-modal-workbench-intro span {
  display: block;
}

.research-modal-workbench-intro strong {
  color: #14211c;
  font-size: 12px;
}

.research-modal-workbench-intro span {
  margin-top: 2px;
  color: #60726b;
  font-size: 11px;
  font-weight: 720;
}

.research-modal-workbench-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(320px, 390px);
  gap: 12px;
  min-height: 0;
}

.research-modal-workbench-main,
.research-modal-workbench-side {
  min-width: 0;
  min-height: 0;
}

.research-modal-workbench-side {
  overflow: auto;
}

.modal-branch-controls {
  margin-bottom: 8px;
}

.modal-branch-canvas-shell {
  height: min(68vh, 720px);
  min-height: 500px;
  max-height: none;
  overflow: hidden;
}

.branch-flow-react-ready .modal-branch-canvas-shell {
  height: min(68vh, 720px);
  min-height: 500px;
}

.modal-branch-canvas-shell .branch-flow-island-mount {
  min-height: 500px;
  height: 100%;
}

.research-flow-modal {
  grid-template-rows: auto minmax(420px, 1fr);
}

.brief-output {
  height: clamp(320px, 50vh, 720px);
  min-height: 220px;
  max-height: min(72vh, 760px);
  min-width: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid #d8e2de;
  border-radius: 4px;
  background: #fbfcfb;
  color: #26352f;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px;
}

.brief-output.has-rich-output {
  white-space: normal;
}

.brief-output h3 {
  margin: 0 0 6px;
  color: #17201c;
  font-size: 13px;
  line-height: 1.25;
}

.brief-output ul,
.brief-output ol {
  margin: 0;
  padding-left: 20px;
}

.brief-output li + li {
  margin-top: 6px;
}

.brief-section + .brief-section {
  margin-top: 12px;
}

.brief-section p {
  color: #26352f;
}

.citation-link {
  border-bottom: 1px solid rgba(11, 111, 81, 0.28);
  color: #0b6f51;
  font-weight: 820;
  text-decoration: none;
}

.citation-link:hover {
  border-bottom-color: #0b6f51;
}

.brief-dataset-links summary {
  cursor: pointer;
  color: #17201c;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}

.brief-dataset-links[open] summary {
  margin-bottom: 7px;
}

.research-agenda {
  display: grid;
  gap: 8px;
}

.agenda-card {
  border: 1px solid #dce7e2;
  border-radius: 4px;
  background: #ffffff;
  padding: 9px;
}

.agenda-card + .agenda-card {
  margin-top: 2px;
}

.agenda-card-top span {
  display: inline-block;
  margin-bottom: 4px;
  color: #1b6b5b;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.agenda-card-top h4 {
  margin: 0 0 7px;
  color: #192821;
  font-size: 12px;
  line-height: 1.3;
}

.agenda-field {
  display: grid;
  grid-template-columns: minmax(92px, 0.34fr) 1fr;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid #edf2f0;
}

.agenda-field span {
  color: #61706a;
  font-size: 10px;
  font-weight: 820;
}

.agenda-field p {
  margin: 0;
  color: #26352f;
  font-size: 11px;
  line-height: 1.38;
}

.agenda-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.agenda-anchors span,
.agenda-anchors a {
  border: 1px solid #d8e5df;
  border-radius: 999px;
  background: #f5faf7;
  color: #4a5f57;
  font-size: 10px;
  font-weight: 760;
  padding: 2px 6px;
  text-decoration: none;
}

.agenda-anchors a:hover {
  border-color: #8bbdaf;
  color: #0b6f51;
}

.selection-profile p {
  margin: 0 0 8px;
  color: #566962;
  font-size: 11px;
}

.profile-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.profile-count-block {
  border: 1px solid #e1e8e5;
  border-radius: 4px;
  background: #f8fbfa;
  padding: 7px 8px;
}

.profile-count-block span {
  display: block;
  margin-bottom: 3px;
  color: #385048;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.profile-count-block p {
  margin: 0;
  color: #26352f;
  font-size: 11px;
  line-height: 1.35;
}

.coverage-grid p {
  margin: 0 0 8px;
  color: #566962;
  font-size: 11px;
}

.brief-grid-table-wrap {
  overflow-x: auto;
  border: 1px solid #e1e8e5;
  border-radius: 4px;
}

.coverage-grid table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 11px;
}

.coverage-grid th,
.coverage-grid td {
  border-bottom: 1px solid #edf2f0;
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
}

.coverage-grid th {
  background: #f6faf8;
  color: #385048;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.coverage-grid tr:last-child td {
  border-bottom: 0;
}

.coverage-grid sup {
  font-size: 10px;
  line-height: 1;
}

.coverage-grid sup a {
  color: #0b6f51;
  text-decoration: none;
}

.brief-table-footnotes {
  margin: 7px 0 0;
  padding-left: 18px;
  color: #566962;
  font-size: 10.5px;
  line-height: 1.35;
}

.brief-table-footnotes li + li {
  margin-top: 4px;
}

.brief-table-footnotes span {
  color: #385048;
  font-weight: 760;
}

.brief-table-footnotes a {
  color: #0b6f51;
  font-weight: 680;
  text-decoration: none;
}

.brief-table-footnotes em {
  color: #6d7b75;
  font-style: normal;
}

.brief-progress-message {
  margin-bottom: 10px;
}

.brief-progress-message p {
  margin: 0;
  color: #475851;
}

.brief-error {
  border: 1px solid #e9c8c0;
  border-radius: 4px;
  background: #fff7f4;
  padding: 10px;
  margin-bottom: 10px;
}

.brief-error h3 {
  margin: 0 0 5px;
  color: #7b2e1f;
  font-size: 14px;
}

.brief-error p {
  margin: 4px 0 0;
  color: #5f463f;
}

.brief-error-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.brief-working {
  margin-top: 12px;
  border-top: 1px solid #e1e8e5;
  padding-top: 10px;
}

.brief-working summary {
  cursor: pointer;
  color: #175f50;
  font-size: 12px;
  font-weight: 850;
}

.brief-working > p {
  margin: 6px 0 9px;
  color: #5f6f69;
  font-size: 11px;
}

.brief-working-group {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #edf2f0;
}

.brief-working-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.brief-working-group h4 {
  margin: 0;
  color: #1f3d36;
  font-size: 12px;
}

.brief-working-group > p {
  margin: 3px 0 7px;
  color: #66756f;
  font-size: 10.5px;
  line-height: 1.35;
}

.brief-working-card {
  margin-top: 8px;
  border: 1px solid #dce7e2;
  border-radius: 4px;
  background: #ffffff;
  padding: 8px;
}

.brief-working-card.live {
  border-color: #b9d8f0;
  background: #f5fbff;
}

.brief-working-card h5 {
  margin: 0 0 3px;
  color: #23342f;
  font-size: 12px;
}

.brief-working-card pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #33443e;
  font: inherit;
  font-size: 11px;
  line-height: 1.42;
}

.brief-working-meta {
  color: #64736e;
  font-size: 10px;
}

.brief-meta,
.brief-source-role,
.brief-source-note,
.brief-source-status,
.brief-source-links {
  color: #5f6f69;
  font-size: 11px;
  line-height: 1.4;
}

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

.brief-link-list {
  display: grid;
  gap: 7px;
}

.brief-source-list li {
  padding-bottom: 7px;
  border-bottom: 1px solid #e2e9e6;
}

.brief-link-list li {
  padding-bottom: 7px;
  border-bottom: 1px solid #e2e9e6;
}

.brief-source-list li:last-child {
  border-bottom: 0;
}

.brief-link-list li:last-child {
  border-bottom: 0;
}

.brief-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.brief-url-text {
  color: #64736e;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.analysis-card {
  min-height: 96px;
  overflow: auto;
}

.panel-text {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.metric-line {
  margin: 3px 0;
}

.chip {
  display: inline-block;
  margin: 2px 5px 2px 0;
  padding: 2px 6px;
  border: 1px solid #c6d2ce;
  border-radius: 999px;
  background: #ffffff;
  color: #26352f;
  font-size: 11px;
}

.secret-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 17, 16, 0.46);
}

.secret-dialog {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  border: 1px solid #c9d4d0;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(16, 36, 31, 0.28);
  padding: 16px;
}

.secret-dialog p {
  font-size: 12px;
}

.secret-dialog-input {
  width: 100%;
}

.secret-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .workbench {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .column-resizer {
    display: none;
  }

  .height-resizer {
    height: 18px;
    flex-basis: 18px;
  }

.right-column {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .summary-panel {
    grid-column: 1 / -1;
    flex: 0 0 auto;
    max-height: none;
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 520px) {
  .tooltip {
    max-width: calc(100% - 20px);
  }

  .citation-network-role-buttons {
    grid-template-columns: 1fr;
  }

  .mini-map {
    right: 8px;
    bottom: 8px;
    width: min(124px, 34vw);
    height: 94px;
  }
}

@media (min-width: 1400px) {
  .left-column {
    grid-template-columns: minmax(240px, 0.45fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: start;
  }

  .paper-finder {
    grid-column: 1;
    grid-row: 1;
  }

  .map-controls {
    grid-column: 2;
    grid-row: 1;
  }

  .plot-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 760px) {
  .evidence-app {
    height: auto;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .app-header,
  .panel-title-row,
  .control-strip,
  .finder-row,
  .topic-search,
  .abstract-placement-actions,
  .brief-question-row,
  .summary-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .top-actions {
    justify-content: flex-start;
  }

  .button,
  select,
  input,
  .lane-select,
  .wide-control {
    width: 100%;
  }

  .brief-question-row .button {
    width: 100%;
  }

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

  .paper-chat-question .button {
    width: 100%;
  }

  .wide-control {
    flex: 0 1 auto;
  }

  .status-row {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .workbench {
    padding: 6px;
  }

  .left-column,
  .right-column {
    display: block;
    overflow: visible;
  }

  .left-column {
    display: flex;
    flex-direction: column;
  }

  .plot-panel {
    order: 1;
  }

  .map-controls {
    order: 2;
  }

  .paper-finder {
    order: 3;
  }

  .left-column > *,
  .right-column > * {
    margin-bottom: 8px;
  }

  .search-table {
    height: 128px;
  }

  .search-table table {
    min-width: 720px;
  }

  .plot-panel {
    grid-template-rows: auto minmax(380px, 56vh) auto;
  }

  .plot-wrap {
    min-height: 380px;
    height: min(520px, 56vh);
  }

  .plot-head,
  .result-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .plot-head {
    grid-template-areas:
      "copy"
      "tools"
      "legend";
    gap: 6px;
  }

  .plot-tools {
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .tool-button {
    min-width: 42px;
    min-height: 34px;
    padding: 8px 10px;
  }

  .legend {
    flex-wrap: wrap;
    max-width: 100%;
    max-height: 58px;
    overflow-x: hidden;
    overflow-y: auto;
    text-align: left;
    scrollbar-width: thin;
  }

  .legend span {
    flex: 1 1 150px;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .brief-output {
    max-height: none;
    height: auto;
  }

  .branch-workbench {
    max-height: none;
  }

  .branch-follow-up-row,
  .branch-head {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .branch-head-actions,
  .saved-path-picker {
    width: 100%;
  }

  .branch-head-actions .button {
    width: 100%;
  }

  .branch-form-head,
  .branch-form-grid {
    grid-template-columns: 1fr;
  }

  .branch-form-head {
    display: grid;
  }

  .branch-flow-controls {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .branch-flow-controls .branch-follow-up,
  .branch-flow-controls .button {
    flex: 0 1 auto;
    width: 100%;
  }

  .branch-canvas-shell {
    max-height: 420px;
    min-height: 320px;
  }

  .branch-flow-react-ready .branch-canvas-shell {
    height: 390px;
    min-height: 390px;
    max-height: none;
  }

  .research-flow-shell {
    min-height: 100%;
    height: 100%;
  }

  .research-flow-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .research-flow-toolbar-actions,
  .research-flow-toolbar-actions button {
    width: 100%;
  }

  .citation-network-panel-head,
  .citation-network-corebar,
  .citation-network-settings-popover {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .citation-network-settings-popover {
    left: 8px;
    right: 8px;
    width: auto;
    margin: 7px 0 0;
  }

  .citation-network-panel-head {
    display: grid;
  }

  .citation-network-panel-actions,
  .citation-network-core-actions {
    justify-content: stretch;
  }

  .citation-network-selected-tray {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .citation-network-selected-tray strong,
  .citation-network-selected-tray span {
    white-space: normal;
  }

  .citation-network-panel-actions .button,
  .citation-network-core-actions button {
    flex: 1 1 120px;
  }

  .citation-network-role-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(220px, 42vh);
    overflow: auto;
  }

  .citation-network-stage {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 54vh) auto;
  }

  .citation-network-svg {
    min-height: 360px;
  }

  .citation-network-node text {
    font-size: 10px;
    display: none;
  }

  .citation-network-node.active text,
  .citation-network-node.selected text {
    display: block;
  }

  .citation-network-node.source text {
    font-size: 9px;
  }

  .citation-network-hover-card,
  .research-edge-hover-card,
  .research-node-hover {
    display: none !important;
  }

  .citation-network-inspector {
    max-height: 320px;
    border-top: 1px solid #dce7e2;
    border-left: 0;
  }

  .citation-network-inspector-actions {
    grid-template-columns: 1fr;
  }

  .research-flow-canvas .react-flow__minimap {
    display: none;
  }

  .research-path-node {
    width: 260px;
  }

  .research-node-actions {
    grid-template-columns: 1fr 1fr;
  }

  .branch-canvas-node .branch-node-actions {
    grid-template-columns: 1fr;
  }

  .branch-inspector-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .branch-inspector-tabs {
    justify-content: stretch;
  }

  .branch-inspector-tab {
    flex: 1 1 calc(50% - 4px);
  }

  .branch-inspector-grid,
  .branch-profile-list {
    grid-template-columns: 1fr;
  }

  .branch-inspector-actions,
  .branch-inspector-actions .button {
    width: 100%;
  }

  .research-modal-backdrop {
    align-items: stretch;
    justify-items: stretch;
    padding: 8px;
  }

  .research-modal,
  .research-modal-workbench {
    width: calc(100vw - 16px);
    min-height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 10px;
  }

  .research-modal-head {
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .research-modal-actions,
  .research-modal-actions .button {
    width: 100%;
  }

  .research-modal-actions .button {
    justify-content: center;
  }

  .rendered-md-layout,
  .research-modal-workbench-body {
    padding: 10px;
  }

  .rendered-markdown,
  .rendered-md-raw {
    max-width: none;
  }

  .rendered-markdown table {
    min-width: 520px;
  }

  .research-modal-workbench-intro {
    display: grid;
    grid-template-columns: 1fr;
  }

  .research-modal-workbench-grid {
    grid-template-columns: 1fr;
  }

  .modal-branch-canvas-shell,
  .branch-flow-react-ready .modal-branch-canvas-shell {
    height: 520px;
    min-height: 520px;
  }

  .modal-branch-canvas-shell .branch-flow-island-mount {
    min-height: 520px;
  }

  .workbench-artifact-panel,
  .download-md-preview {
    max-height: none;
    height: auto;
  }

  .workbench-kpi-row {
    grid-template-columns: 1fr;
  }

  .fork-mode-grid {
    grid-template-columns: 1fr;
  }

  .profile-count-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: 18px;
  }

  .status-row {
    grid-template-columns: 1fr;
  }

  .lane-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow-x: visible;
  }

  .lane-button,
  .mode-button {
    width: 100%;
    white-space: normal;
  }

  .mode-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .mini-map {
    width: 96px;
    height: 72px;
  }
}

/* ===== UX tidy layer (2026-07-05): map-first, collapsibles, stage, reader ===== */
@media (min-width: 1100px) {
  .left-column .plot-panel { order: -1; }
  .left-column .paper-finder { order: 1; }
  .left-column .map-controls { order: 2; }
}
.ux-collapsible h2 .ux-caret::after { content: " ▾"; opacity: 0.55; font-size: 0.85em; }
.ux-collapsed h2 .ux-caret::after { content: " ▸"; }
.ux-collapsed > *:not(.panel-title-row):not(h2):not(:has(h2)) { display: none !important; }
.ux-collapsed > :has(h2) > *:not(h2):not(:has(h2)):not(.panel-title-row) { display: none !important; }
.ux-collapsed .panel-title-row ~ * { display: none !important; }
.ux-expand-btn { position: sticky; top: 4px; z-index: 5; float: right; margin: 4px; }
.ux-stage { position: fixed !important; inset: 14px !important; z-index: 1200 !important;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 12px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.28); overflow: auto !important; padding: 14px; }
body.ux-stage-open::after { content: ""; position: fixed; inset: 0; z-index: 1100;
  background: rgba(15, 23, 42, 0.45); }
#uxReader { position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 92vw); z-index: 1300;
  background: #fff; border-left: 1px solid #cbd5e1; box-shadow: -14px 0 40px rgba(15,23,42,0.18);
  transform: translateX(102%); transition: transform 0.22s ease; overflow-y: auto; padding: 14px 16px; }
body.ux-reader-open #uxReader { transform: translateX(0); }
.ux-reader-head { display: flex; justify-content: space-between; align-items: center; }
.ux-reader-item { border-bottom: 1px solid #e2e8f0; padding: 7px 0; }
.ux-reader-item summary { cursor: pointer; line-height: 1.35; }
.ux-reader-meta { display: block; color: #64748b; font-size: 12px; }
.ux-reader-links a { margin-right: 10px; }
.ux-reader-btn { margin-left: 8px; }

/* ===== UX tidy v2: tabs, mode strip, compact header ===== */
.ux-tabbar { display: flex; gap: 6px; margin: 0 0 10px; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; position: sticky; top: 0; background: inherit; z-index: 6; }
.ux-tabbar button { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; }
.ux-tabbar button.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.ux-tab-hidden { display: none !important; }
.ux-mode-strip { display: inline-flex; gap: 4px; margin-left: 10px; }
.ux-mode-strip .mode-button { padding: 3px 10px; font-size: 12px; }
header .title-block h1, .title-block h1 { font-size: 20px; margin: 2px 0; }
.status-row { padding-top: 2px; padding-bottom: 2px; }

.app-header { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ux-inline-status { display: flex !important; gap: 14px; margin: 0 0 0 auto; padding: 0 !important; border: none !important; background: transparent !important; box-shadow: none !important; }
.ux-inline-status > div { padding: 0; font-size: 12px; }
.app-header #headerSub { margin: 0; font-size: 12px; }
.left-column .panel.ux-collapsed { padding: 8px 14px; }
.ux-collapsed h2 { margin: 0; }
.ux-collapsible h2 { cursor: pointer; user-select: none; }
.ux-caret { color: #64748b; font-size: 11px; margin-right: 6px; }
.right-column .panel.analysis-card.ux-collapsed { padding: 8px 14px; }
/* G9 S4: don't clip control labels */
.summary-controls select, .summary-controls .select-wrap select { max-width: 100%; text-overflow: ellipsis; }
.app-header { row-gap: 4px; }
.ux-inline-status { flex-wrap: wrap; min-width: 0; }
.ux-inline-status > div { white-space: nowrap; }
/* G10 C1: corebar compaction — swatches were computing display:block, stacking glyphs vertically */
.citation-network-legend-swatches { display: inline-flex !important; flex-wrap: nowrap; }
.citation-network-core-actions { align-items: center; }
.citation-network-core-actions button { height: auto; }
.citation-network-corebar { align-items: center; }
/* G10 C2: disabled affordance */
.citation-network-core-actions button:disabled { opacity: 0.45; cursor: not-allowed; }
/* G10 C3: paths island breathing room */
.branch-flow-island-mount { min-height: 480px; }
.ux-stage .branch-flow-island-mount { min-height: 74vh; }
/* G10 C1b: corebar title was squeezed to 60px by grid 1fr/auto; let rows wrap instead */
.citation-network-corebar { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.citation-network-corebar > div:first-child { flex: 1 1 240px; min-width: 220px; }
.citation-network-corebar > div:first-child strong { display: inline; margin-right: 6px; }
.citation-network-corebar > div:first-child span { display: inline; }
/* G13 P2/E4: agent finding chips */
.agent-finding-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.agent-finding-chips .chip { border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; border: 1px solid; }
.agent-finding-chips .chip-ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.agent-finding-chips .chip-warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.agent-suggestions { display: grid; gap: 5px; margin: 0 0 10px; }
.agent-suggestion { display: flex; align-items: center; gap: 8px; border: 1px dashed #94a3b8; border-radius: 8px; padding: 5px 10px; font-size: 12px; background: #f8fafc; }
.agent-suggestion span { flex: 1; }
.agent-suggestion .button { padding: 2px 10px; font-size: 11px; }
/* Three-tab view switch: workbench subtree visibility (survives app re-renders) */
.summary-panel[data-ux-view="paths"] #branchWorkbench .citation-network-panel { display: none !important; }
.summary-panel[data-ux-view="network"] #branchWorkbench > *:not(.citation-network-panel):not(:has(.citation-network-panel)) { display: none !important; }
.summary-panel[data-ux-view="network"] #branchWorkbench :has(> .citation-network-panel) > *:not(.citation-network-panel) { display: none !important; }
.citation-network-stage.is-pan-mode svg { cursor: grab; }
.citation-network-stage.is-pan-mode.is-panning svg { cursor: grabbing; }
.citation-network-viewport-controls button.active { background: #0f172a; color: #fff; border-color: #0f172a; }
/* Paper chat: chatbot layout — transcript grows, input pinned at bottom */
.paper-chat-body { display: flex; flex-direction: column; height: min(72vh, 720px); }
.paper-chat-source { flex: 0 0 auto; }
.paper-chat-transcript { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 2px; }
.chat-msg { max-width: 88%; border-radius: 12px; padding: 8px 12px; font-size: 13px; line-height: 1.45; }
.chat-msg.user { align-self: flex-end; background: #0f172a; color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: #f1f5f9; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.chat-msg.assistant.streaming::after { content: "▍"; animation: chatblink 1s steps(2) infinite; color: #64748b; }
@keyframes chatblink { 50% { opacity: 0; } }
.paper-chat-inputrow { flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid #e2e8f0; padding-top: 10px; }
.paper-chat-inputrow textarea { flex: 1; resize: none; }
.paper-chat-picker { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.paper-chat-picker select { flex: 1; max-width: 520px; text-overflow: ellipsis; }
.citation-network-max-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #334155; }
.citation-network-max-label select { padding: 3px 6px; border-radius: 6px; }
/* The islands ARE the feature of their tabs — size them like the map */
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount { min-height: 72vh; }
.summary-panel[data-ux-view="network"] .citation-network-island-mount,
.summary-panel[data-ux-view="network"] .citation-network-island-mount .research-flow-shell,
.summary-panel[data-ux-view="network"] .citation-network-island-mount .research-flow-canvas { min-height: 70vh; }
.summary-panel[data-ux-view="network"] .citation-network-stage,
.summary-panel[data-ux-view="network"] .citation-network-svg { min-height: 64vh; }
/* Island tabs fill the viewport like the map: pin panel height, flex-fill the canvas chain */
.summary-panel[data-ux-view="network"],
.summary-panel[data-ux-view="paths"] { height: calc(100vh - 86px); overflow: hidden; display: flex; flex-direction: column; }
.summary-panel[data-ux-view="network"] #branchWorkbench,
.summary-panel[data-ux-view="paths"] #branchWorkbench { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* network view: the citation panel becomes a full-height flex column */
.summary-panel[data-ux-view="network"] #branchWorkbench { display: flex; flex-direction: column; }
.summary-panel[data-ux-view="network"] .citation-network-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.summary-panel[data-ux-view="network"] #citationNetworkIsland { flex: 1 1 auto; min-height: 420px; }
.summary-panel[data-ux-view="network"] #citationNetworkIsland .research-flow-shell,
.summary-panel[data-ux-view="network"] #citationNetworkIsland .research-flow-canvas,
.summary-panel[data-ux-view="network"] .citation-network-view { height: 100%; }
.summary-panel[data-ux-view="network"] .citation-network-stage,
.summary-panel[data-ux-view="network"] .citation-network-svg { height: 100%; min-height: 420px; }
/* compress the network panel head on its own tab (the tab label already says where we are) */
.summary-panel[data-ux-view="network"] .citation-network-panel-head { padding: 4px 8px; }
.summary-panel[data-ux-view="network"] .citation-network-panel-head p { font-size: 10px; line-height: 1.3; margin: 0; }
.summary-panel[data-ux-view="network"] .citation-network-panel-head h2,
.summary-panel[data-ux-view="network"] .citation-network-panel-head h4 { font-size: 12px; margin: 0; }
/* the analysis cards belong to Ask & Brief context — free the viewport on island tabs */
.right-column:has(.summary-panel[data-ux-view="network"]) > .panel.analysis-card,
.right-column:has(.summary-panel[data-ux-view="paths"]) > .panel.analysis-card { display: none; }
/* the workbench's 58vh cap defeats the island-tab fill — lift it on those views */
.summary-panel[data-ux-view="network"] #branchWorkbench,
.summary-panel[data-ux-view="paths"] #branchWorkbench { max-height: none; }
/* G15 T2: trail island fills its tab like the network does */
.summary-panel[data-ux-view="paths"] #branchWorkbench { display: flex; flex-direction: column; }
.summary-panel[data-ux-view="paths"] #branchWorkbench > .branch-canvas-shell { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount { flex: 1 1 auto; min-height: 420px; height: auto; }
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount .research-flow-shell,
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount .react-flow,
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount .research-flow-canvas { height: 100%; min-height: 420px; }
/* G15 T4 */
.ux-lane-strip { grid-column: 1 / -1; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 6px 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ux-lane-strip #mapStatusLine { margin: 0; font-size: 11px; color: #60726b; flex: 0 0 auto; }
.ux-lane-strip #laneButtons { display: flex; flex-wrap: wrap; gap: 4px; }
.ux-abstract-below { grid-column: 1 / -1; margin-top: 8px; }
/* strip must beat the plot panel's order:-1; below-block shares -1 but follows in DOM */
.ux-lane-strip { order: -2; }
.ux-abstract-below { order: -1; }
/* trail canvas priority: at least 56vh; tracker below reachable by scroll */
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount { min-height: 56vh; }
@media (min-width: 1400px) {
  /* explicit rows beat order: lanes strip row 2, map row 3, abstract row 4 */
  .left-column { grid-template-rows: auto auto auto auto; }
  .ux-lane-strip { grid-column: 1 / -1; grid-row: 2; }
  .plot-panel { grid-row: 3; }
  .ux-abstract-below { grid-column: 1 / -1; grid-row: 4; }
}
/* G16b: size the canvas SHELL, not the island — the island's own min-height overflowed the
   shell and the branch-inspector laid out over the canvas (nodes behind other elements) */
.summary-panel[data-ux-view="paths"] .branch-canvas-shell { flex: 1 1 auto; min-height: 56vh; display: flex; flex-direction: column; }
.summary-panel[data-ux-view="paths"] .branch-flow-island-mount { flex: 1 1 auto; min-height: 0; height: auto; }
.summary-panel[data-ux-view="paths"] #branchWorkbench > .branch-canvas-shell { min-height: 56vh; }
.chat-takeaways { margin: 6px 0; padding-left: 18px; }
.chat-evidence { margin: 6px 0; font-size: 12px; }
.chat-followups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-followup { border: 1px dashed #94a3b8; background: #f8fafc; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; text-align: left; }
.chat-followup:hover { background: #eef2f7; }
/* stage tracker sits lower: clear separation below the island canvas on both island tabs */
.summary-panel[data-ux-view="paths"] .progress-rail,
.summary-panel[data-ux-view="network"] .progress-rail,
.summary-panel[data-ux-view="paths"] #agentProcessTracker,
.summary-panel[data-ux-view="network"] #agentProcessTracker { margin-top: 22px; }
.summary-panel[data-ux-view="paths"] .branch-inspector { margin-top: 24px; }
.summary-panel[data-ux-view="network"] .citation-network-panel + * { margin-top: 24px; }
/* Island tabs: tracker compacts to a one-row title strip (descriptions hide); islands take the space */
.summary-panel[data-ux-view="paths"] #agentProcessTracker,
.summary-panel[data-ux-view="network"] #agentProcessTracker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 16px; }
.summary-panel[data-ux-view="paths"] .agent-process-step p,
.summary-panel[data-ux-view="network"] .agent-process-step p { display: none; }
.summary-panel[data-ux-view="paths"] .agent-process-step,
.summary-panel[data-ux-view="network"] .agent-process-step { padding: 5px 8px; font-size: 11px; max-height: 32px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* islands absorb the reclaimed space */
.summary-panel[data-ux-view="paths"] #branchWorkbench > .branch-canvas-shell { min-height: 62vh; }
.summary-panel[data-ux-view="network"] #citationNetworkIsland { min-height: 62vh; }

.summary-panel[data-ux-view="network"] .citation-network-stage,
.summary-panel[data-ux-view="network"] .citation-network-svg { min-height: 52vh; }
/* G19 H1: trail chrome budget — compact head, one-line question that grows on focus */
.summary-panel[data-ux-view="paths"] .branch-head { padding: 4px 0; }
.summary-panel[data-ux-view="paths"] .branch-head h3 { font-size: 13px; margin: 0; }
.summary-panel[data-ux-view="paths"] #branchQuestion { max-height: 2.3em; min-height: 2.3em; transition: max-height 0.15s; overflow: hidden; }
.summary-panel[data-ux-view="paths"] #branchQuestion:focus { max-height: 9em; overflow: auto; }
.summary-panel[data-ux-view="paths"] .branch-follow-up-row { margin: 2px 0; }
/* G19 H2: network head <= 2 compact rows */
.summary-panel[data-ux-view="network"] .citation-network-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.summary-panel[data-ux-view="network"] .citation-network-panel-head p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
/* G19 H3: bigger react-flow zoom controls on the trail */
.summary-panel[data-ux-view="paths"] .react-flow__controls { box-shadow: 0 2px 8px rgba(15,23,42,0.18); }
.summary-panel[data-ux-view="paths"] .react-flow__controls button { width: 32px; height: 32px; }
.summary-panel[data-ux-view="paths"] .react-flow__controls button svg { width: 14px; height: 14px; }
/* minimise nodes: compact cards */
.ux-mini-nodes .research-node-question-editor,
.ux-mini-nodes .research-node-meta,
.ux-mini-nodes .research-node-more,
.ux-mini-nodes .research-node-actions .research-node-action:not(.primary) { display: none !important; }
.ux-mini-nodes .react-flow__node { max-width: 210px; }
.ux-mini-btn { position: absolute; top: 8px; right: 110px; z-index: 5; font-size: 11px; }
.ux-mini-nodes .research-node-top { display: none !important; }
.ux-mini-nodes .react-flow__node .research-node-actions { margin-top: 2px; }
.ux-mini-nodes .react-flow__node > div { padding: 6px 10px; }
.ux-mini-nodes .research-node-actions { min-height: 0 !important; height: auto !important; margin: 2px 0 0 !important; }
.ux-mini-nodes .research-node-action.primary { height: 28px !important; min-height: 0 !important; padding: 3px 14px !important; font-size: 12px !important; }
.ux-mini-nodes .research-path-node { padding: 8px 10px !important; }
.ux-mini-nodes .research-path-node, .ux-mini-nodes .react-flow__node { min-height: 0 !important; height: auto !important; }
.citation-network-role-bulk { display: flex; gap: 6px; margin-top: 6px; }
.citation-network-role-bulk button { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 6px; padding: 3px 10px; font-size: 11px; cursor: pointer; }
.citation-network-role-bulk button:hover { background: #eef2f7; }
.citation-network-role-bulk-row { grid-column: 1 / -1; order: -1; flex-wrap: wrap; }
/* G20 S3 */
.research-node-toolbar { display: flex; gap: 4px; background: #fff; border: 1px solid #d5e0dc; border-radius: 8px; padding: 4px 6px; box-shadow: 0 4px 12px rgba(15,23,42,0.14); }
.research-node-artifacts { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 0; }
.research-node-artifacts .chip { font-size: 10px; border-radius: 999px; padding: 1px 8px; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.research-node-artifacts .chip.warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
/* G20 S4 */
.citation-network-hover-card.pinned { pointer-events: auto; z-index: 30; max-width: 380px; }
.edge-evidence-close { position: absolute; top: 4px; right: 6px; border: none; background: none; cursor: pointer; font-size: 12px; }
.edge-evidence-snippet { display: block; margin: 4px 0; font-size: 11px; line-height: 1.4; }
.edge-evidence-snippet code { font-size: 9px; color: #64748b; }
.edge-evidence-loading { display: block; font-style: italic; color: #64748b; margin: 4px 0; }
.edge-evidence-ask { margin-top: 6px; font-size: 11px; }
/* G20 S5: stage sub-nodes */
.stage-subnode { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; padding: 3px 10px; font-size: 10px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 6px rgba(15,23,42,0.10); }
.stage-subnode.state-done { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; animation: chatblink 1.2s steps(2) infinite; }
.stage-dot.done { background: #10b981; animation: none; }
.research-node-note { font-size: 10px; background: #fefce8; border: 1px solid #fde68a; border-radius: 6px; padding: 4px 8px; margin: 2px 0; color: #713f12; }
/* Fix: node cards start slightly smaller (question editor 2 lines by default, grows on focus) */
.research-node-question-editor { max-height: 3.6em; overflow: hidden; transition: max-height 0.15s; }
.research-node-question-editor:focus-within { max-height: 12em; overflow: auto; }
.research-path-node { padding: 10px 12px; }
.paper-chat-inputrow #paperChatDepth { flex: 0 0 auto; padding: 4px 8px; border-radius: 6px; align-self: stretch; }
/* G23: condensed node toolbar (icon buttons) */
.research-node-toolbar .research-node-action { min-width: 30px; padding: 4px 7px; font-size: 13px; }
/* trail canvas: more vertical room */
.summary-panel[data-ux-view="paths"] #branchWorkbench > .branch-canvas-shell { min-height: 66vh; }
/* G24 T3: clicked / active button state */
.research-node-action.is-active { background: #2563eb !important; color: #fff !important; border-color: #2563eb !important; }
.research-node-action.just-clicked { background: #2563eb !important; color: #fff !important; border-color: #2563eb !important; transition: background 0.1s; }
/* G24b: lasso-armed banner floats over the workbench top instead of pushing the island down
   (the 54px reflow that made nodes appear to jump on Select/Branch) */
.branch-workbench { position: relative; }
.branch-lasso-armed { position: absolute; top: 4px; left: 8px; right: 8px; z-index: 8; margin: 0; box-shadow: 0 4px 14px rgba(15,23,42,0.16); }
/* G24c: prominent zoom bar on the trail (matches the network Pan/+/-/Fit bar) */
.research-flow-zoombar { position: absolute; top: 8px; left: 8px; z-index: 6; display: flex; gap: 4px; background: rgba(255,255,255,0.94); border: 1px solid #d5e2dd; border-radius: 8px; padding: 4px; box-shadow: 0 4px 12px rgba(26,43,36,0.12); }
.research-flow-zoombar button { min-width: 30px; height: 30px; border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 6px; font-size: 15px; font-weight: 700; cursor: pointer; display: grid; place-items: center; }
.research-flow-zoombar button:hover { background: #eef2f7; }
/* G26 S5: Ask & Brief context bar */
.brief-context-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: #475569; margin: 2px 0 6px; }
.brief-context-label { cursor: pointer; }
.brief-context-label:hover strong { text-decoration: underline; }
.brief-context-actions { display: flex; gap: 6px; }
.brief-context-actions .button { padding: 3px 10px; font-size: 11px; }

/* G29: Export popover (shared affordance) */
.export-popover {
  position: absolute;
  z-index: 3000;
  min-width: 244px;
  background: #ffffff;
  border: 1px solid #cbd8d3;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 36, 31, 0.18);
  padding: 8px;
  font-size: 13px;
  color: #17201c;
}
.export-pop-title { font-size: 11px; color: #64748b; padding: 2px 6px 8px; }
.export-pop-list { display: flex; flex-direction: column; }
.export-pop-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 8px; border-radius: 6px; color: #17201c; font-size: 13px;
}
.export-pop-row:hover { background: #f2f6f4; }
.export-pop-row.is-selected { background: #e8f1fb; }
.export-pop-radio { color: #1f78b4; width: 14px; display: inline-block; }
.export-pop-label { flex: 1; }
.export-pop-ext { color: #64748b; }
.export-pop-star { color: #1f78b4; font-size: 11px; visibility: hidden; }
.export-pop-row.is-selected .export-pop-star { visibility: visible; }
.export-pop-more { margin-top: 2px; }
.export-pop-more > summary { list-style: none; cursor: pointer; color: #60726b; padding: 6px 8px; font-size: 12px; }
.export-pop-more > summary::-webkit-details-marker { display: none; }
.export-pop-more[open] > summary { color: #17201c; }
.export-pop-actions { display: flex; gap: 8px; border-top: 1px solid #dce7e2; margin-top: 6px; padding-top: 8px; }
.export-pop-actions .button { flex: 1; padding: 6px; font-size: 13px; }

/* G29: chain-download popup (exporting from a trail child) */
.chain-popup-overlay {
  position: fixed; inset: 0; z-index: 3100;
  background: rgba(16, 36, 31, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.chain-popup {
  background: #ffffff; border: 1px solid #cbd8d3; border-radius: 12px;
  box-shadow: 0 18px 40px rgba(16, 36, 31, 0.28);
  padding: 18px 20px; width: 372px; max-width: calc(100vw - 32px);
  color: #17201c; font-size: 13px;
}
.chain-popup-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.chain-popup-sub { color: #60726b; margin-bottom: 12px; }
.chain-popup-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.chain-popup-step { line-height: 1.9; }
.chain-dot { color: #64748b; }
.chain-popup-step:last-child .chain-dot { color: #1f78b4; }
.chain-popup-check { display: flex; align-items: center; gap: 8px; color: #60726b; margin: 4px 0 14px; padding-top: 10px; border-top: 1px solid #dce7e2; }
.chain-popup-actions { display: flex; gap: 8px; }
.chain-popup-actions .button { flex: 1; padding: 8px; font-size: 13px; }
.chain-popup-actions .button.primary { flex: 1.3; }

/* G31: cited-work numbered references [N] + References list */
.cited-ref-mark { font-size: 0.82em; vertical-align: super; line-height: 0; text-decoration: none; color: #1f78b4; font-weight: 500; padding: 0 1px; }
.cited-ref-mark:hover { text-decoration: underline; }
.cited-references .cited-ref-note { font-size: 12px; color: #64748b; margin: 2px 0 8px; }
.brief-cited-ref-list { margin: 0; padding-left: 22px; }
.brief-cited-ref-list li { margin: 3px 0; font-size: 13px; }
.cited-ref-roles { color: #64748b; font-size: 12px; }
