.kb-graph-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.kb-graph-legend {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.kb-graph-legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.kb-graph-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 140ms ease, transform 140ms ease;
}

.kb-graph-legend-item:hover {
  opacity: 0.74;
}

.kb-graph-legend-item.is-active {
  opacity: 1;
}

.kb-graph-legend-item:not(.is-active).is-dimmed {
  opacity: 0.36;
}

.kb-graph-legend-item:focus-visible {
  outline: 2px solid rgba(0, 88, 190, 0.24);
  outline-offset: 4px;
  border-radius: 6px;
}

.kb-graph-legend-item strong {
  display: block;
  margin: 0;
  color: #191c1f;
  font-size: 13px;
  font-weight: 600;
}

.kb-graph-legend-swatch {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.kb-graph-legend-swatch.is-concept {
  background: #0058be;
}

.kb-graph-legend-swatch.is-post {
  background: #0f766e;
}

.kb-graph-legend-swatch.is-source {
  background: #d97706;
}

.kb-graph-legend-swatch.is-entity {
  background: #be123c;
}

.kb-graph-legend-swatch.is-comparison {
  background: #475569;
}

.kb-graph-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.kb-graph-button {
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #d4dce8;
  border-radius: 6px;
  background: #ffffff;
  color: #2e3744;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 12px;
  cursor: pointer;
}

.kb-graph-button:hover {
  background: #f2f5fa;
}

.kb-graph {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background-color: #f9fbff;
  background-image: radial-gradient(#d9e0eb 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: hidden;
}

.kb-graph-tooltip {
  position: absolute;
  z-index: 4;
  width: min(360px, calc(100% - 40px));
  padding: 16px 16px 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(225, 230, 239, 0.96);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(14px);
}

.kb-graph-tooltip.is-hidden {
  display: none;
}

.kb-graph-tooltip-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kb-graph-tooltip-kind {
  color: #5a6372;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kb-graph-tooltip-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #eef2f7;
  color: #2e3744;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.kb-graph-tooltip-close:hover {
  background: #e4eaf2;
}

.kb-graph-tooltip-title {
  margin: 12px 0 8px;
  color: #191c1f;
  font-family: "Newsreader", "Source Han Serif SC", "Noto Serif SC", serif;
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.kb-graph-tooltip-summary {
  margin: 0;
  color: #3b4350;
  font-size: 0.94rem;
  line-height: 1.68;
}

.kb-graph-tooltip-summary:empty {
  display: none;
}

.kb-graph-tooltip-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  min-width: 132px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #0058be;
  color: #ffffff;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.kb-graph-tooltip-link:hover {
  background: #004694;
}

.kb-graph-tooltip-link.is-disabled {
  background: #cfd7e3;
  color: #5a6372;
  cursor: not-allowed;
}

.kb-graph-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.kb-graph-empty {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: #6e7684;
  font-size: 14px;
}

.kb-graph-edge {
  stroke: rgba(180, 193, 212, 0.8);
  stroke-width: 1.2;
}

.kb-graph canvas {
  display: block;
}

@media (max-width: 860px) {
  .kb-graph-legend {
    top: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
  }

  .kb-graph-actions {
    top: 12px;
    right: 12px;
  }

  .kb-graph-tooltip {
    width: min(340px, calc(100% - 24px));
  }

  .kb-graph {
    height: 100%;
    min-height: 520px;
  }

  .kb-graph-empty {
    min-height: 520px;
  }
}
