:root {
  --lab-bg: #f7f9fa;
  --lab-surface: #ffffff;
  --lab-surface-soft: #f1f5f4;
  --lab-surface-tint: #fbfcfc;
  --lab-text: #1f2933;
  --lab-muted: #607080;
  --lab-border: #e3e8e6;
  --lab-border-strong: #d2dcda;
  --lab-accent: #2f8f7b;
  --lab-accent-strong: #237361;
  --lab-accent-soft: #e4f4f0;
  --lab-info: #3d7ebd;
  --lab-info-soft: #e7f1fb;
  --lab-warning: #b97818;
  --lab-warning-soft: #fff4df;
  --lab-danger: #bd4b45;
  --lab-danger-soft: #fae8e7;
  --lab-radius-sm: 8px;
  --lab-radius: 12px;
  --lab-radius-lg: 16px;
  --lab-shadow: 0 8px 24px rgba(31, 41, 51, 0.06);
  --lab-shadow-soft: 0 2px 10px rgba(31, 41, 51, 0.05);
  --lab-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lab-shell-width: 1180px;
  --lab-wide-shell-width: 1280px;
}

html,
body {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100% !important;
  background: var(--lab-bg) !important;
  color: var(--lab-text) !important;
  font-family: var(--lab-font) !important;
  letter-spacing: 0 !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
button,
input,
select,
textarea,
.btn {
  font-family: var(--lab-font) !important;
}

.ontarget-local-bar {
  min-height: 78px;
  padding: 0 max(24px, calc((100vw - var(--lab-wide-shell-width)) / 2 + 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--lab-border);
  box-shadow: var(--lab-shadow-soft);
}

.ournest-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--lab-text);
  text-decoration: none !important;
  flex: 0 0 auto;
}

.ournest-brand:hover,
.ournest-brand:focus {
  color: var(--lab-text);
  text-decoration: none !important;
}

.ournest-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--lab-accent-soft);
  overflow: hidden;
  flex: 0 0 auto;
}

.ournest-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ournest-brand-name {
  color: var(--lab-text);
  font-size: 18px;
  font-weight: 820;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.ontarget-local-nav {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.ontarget-section-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--lab-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--lab-shadow-soft);
}

.ontarget-section-tab {
  min-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  color: var(--lab-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
}

.ontarget-section-tab:hover,
.ontarget-section-tab:focus {
  background: var(--lab-surface-soft);
  color: var(--lab-text);
}

.ontarget-section-tab.active {
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  box-shadow: inset 0 0 0 1px rgba(47, 143, 123, 0.16);
}

.ontarget-sub-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ontarget-settings-btn,
.papers-actions .update-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px !important;
  border-radius: 999px !important;
  font-size: 0.88rem;
}

.ontarget-settings-btn {
  border: 1px solid var(--lab-border) !important;
  background: var(--lab-surface) !important;
  color: var(--lab-muted) !important;
}

.ontarget-settings-btn.icon-only {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  flex: 0 0 42px;
}

.ontarget-settings-btn:hover {
  border-color: var(--lab-border-strong) !important;
  color: var(--lab-text) !important;
  background: var(--lab-surface-soft) !important;
}

.papers-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn,
button,
.paper-link,
.btn-analyze,
.btn-save {
  border-radius: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

.btn-primary,
.update-btn,
.save-button {
  background: var(--lab-accent) !important;
  border-color: var(--lab-accent) !important;
  color: #ffffff !important;
}

.btn-primary:hover,
.update-btn:hover {
  background: var(--lab-accent-strong) !important;
  border-color: var(--lab-accent-strong) !important;
}

.btn-secondary,
.btn-icon,
.action-bar,
.filter-group {
  background: var(--lab-surface) !important;
  border-color: var(--lab-border-strong) !important;
  color: var(--lab-text) !important;
}

.stats-bar,
.main-container,
.page-shell {
  max-width: var(--lab-wide-shell-width) !important;
}

.stats-bar {
  background: transparent !important;
  border-bottom: 0 !important;
  margin: 0 auto !important;
  padding: 22px 24px 0 !important;
}

.stats-content {
  max-width: none !important;
  gap: 12px !important;
}

.stat-item,
.panel,
.paper-card,
.group-card,
.modal-content,
.knowledge-card,
.graph-panel {
  background: var(--lab-surface) !important;
  border: 1px solid var(--lab-border) !important;
  border-radius: var(--lab-radius-lg) !important;
  box-shadow: var(--lab-shadow) !important;
}

.stat-value {
  color: var(--lab-accent-strong) !important;
}

.stat-label,
.paper-meta,
.paper-abstract,
.group-description,
.muted,
.page-subtitle {
  color: var(--lab-muted) !important;
}

.main-container,
.page-shell {
  margin: 0 auto !important;
  padding: 24px !important;
}

.page-header {
  margin: 0 0 24px !important;
  padding: 0 0 20px !important;
  border-bottom: 1px solid var(--lab-border) !important;
}

.page-kicker {
  margin: 0 0 6px !important;
  color: var(--lab-accent-strong) !important;
  font-size: 0.72rem !important;
  font-weight: 850 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

.page-title,
.page-header h1 {
  margin: 0 !important;
  color: var(--lab-text) !important;
  font-size: 30px !important;
  font-weight: 780 !important;
  line-height: 1.12 !important;
  letter-spacing: 0 !important;
}

input,
select,
textarea,
.form-input,
.form-select {
  border-color: var(--lab-border-strong) !important;
  border-radius: 10px !important;
  color: var(--lab-text) !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-select:focus {
  border-color: var(--lab-accent) !important;
  box-shadow: 0 0 0 3px rgba(47, 143, 123, 0.14) !important;
  outline: none !important;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.knowledge-card,
.graph-panel {
  padding: 18px;
}

.knowledge-card h2,
.graph-panel h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  letter-spacing: 0;
}

.provider-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.provider-row {
  padding: 12px;
  border: 1px solid var(--lab-border);
  border-radius: 10px;
  background: var(--lab-surface-tint);
}

.provider-row header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.status-pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.status-pill.ok {
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.status-pill.warning {
  background: var(--lab-warning-soft);
  color: #865510;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 41, 51, 0.42);
}

.modal.show,
.modal.active {
  display: flex;
}

.modal-content {
  width: min(100%, 540px);
  max-height: 88vh;
  overflow: auto;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--lab-border);
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--lab-border);
  border-bottom: 0;
}

.modal-body {
  padding: 18px;
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--lab-surface-soft);
  color: var(--lab-muted);
  cursor: pointer;
  font-size: 1.25rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  color: var(--lab-text);
  font-size: 0.9rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  top: auto;
  left: auto;
  right: 24px;
  bottom: 24px;
  z-index: 1100;
  display: none;
  align-items: flex-start;
  gap: 10px;
  width: auto;
  height: auto;
  min-height: 0;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border-radius: 12px;
  border-left: 4px solid var(--lab-accent);
  background: var(--lab-surface);
  color: var(--lab-text);
  box-shadow: var(--lab-shadow);
}

.toast.show {
  display: flex;
}

.toast.error {
  border-left-color: var(--lab-danger);
}

.toast.success {
  border-left-color: var(--lab-accent);
}

.toast.info {
  border-left-color: var(--lab-info);
}

.toast.warning {
  border-left-color: var(--lab-warning);
}

.toast-icon {
  flex: 0 0 auto;
  color: var(--lab-accent-strong);
  font-size: 1rem;
  line-height: 1.45;
}

.toast.error .toast-icon {
  color: var(--lab-danger);
}

.toast.info .toast-icon {
  color: var(--lab-info);
}

.toast.warning .toast-icon {
  color: var(--lab-warning);
}

.toast-message {
  min-width: 0;
  color: var(--lab-text);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.graph-empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px dashed var(--lab-border-strong);
  border-radius: var(--lab-radius);
  background: var(--lab-surface-tint);
  color: var(--lab-muted);
  text-align: center;
  padding: 24px;
}

.theme-graph-workbench {
  display: grid;
  gap: 13px;
  margin-bottom: 14px;
  padding: 15px 16px;
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdfc 0%, #f7faf8 100%);
  box-shadow: 0 12px 30px rgba(38, 53, 47, 0.08);
}

.theme-graph-topline,
.theme-graph-rulebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.theme-graph-topline {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lab-border);
}

.theme-graph-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(440px, 100%);
}

.theme-graph-picker label {
  flex: 0 0 auto;
  color: var(--lab-muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.theme-graph-picker select {
  min-width: 300px;
  height: 40px;
  border-radius: 8px;
  font-weight: 760;
}

.theme-graph-statusbar,
.theme-graph-actions,
.theme-graph-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-graph-statusbar,
.theme-graph-meta {
  justify-content: flex-end;
  min-width: 0;
}

.theme-graph-rulebar {
  align-items: flex-end;
}

.theme-graph-rule-panel {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.theme-filter-block {
  display: grid;
  gap: 8px;
}

.theme-filter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--lab-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.theme-if-range-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-if-filter {
  width: min(250px, 100%);
}

.theme-range-edge {
  flex: 0 0 auto;
  color: var(--lab-muted);
  font-size: 0.76rem;
  font-weight: 760;
  line-height: 1;
}

.theme-range-stack {
  flex: 1 1 auto;
  position: relative;
  min-width: 150px;
  height: 22px;
}

.theme-range-track {
  position: absolute;
  top: 9px;
  right: 0;
  left: 0;
  height: 5px;
  border-radius: 999px;
  background: #e3efeb;
}

.theme-range-stack input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
  appearance: none;
}

.theme-range-stack input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  background: transparent;
}

.theme-range-stack input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--lab-accent);
  box-shadow: 0 2px 8px rgba(47, 143, 123, 0.28);
  cursor: pointer;
  pointer-events: auto;
  appearance: none;
}

.theme-range-stack input[type="range"]::-moz-range-track {
  height: 5px;
  background: transparent;
}

.theme-range-stack input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--lab-accent);
  box-shadow: 0 2px 8px rgba(47, 143, 123, 0.28);
  cursor: pointer;
  pointer-events: auto;
}

.theme-graph-meta span,
.theme-version,
.theme-rule-summary {
  padding: 6px 9px;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  font-size: 0.78rem;
  font-weight: 760;
  white-space: nowrap;
}

.theme-version {
  border-color: rgba(47, 143, 123, 0.24);
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.theme-sync-status.ready {
  border-color: rgba(47, 143, 123, 0.28);
  background: var(--lab-accent);
  color: #fff;
}

.theme-sync-status.pending,
.theme-sync-status.changed,
.theme-sync-status.repair {
  border-color: #d6b36a;
  background: #fff8e8;
  color: #8a6519;
}

.theme-sync-status.empty {
  border-color: var(--lab-border);
  background: var(--lab-surface-tint);
  color: var(--lab-muted);
}

.theme-graph-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.theme-rule-summary {
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: #fafcfb;
  color: var(--lab-muted);
  font-size: 0.75rem;
}

.theme-graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-graph-display-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  font: inherit;
  font-weight: 760;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.theme-graph-display-toggle:hover {
  border-color: rgba(45, 143, 122, 0.35);
  color: var(--lab-accent-strong);
  box-shadow: 0 8px 20px rgba(45, 143, 122, 0.08);
}

.theme-graph-display-toggle.active {
  border-color: rgba(45, 143, 122, 0.35);
  background: var(--lab-accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(45, 143, 122, 0.18);
}

.legend-node {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: #7da69c;
}

.legend-node.mediator { background: #4c9fa3; }
.legend-node.pathway { background: #788db8; }
.legend-node.process { background: #8d79ad; }
.legend-node.phenotype { background: #b17a91; }

.legend-line {
  display: inline-block;
  width: 24px;
  border-top: 2px solid #318775;
}

.legend-line.indirect {
  border-top-style: dashed;
}

.legend-line.inferred {
  border-top-style: dotted;
  border-top-color: #87958f;
}

.legend-relation {
  position: relative;
  display: inline-block;
  width: 25px;
  height: 12px;
}

.legend-relation::before {
  position: absolute;
  top: 5px;
  right: 2px;
  left: 0;
  border-top: 2px solid #2d8a78;
  content: "";
}

.legend-relation.positive::after {
  position: absolute;
  top: 2px;
  right: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid #2d8a78;
  content: "";
}

.legend-relation.inhibition::before {
  border-top-color: #c45b57;
}

.legend-relation.inhibition::after {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 2px;
  height: 10px;
  border-radius: 2px;
  background: #c45b57;
  content: "";
}

.legend-relation.association::before {
  border-top-color: #7d8c87;
}

.legend-relation.association::after {
  position: absolute;
  top: 2px;
  right: 0;
  width: 7px;
  height: 7px;
  border: 2px solid #7d8c87;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.legend-relation.conflict::before {
  border-top-color: #bf3945;
  border-top-style: double;
  border-top-width: 4px;
}

.legend-relation.conflict::after {
  position: absolute;
  top: 0;
  right: 0;
  color: #bf3945;
  content: "»";
  font-size: 13px;
  font-weight: 900;
  line-height: 12px;
}

.theme-graph-layout {
  position: relative;
  height: clamp(560px, calc(100vh - 270px), 780px);
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: var(--lab-surface-tint);
}

.theme-graph-canvas {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background-color: var(--lab-surface);
  background-image:
    linear-gradient(rgba(80, 111, 101, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 111, 101, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}

.theme-graph-canvas.is-panning {
  cursor: grabbing;
}

.theme-graph-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: top left;
}

.theme-canvas-reset {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 9;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--lab-muted);
  box-shadow: 0 10px 24px rgba(38, 53, 47, 0.12);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.theme-canvas-reset:hover {
  border-color: rgba(47, 143, 123, 0.34);
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.theme-graph-layout.detail-visible .theme-canvas-reset {
  display: none;
}

.theme-edge > path:first-child {
  fill: none;
  stroke: #2d8a78;
  stroke-width: var(--edge-weight, 2);
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.72;
  transition: opacity 0.16s ease, stroke-width 0.16s ease, filter 0.16s ease;
}

.theme-edge:hover > path:first-child,
.theme-edge.is-selected > path:first-child,
.theme-edge.is-selection-related > path:first-child,
.theme-edge.is-hovered > path:first-child,
.theme-edge.is-hover-related > path:first-child {
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(37, 78, 67, 0.25));
}

.theme-edge.semantic-inhibition > path:first-child {
  stroke: #c45b57;
}

.theme-edge.semantic-association > path:first-child,
.theme-edge.semantic-no-effect > path:first-child {
  stroke: #7d8c87;
}

.theme-edge.semantic-conflict > path:first-child {
  stroke: #bf3945;
  stroke-width: calc(var(--edge-weight, 2) + 0.7);
}

.theme-edge.evidence-indirect > path:first-child {
  stroke-dasharray: 8 5;
}

.theme-edge.evidence-inferred > path:first-child {
  stroke-dasharray: 2 6;
  stroke-linecap: round;
}

.theme-edge.semantic-conflict > path:first-child {
  stroke-dasharray: 12 4 2 4;
}

.theme-edge-label {
  cursor: pointer;
}

.theme-edge-label rect {
  fill: rgba(255, 255, 255, 0.94);
  stroke: #9ec0b8;
  stroke-width: 1;
}

.theme-edge-label text {
  fill: #347a6c;
  font-size: 9px;
  font-weight: 800;
  text-anchor: middle;
}

.theme-edge.semantic-inhibition .theme-edge-label rect {
  stroke: #d59a96;
}

.theme-edge.semantic-inhibition .theme-edge-label text {
  fill: #a84945;
}

.theme-edge.semantic-association .theme-edge-label rect,
.theme-edge.semantic-no-effect .theme-edge-label rect {
  stroke: #b8c1bd;
}

.theme-edge.semantic-association .theme-edge-label text,
.theme-edge.semantic-no-effect .theme-edge-label text {
  fill: #66746e;
}

.theme-edge.semantic-conflict .theme-edge-label rect {
  stroke: #d7868d;
}

.theme-edge.semantic-conflict .theme-edge-label text {
  fill: #ad2f3b;
}

.theme-edge .theme-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 22;
  cursor: pointer;
  marker-end: none;
}

.theme-edge .theme-edge-flow {
  fill: none;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 4 11;
  opacity: 0;
  pointer-events: none;
}

.theme-edge:hover .theme-edge-flow,
.theme-edge.is-hovered .theme-edge-flow {
  opacity: 0.9;
  animation: theme-edge-flow 0.85s linear infinite;
}

@keyframes theme-edge-flow {
  to {
    stroke-dashoffset: -15;
  }
}

.theme-graph-canvas svg.has-hover-focus .theme-edge:not(.is-hovered, .is-hover-related),
.theme-graph-canvas svg.has-selection .theme-edge:not(.is-selected, .is-selection-related) {
  opacity: 0.12;
}

.theme-graph-canvas svg.has-hover-focus .theme-node:not(.is-hovered, .is-hover-related),
.theme-graph-canvas svg.has-selection .theme-node:not(.is-selected, .is-selection-related) {
  opacity: 0.2;
}

.theme-edge,
.theme-node {
  transition: opacity 0.16s ease;
}

.theme-edge.is-selected > path:first-child {
  stroke-width: calc(var(--edge-weight, 2) + 1.7);
}

.theme-edge.is-selected .theme-edge-label rect {
  stroke-width: 1.8;
}

.theme-node {
  cursor: grab;
  touch-action: none;
}

.theme-node.is-dragging {
  cursor: grabbing;
}

.theme-node.is-dragging > rect:first-child {
  stroke-width: 2.5;
  filter: drop-shadow(0 6px 8px rgba(38, 53, 47, 0.18));
}

.theme-node rect {
  fill: #eef5f2;
  stroke: #75a89d;
  stroke-width: 1.2;
  transition: stroke-width 0.16s ease, filter 0.16s ease;
}

.theme-node:hover > rect:first-child {
  stroke-width: 2.5;
}

.theme-node.is-selected > rect:first-child,
.theme-node.is-hovered > rect:first-child {
  stroke-width: 2.7;
  filter: drop-shadow(0 5px 8px rgba(38, 53, 47, 0.18));
}

.theme-node.is-selection-related > rect:first-child,
.theme-node.is-hover-related > rect:first-child {
  stroke-width: 1.8;
}

.theme-node .theme-node-label {
  fill: var(--lab-text);
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.theme-node .theme-node-type {
  fill: #74817b;
  font-size: 7px;
  font-weight: 850;
}

.theme-node .theme-node-badge {
  fill: #87938d;
  font-size: 7px;
  font-weight: 750;
}

.theme-node .theme-node-accent {
  fill: #5c9c8f;
  stroke: none;
  filter: none;
}

.theme-node.type-metabolite > rect:first-child,
.theme-node.type-drug > rect:first-child {
  fill: #e9f6f6;
  stroke: #5ea6a9;
}

.theme-node.type-metabolite .theme-node-accent,
.theme-node.type-drug .theme-node-accent {
  fill: #4c9fa3;
}

.theme-node.type-pathway > rect:first-child {
  fill: #eef1f8;
  stroke: #8295bd;
}

.theme-node.type-pathway .theme-node-accent {
  fill: #788db8;
}

.theme-node.type-disease > rect:first-child,
.theme-node.type-model > rect:first-child,
.theme-node.type-organism > rect:first-child,
.theme-node.type-tissue > rect:first-child {
  fill: #fff4e8;
  stroke: #c9955d;
}

.theme-node.type-disease .theme-node-accent,
.theme-node.type-model .theme-node-accent,
.theme-node.type-organism .theme-node-accent,
.theme-node.type-tissue .theme-node-accent {
  fill: #c58a50;
}

.theme-node.type-cell_type > rect:first-child,
.theme-node.type-process > rect:first-child {
  fill: #f1eef8;
  stroke: #9181b1;
}

.theme-node.type-cell_type .theme-node-accent,
.theme-node.type-process .theme-node-accent {
  fill: #8d79ad;
}

.theme-node.type-phenotype > rect:first-child {
  fill: #f8edf1;
  stroke: #b78398;
}

.theme-node.type-phenotype .theme-node-accent {
  fill: #b17a91;
}

.theme-graph-detail {
  position: absolute;
  z-index: 8;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(380px, calc(100% - 28px));
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: rgba(251, 252, 251, 0.98);
  box-shadow: 0 16px 38px rgba(28, 47, 41, 0.17);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 24px));
  transition: opacity 0.18s ease, transform 0.22s ease;
  backdrop-filter: blur(8px);
}

.theme-graph-detail.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.theme-ask-ai-toggle {
  position: absolute;
  z-index: 9;
  bottom: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(47, 143, 123, 0.22);
  border-radius: 999px;
  background: rgba(251, 252, 251, 0.94);
  color: var(--lab-accent-strong);
  box-shadow: 0 10px 24px rgba(38, 53, 47, 0.12);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 820;
  backdrop-filter: blur(8px);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.theme-ask-ai-toggle i {
  font-size: 0.92rem;
}

.theme-ask-ai-toggle:hover,
.theme-ask-ai-toggle.is-active {
  border-color: rgba(47, 143, 123, 0.34);
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  box-shadow: 0 12px 28px rgba(38, 53, 47, 0.16);
}

.theme-ask-ai-panel {
  position: absolute;
  z-index: 10;
  top: 14px;
  bottom: 14px;
  left: 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(410px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: rgba(251, 252, 251, 0.98);
  box-shadow: 0 16px 38px rgba(28, 47, 41, 0.17);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-100% - 24px));
  transition: opacity 0.18s ease, transform 0.22s ease;
  backdrop-filter: blur(8px);
}

.theme-ask-ai-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.theme-ask-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 13px 14px 12px;
  border-bottom: 1px solid var(--lab-border);
  background: linear-gradient(180deg, rgba(244, 249, 247, 0.9), rgba(251, 252, 251, 0.72));
}

.theme-ask-ai-title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.theme-ask-ai-title > i {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  font-size: 0.95rem;
}

.theme-ask-ai-title > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.theme-ask-ai-title span {
  width: fit-content;
  max-width: 270px;
  overflow: hidden;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(47, 143, 123, 0.08);
  color: var(--lab-muted);
  font-size: 0.7rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-ask-ai-head strong {
  color: var(--lab-text);
  font-size: 0.98rem;
  font-weight: 850;
}

.theme-ask-ai-head button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.theme-ask-ai-head button:hover {
  border-color: rgba(47, 143, 123, 0.26);
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.theme-ask-ai-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
  background: rgba(247, 250, 248, 0.42);
}

.theme-ask-ai-empty {
  margin: auto;
  color: var(--lab-muted);
  font-size: 0.84rem;
  text-align: center;
}

.theme-ai-message {
  display: grid;
  gap: 4px;
}

.theme-ai-message.is-user {
  justify-items: end;
}

.theme-ai-role {
  color: var(--lab-muted);
  font-size: 0.7rem;
  font-weight: 780;
}

.theme-ai-bubble {
  max-width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: var(--lab-surface);
  color: var(--lab-text);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: normal;
}

.theme-ai-message.is-user .theme-ai-bubble {
  border-color: rgba(47, 143, 123, 0.26);
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.theme-ai-bubble p {
  margin: 0 0 0.65em;
}

.theme-ai-bubble p:last-child {
  margin-bottom: 0;
}

.theme-ai-bubble h3,
.theme-ai-bubble h4,
.theme-ai-bubble h5,
.theme-ai-bubble h6 {
  margin: 0.85em 0 0.45em;
  color: var(--lab-text);
  font-weight: 850;
  line-height: 1.35;
}

.theme-ai-bubble h3 {
  font-size: 0.95rem;
}

.theme-ai-bubble h4,
.theme-ai-bubble h5,
.theme-ai-bubble h6 {
  font-size: 0.88rem;
}

.theme-ai-bubble blockquote {
  margin: 0.55em 0;
  padding: 7px 9px;
  border-left: 3px solid #c3cec9;
  border-radius: 0 6px 6px 0;
  background: rgba(247, 250, 248, 0.82);
  color: var(--lab-muted);
}

.theme-ai-bubble ul,
.theme-ai-bubble ol {
  margin: 0 0 0.65em;
  padding-left: 1.05rem;
}

.theme-ai-bubble li {
  margin: 0.2em 0;
}

.theme-ai-bubble strong {
  color: var(--lab-text);
  font-weight: 850;
}

.theme-ai-bubble code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(55, 72, 65, 0.07);
  color: var(--lab-accent-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86em;
}

.theme-ai-code-block {
  overflow: hidden;
  margin: 0.65em 0;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: #f7faf8;
}

.theme-ai-code-label {
  padding: 6px 9px 0;
  color: var(--lab-muted);
  font-size: 0.7rem;
  font-weight: 820;
  text-transform: uppercase;
}

.theme-ai-code-block pre {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  padding: 9px;
  color: #33443d;
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.theme-ai-code-block code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.theme-ai-citation {
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
  padding: 1px 5px;
  border: 0;
  border-radius: 5px;
  background: #e8f3ef;
  color: var(--lab-accent-strong);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72em;
  font-weight: 850;
  vertical-align: baseline;
}

.theme-ai-citation:hover {
  background: var(--lab-accent);
  color: #fff;
}

.theme-ai-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 3px;
  border-radius: 2px;
  background: var(--lab-accent);
  vertical-align: text-bottom;
  animation: ai-cursor-blink 0.8s steps(2, start) infinite;
}

@keyframes ai-cursor-blink {
  50% {
    opacity: 0;
  }
}

.theme-ask-ai-form {
  display: grid;
  gap: 9px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--lab-border);
  background: rgba(251, 252, 251, 0.94);
}

.theme-ask-ai-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.theme-ask-ai-options .form-input {
  flex: 1 1 155px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.theme-ask-ai-strict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--lab-border);
  border-radius: 999px;
  background: var(--lab-surface);
  white-space: nowrap;
  color: var(--lab-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.theme-ask-ai-strict input {
  width: auto;
  accent-color: var(--lab-accent);
}

.theme-ask-ai-form textarea {
  min-height: 78px;
  padding: 10px 11px;
  border-radius: 8px;
  resize: vertical;
  font-size: 0.84rem;
  line-height: 1.45;
}

.theme-ask-ai-send {
  justify-content: center;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--lab-accent);
  border-radius: 8px;
  box-shadow: none;
  font-weight: 850;
}

.theme-detail-empty {
  display: grid;
  min-height: 100%;
  place-content: center;
  gap: 10px;
  color: var(--lab-muted);
  text-align: center;
}

.theme-detail-empty i {
  font-size: 1.3rem;
}

.theme-detail-head {
  display: grid;
  gap: 7px;
}

.theme-detail-head > span {
  color: var(--lab-accent-strong);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.theme-detail-head strong {
  color: var(--lab-text);
  font-size: 1rem;
  line-height: 1.45;
}

.theme-graph-detail > p,
.theme-detail-meta {
  color: var(--lab-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.theme-detail-meta {
  margin: 9px 0 14px;
}

.theme-relation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 13px 0;
  padding: 8px 10px;
  border-left: 4px solid #318775;
  border-radius: 6px;
  background: #eaf5f1;
  color: #246f61;
  font-weight: 800;
}

.theme-relation-banner small {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.8;
}

.theme-relation-banner.inhibition,
.theme-relation-banner.conflict {
  border-left-color: #b85b57;
  background: #faeeee;
  color: #9c4541;
}

.theme-relation-banner.association,
.theme-relation-banner.no-effect {
  border-left-color: #87958f;
  background: #f0f3f1;
  color: #65716c;
}

.theme-relation-banner.conflict {
  border-left-color: #bf3945;
  background: #fff0f2;
  color: #a52b37;
}

.theme-evidence-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.theme-evidence-summary span {
  padding: 8px;
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  font-size: 0.75rem;
}

.theme-evidence-summary b {
  color: var(--lab-text);
}

.theme-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 15px;
}

.theme-context-chips span {
  display: inline-flex;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 5px;
  background: #eef3f1;
  color: #66736d;
  font-size: 0.72rem;
}

.theme-context-chips b {
  color: #34453e;
}

.theme-detail-section-title {
  margin: 15px 0 8px;
  color: var(--lab-text);
  font-size: 0.78rem;
  font-weight: 850;
}

.theme-paper-links {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.theme-paper-links span {
  padding-left: 9px;
  border-left: 3px solid #7897ac;
  color: var(--lab-text);
  font-size: 0.8rem;
  line-height: 1.4;
}

.theme-claim-list {
  display: grid;
  gap: 12px;
}

.theme-claim {
  padding-top: 12px;
  border-top: 1px solid var(--lab-border);
}

.theme-claim-id {
  color: var(--lab-accent-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.7rem;
}

.theme-claim p {
  margin: 6px 0 8px;
  color: var(--lab-text);
  font-size: 0.84rem;
  line-height: 1.55;
}

.theme-evidence-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.theme-evidence-ids span {
  padding: 2px 5px;
  border-radius: 4px;
  background: #e8f3ef;
  color: var(--lab-accent-strong);
  font-size: 0.68rem;
  font-weight: 750;
}

.theme-claim blockquote {
  margin: 8px 0 0;
  padding: 7px 9px;
  border-left: 3px solid #c3cec9;
  background: var(--lab-surface);
  color: var(--lab-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.pdf-manager-layout {
  display: grid;
  grid-template-columns: minmax(540px, 1.42fr) minmax(340px, 0.78fr);
  gap: 16px;
  align-items: start;
}

.pdf-panel {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius-lg);
  box-shadow: var(--lab-shadow);
  padding: 20px;
}

.pdf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pdf-panel-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pdf-panel-title {
  margin: 0;
  color: var(--lab-text);
  font-size: 1.05rem;
  font-weight: 780;
  line-height: 1.25;
}

.pdf-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pdf-filter-tab {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--lab-border);
  border-radius: 999px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 760;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.pdf-filter-tab.active {
  background: var(--lab-accent-soft);
  border-color: rgba(47, 143, 123, 0.24);
  color: var(--lab-accent-strong);
}

.pdf-parse-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.pdf-parse-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius);
  background: var(--lab-surface-tint);
}

.pdf-parse-filter-label {
  color: var(--lab-muted);
  font-size: 0.8rem;
  font-weight: 760;
  white-space: nowrap;
}

.pdf-parse-segment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--lab-border);
  border-radius: 999px;
  background: var(--lab-surface);
}

.pdf-parse-segment button {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px !important;
  background: transparent;
  color: var(--lab-muted);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 760 !important;
}

.pdf-parse-segment button.active {
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.pdf-paper-list,
.unclassified-list {
  display: grid;
  gap: 12px;
}

.pdf-paper-row,
.unclassified-row {
  padding: 16px;
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius-lg);
  background: var(--lab-surface);
  box-shadow: var(--lab-shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.pdf-paper-row:hover,
.unclassified-row:hover {
  border-color: var(--lab-border-strong);
  box-shadow: var(--lab-shadow);
}

.pdf-paper-row,
.unclassified-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pdf-paper-main,
.unclassified-main {
  min-width: 0;
  flex: 1 1 auto;
}

.pdf-paper-title,
.unclassified-title {
  margin: 0;
  color: var(--lab-text);
  font-size: 1rem;
  font-weight: 760;
  line-height: 1.45;
}

.pdf-paper-title-cn {
  margin-top: 4px;
  color: var(--lab-accent-strong);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.48;
}

.pdf-parse-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.parse-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--lab-border);
  border-radius: 999px;
  background: var(--lab-surface);
  color: var(--lab-muted);
  font-size: 0.74rem;
  font-weight: 760;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.parse-pill:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(29, 68, 62, 0.1);
}

.parse-pill:disabled,
.parse-pill.disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.parse-pill.completed {
  background: var(--lab-accent-soft);
  border-color: rgba(47, 143, 123, 0.22);
  color: var(--lab-accent-strong);
}

.parse-pill.active {
  background: #eef6fb;
  border-color: #cfe6f2;
  color: #3f708d;
}

.parse-pill.failed {
  background: #fff0f0;
  border-color: #f4caca;
  color: #b85c5c;
}

.unclassified-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: var(--lab-muted);
  font-size: 0.82rem;
}

.pdf-row-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.pdf-icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px !important;
}

.pdf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.pdf-page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--lab-border);
  border-radius: 999px !important;
  background: var(--lab-surface);
  color: var(--lab-muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 780 !important;
}

.pdf-page-btn.active {
  background: var(--lab-accent-soft);
  border-color: rgba(47, 143, 123, 0.24);
  color: var(--lab-accent-strong);
}

.pdf-page-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.pdf-page-ellipsis {
  color: var(--lab-muted);
  font-size: 0.84rem;
  padding: 0 2px;
}

.pdf-icon-btn i {
  margin: 0;
}

.full-text-analysis-modal {
  max-width: 920px !important;
  max-height: 86vh;
}

.full-text-analysis-footer {
  justify-content: space-between;
}

.btn-danger {
  border-color: var(--lab-danger);
  background: var(--lab-danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  border-color: #a73f3a;
  background: #a73f3a;
}

.analysis-paper-head h3 {
  margin: 0;
  color: var(--lab-text);
  font-size: 1.1rem;
  line-height: 1.45;
}

.analysis-paper-head p {
  margin: 6px 0 0;
  color: var(--lab-accent-strong);
  font-size: 0.92rem;
  font-weight: 650;
}

.analysis-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.analysis-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  font-size: 0.76rem;
  font-weight: 760;
}

.analysis-result-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.analysis-result-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius-lg);
  background: var(--lab-surface);
  box-shadow: var(--lab-shadow-soft);
}

.analysis-result-index {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  font-weight: 800;
  font-size: 0.82rem;
}

.analysis-result-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.analysis-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 0.88rem;
}

.analysis-field span {
  color: var(--lab-muted);
  font-weight: 760;
}

.analysis-field strong {
  color: var(--lab-text);
  font-weight: 650;
  line-height: 1.55;
}

.analysis-context-grid,
.analysis-structured-conclusion {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius-md);
  background: #f8fbfa;
}

.analysis-structured-conclusion {
  border-left: 3px solid var(--lab-accent);
}

.analysis-entities {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.analysis-entities-label {
  color: var(--lab-muted);
  font-size: 0.88rem;
  font-weight: 760;
}

.analysis-entity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.analysis-entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid rgba(47, 143, 123, 0.24);
  border-radius: 999px;
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  font-size: 0.78rem;
  font-weight: 720;
}

.analysis-entity-chip small {
  color: var(--lab-muted);
  font-size: 0.68rem;
  font-weight: 650;
}

.analysis-evidence-refs {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.analysis-evidence-item {
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius-md);
  background: #fbfdfc;
  overflow: hidden;
}

.analysis-evidence-item summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--lab-accent-strong);
  font-size: 0.82rem;
  font-weight: 780;
}

.analysis-evidence-item div {
  padding: 0 10px 10px;
  color: var(--lab-muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.analysis-mechanism-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(47, 143, 123, 0.24);
  border-radius: var(--lab-radius-lg);
  background: #f7fbfa;
}

.analysis-mechanism-panel.failed {
  border-color: #f4caca;
  background: #fff8f8;
}

.analysis-mechanism-panel h4,
.analysis-mechanism-panel h5 {
  margin: 0;
  color: var(--lab-text);
}

.analysis-mechanism-panel h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.analysis-mechanism-panel h4 i {
  color: var(--lab-accent-strong);
}

.analysis-mechanism-panel h5 {
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.analysis-mechanism-summary {
  margin: 12px 0 0;
  color: var(--lab-text);
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.7;
}

.analysis-mechanism-summary.en {
  color: var(--lab-muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.analysis-mechanism-fields {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.analysis-mechanism-chain,
.analysis-mechanism-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.mechanism-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius-md);
  background: var(--lab-surface);
}

.mechanism-step-index {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
}

.mechanism-step strong {
  color: var(--lab-text);
  font-size: 0.87rem;
  line-height: 1.5;
}

.mechanism-step p {
  margin: 4px 0 0;
  color: var(--lab-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.mechanism-note {
  padding: 10px;
  border-left: 3px solid var(--lab-accent);
  border-radius: 0 var(--lab-radius-md) var(--lab-radius-md) 0;
  background: var(--lab-surface);
  color: var(--lab-text);
  font-size: 0.85rem;
  line-height: 1.55;
}

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

.pdf-match-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--lab-border);
}

.pdf-match-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pdf-match-title {
  margin: 0;
  color: var(--lab-text);
  font-size: 1rem;
  font-weight: 850;
}

.pdf-match-subtitle {
  margin: 4px 0 0;
  color: var(--lab-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.pdf-match-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.pdf-match-list {
  display: grid;
  gap: 10px;
}

.match-block {
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  background: var(--lab-surface-tint);
  overflow: hidden;
}

.match-source {
  padding: 12px;
  border-bottom: 1px solid var(--lab-border);
}

.match-source-file {
  color: var(--lab-text);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.35;
}

.match-source-label {
  margin-top: 7px;
  color: var(--lab-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.match-source-title {
  margin-top: 4px;
  color: var(--lab-accent-strong);
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.45;
}

.match-candidates {
  display: grid;
  gap: 1px;
  background: var(--lab-border);
}

.match-candidate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--lab-surface);
}

.match-candidate-main {
  min-width: 0;
}

.match-candidate-title {
  color: var(--lab-text);
  font-size: 0.9rem;
  font-weight: 820;
  line-height: 1.35;
}

.match-candidate-title-cn {
  margin-top: 4px;
  color: var(--lab-accent-strong);
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1.4;
}

.match-candidate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  color: var(--lab-muted);
  font-size: 0.78rem;
}

.match-candidate-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.match-score {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(47, 143, 123, 0.22);
  border-radius: 999px;
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
  font-size: 0.84rem;
  font-weight: 900;
}

.match-confirm-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
}

.match-confirm-btn.match-confirmed,
.match-confirm-btn.match-confirmed:disabled {
  border-color: var(--lab-border);
  background: #eef2f0;
  color: var(--lab-muted);
  cursor: default;
  box-shadow: none;
}

.match-block.matched .match-source {
  background: rgba(47, 143, 123, 0.04);
}

.pdf-upload-zone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 20px;
  border: 2px dashed var(--lab-border-strong);
  border-radius: var(--lab-radius);
  background: var(--lab-surface-tint);
  color: var(--lab-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.pdf-upload-zone.dragover {
  border-color: var(--lab-accent);
  background: var(--lab-accent-soft);
  color: var(--lab-accent-strong);
}

.pdf-upload-zone i {
  margin-bottom: 10px;
  color: var(--lab-accent);
  font-size: 2rem;
}

.empty-state {
  padding: 34px 16px;
  border: 1px dashed var(--lab-border-strong);
  border-radius: var(--lab-radius);
  color: var(--lab-muted);
  text-align: center;
}

@media (max-width: 980px) {
  .ontarget-local-bar {
    align-items: stretch;
    flex-direction: column;
    padding: 14px 16px;
  }

  .ontarget-local-nav {
    align-items: stretch;
    flex-direction: column;
    margin-left: 0;
    width: 100%;
  }

  .ontarget-section-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .ontarget-section-tab {
    flex: 0 0 auto;
  }

  .ontarget-sub-actions,
  .ontarget-settings-btn {
    width: 100%;
  }

  .ontarget-settings-btn.icon-only {
    width: 42px !important;
    align-self: flex-end;
  }

  .knowledge-grid,
  .pdf-manager-layout,
  .main-container {
    grid-template-columns: 1fr !important;
  }

  .theme-graph-topline,
  .theme-graph-rulebar,
  .theme-graph-picker,
  .theme-graph-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-graph-rule-panel,
  .theme-if-filter {
    width: 100%;
  }

  .theme-graph-rule-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-graph-picker select {
    min-width: 0;
    width: 100%;
  }

  .theme-graph-statusbar,
  .theme-graph-meta {
    justify-content: flex-start;
  }

  .theme-rule-summary,
  .theme-graph-actions .btn {
    width: 100%;
    max-width: none;
  }

  .theme-graph-layout {
    height: auto;
  }

  .theme-graph-canvas {
    min-height: 560px;
    height: 560px;
  }

  .theme-graph-detail {
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: min(360px, calc(100% - 20px));
  }

  .pdf-parse-filter-grid {
    grid-template-columns: 1fr;
  }

  .pdf-parse-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .pdf-parse-segment {
    justify-content: space-between;
    width: 100%;
  }

  .pdf-parse-segment button {
    flex: 1 1 auto;
  }

  .match-candidate-row {
    align-items: stretch;
    flex-direction: column;
  }

  .match-candidate-side {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
  }
}
