:root {
  --bg: #f6f5ef;
  --panel: rgba(246, 245, 239, .96);
  --ink: #111;
  --muted: #555;
  --line: #111;
  --accent: #111;
  --chip: #ecebe4;
  --graph-bg: #f6f5ef;
  --font: "SF Mono", "IBM Plex Mono", "Roboto Mono", ui-monospace, monospace;
  --shadow: none;
}
* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.45 var(--font);
}
#graph {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: var(--graph-bg);
  cursor: grab;
  touch-action: none;
}
#graph.dragging { cursor: grabbing; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.graph-label-layer {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
  touch-action: none;
}
.html-graph-label {
  position: absolute;
  max-width: 260px;
  text-align: center;
  transform: translate(-50%, 0);
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  text-shadow: 0 1px 0 #fff, 0 -1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff, 0 2px 8px rgba(255,255,255,.9);
  transition: color .16s ease, text-shadow .16s ease;
}
.html-graph-label {
  text-shadow: 0 1px 0 var(--graph-bg), 0 -1px 0 var(--graph-bg), 1px 0 0 var(--graph-bg), -1px 0 0 var(--graph-bg);
  text-transform: uppercase;
  letter-spacing: 0;
}
.html-graph-label.hover {
  color: #0f172a;
  z-index: 2;
  text-shadow: 0 1px 0 #fff, 0 -1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff, 0 5px 16px rgba(15,23,42,.22);
}
.html-graph-label.timeline-connected-label {
  max-width: 160px;
  text-align: center;
  transform: translate(-50%, 0);
}
.html-graph-label.timeline-date-label {
  max-width: 170px;
  text-align: center;
}
.html-graph-label.timeline-date-label .label-primary {
  font-size: .88rem;
  line-height: 1.08;
}
.html-graph-label.timeline-date-label .label-secondary {
  margin-top: 3px;
  font-size: .72rem;
  line-height: 1.08;
}
.html-graph-label.timeline-connected-label .label-primary {
  font-size: .88rem;
  line-height: 1.08;
}
.html-graph-label.timeline-connected-label .label-secondary {
  margin-top: 3px;
  font-size: .72rem;
  line-height: 1.08;
}
.html-graph-label.timeline-year-label {
  width: auto;
  min-width: 38px;
  max-width: none;
  padding: 2px 5px;
  background: var(--ink);
  color: var(--bg);
  text-align: center;
  text-shadow: none;
  pointer-events: none;
}
.html-graph-label.timeline-year-label .label-primary {
  color: var(--bg);
  font-size: .72rem;
  line-height: 1;
}
.html-graph-label:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  background: rgba(246, 245, 239, .92);
}
.label-primary {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.label-secondary {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: start;
  pointer-events: none;
}
.brand, .controls, .node-card, .legend, .corner-label, .hover-card {
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.brand {
  padding: 10px 12px;
  max-width: 640px;
}
.brand,
.controls,
.node-card,
.corner-label,
.hover-card {
  border-radius: 0;
  backdrop-filter: none;
}
h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0;
}
.owner-label {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  text-decoration: underline;
}
.owner-label:hover,
.owner-label:focus-visible {
  color: var(--muted);
  text-decoration: underline;
}
.app-switcher {
  position: relative;
  display: inline-block;
  padding-right: 18px;
  cursor: pointer;
}
.app-switcher select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}
.app-switcher::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink);
  transform: translateY(-35%);
  pointer-events: none;
}
.meta {
  color: var(--muted);
  font-size: 12px;
}
.controls {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: end;
  flex-wrap: nowrap;
  padding: 8px;
  position: relative;
}
.review-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
.review-status:empty {
  display: none;
}
.utility-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.utility-menu-toggle {
  width: 34px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.utility-menu-toggle span {
  width: 14px;
  height: 1px;
  background: var(--ink);
}
.utility-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  min-width: 240px;
  padding: 6px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.utility-menu-panel[hidden] {
  display: none;
}
.utility-menu-panel button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
input, select, button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
.node-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
input { width: 280px; }
button {
  cursor: pointer;
  font-weight: 400;
}
button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--chip);
}
.node-card {
  position: fixed;
  left: 12px;
  top: var(--sidebar-top, 112px);
  bottom: 32px;
  z-index: 6;
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  display: none;
}
.node-card.open { display: block; }
.node-card-body {
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
}
.card-close {
  position: absolute;
  top: 8px;
  right: -36px;
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
  background: var(--panel);
}
.hover-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 7;
  width: min(340px, calc(100vw - 24px));
  padding: 10px 12px;
  display: none;
  pointer-events: none;
  transform: translate(16px, 16px);
}
.hover-card.open { display: block; }
.hover-card h2 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: 0;
}
.hover-card p {
  margin: 6px 0 0;
  color: #334155;
  font-size: 13px;
}
.hover-card .meta {
  font-size: 12px;
}
.corner-label {
  position: fixed;
  top: 72px;
  right: 12px;
  z-index: 4;
  max-width: min(460px, calc(100vw - 24px));
  padding: 12px 14px;
  display: none;
  text-align: right;
  pointer-events: auto;
}
.corner-label.open { display: block; }
.corner-label strong {
  display: block;
  color: var(--accent);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
}
.corner-view-switcher {
  position: relative;
  display: inline-block;
  padding-right: 18px;
  cursor: pointer;
}
.corner-label strong .corner-view-switcher {
  display: inline-block;
  margin-top: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.1;
}
.corner-label strong .corner-view-switcher-text {
  display: inline;
  margin-top: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.1;
}
.corner-view-switcher select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}
.corner-view-switcher::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink);
  transform: translateY(-35%);
  pointer-events: none;
}
.corner-label span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.node-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
  letter-spacing: 0;
}
.node-card p { margin: 7px 0; }
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid #edf0f5;
}
.node-card .card-actions input,
.node-card .card-actions select {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 180px;
}
.node-card .card-actions button {
  flex: 0 0 auto;
}
.card-field {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
.card-field span {
  color: var(--muted);
  font-size: 12px;
}
.card-field select,
.card-field input {
  width: 100%;
}
.false-positive-actions {
  margin-top: 0;
  border-top: 0;
}
.node-card h3.false-positive-heading {
  margin-top: 14px;
}
.merge-results {
  display: grid;
  gap: 4px;
  width: 100%;
  max-height: 150px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
}
.merge-results button {
  width: 100%;
  height: auto;
  min-height: 32px;
  text-align: left;
  white-space: normal;
}
.merge-results button[aria-pressed="true"] {
  background: var(--chip);
  border-color: var(--ink);
}
.relationship-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.relationship-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}
.relationship-row .relationship-target {
  min-width: 0;
}
.relationship-row .remove-connection {
  width: 30px;
  min-width: 30px;
  padding: 0;
  color: var(--ink);
  text-align: center;
}
.relationship-list button {
  width: 100%;
  height: auto;
  min-height: 34px;
  text-align: left;
  white-space: normal;
}
.entity-directory {
  display: grid;
  gap: 5px;
  max-height: min(58vh, 620px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
.entity-directory button {
  width: 100%;
  height: auto;
  min-height: 34px;
  text-align: left;
  white-space: normal;
}
.evidence {
  border-top: 1px solid #edf0f5;
  padding-top: 8px;
  margin-top: 8px;
}
.node-card h3 {
  margin: 12px 0 6px;
  font-size: 13px;
  letter-spacing: 0;
}
.node-card h3.action-heading,
.node-card h3.merge-heading {
  margin-bottom: 2px;
  font-size: 15px;
}
.relationship-list button {
  width: 100%;
  height: auto;
  min-height: 30px;
  text-align: left;
  white-space: normal;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}
.graph-node, .graph-edge { cursor: pointer; }
.graph-node, .graph-node * {
  pointer-events: all;
}
.graph-node {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .16s ease, filter .16s ease;
}
.graph-node circle {
  transition: stroke-width .16s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.graph-node.hover {
  transform: scale(1.16);
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, .26));
}
.graph-node.hover {
  transform-box: fill-box;
  transform-origin: center;
}
.graph-node.connection-highlight circle {
  stroke: var(--ink) !important;
  stroke-width: 3.4;
}
.graph-node.connection-dim,
.html-graph-label.connection-dim {
  opacity: .14;
}
.graph-edge {
  transition: opacity .16s ease, stroke-width .16s ease;
}
.graph-edge.connection-highlight {
  opacity: .95;
  stroke: var(--ink) !important;
  stroke-width: 4px;
}
.graph-edge.connection-dim {
  opacity: .035;
}
.timeline-axis {
  stroke: var(--ink);
  stroke-width: 2.2;
  opacity: 1;
}
.timeline-tick {
  stroke: var(--ink);
  stroke-width: 1.6;
  opacity: .72;
}
.timeline-date-stem {
  stroke: var(--ink);
  stroke-width: 1.4;
  opacity: .48;
}
.timeline-link {
  stroke: var(--ink);
  stroke-width: 1;
  opacity: .34;
}
.timeline-date {
  fill: var(--ink);
  stroke: var(--graph-bg);
  stroke-width: 1;
}
.timeline-event {
  fill: var(--ink);
  stroke: var(--graph-bg);
  stroke-width: 1;
}
.timeline-context {
  fill: var(--graph-bg);
  stroke: var(--ink);
  stroke-width: 1;
  opacity: .78;
}
.html-graph-label.connection-highlight {
  z-index: 8;
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(246, 245, 239, .94);
  box-shadow: 0 2px 8px rgba(17, 17, 17, .12);
  opacity: 1;
}
.graph-label {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.category-label {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 5px;
  stroke-linejoin: round;
}
.graph-primary-label {
  font-size: 1rem;
}
.graph-secondary-label {
  font-size: .875rem;
}
.site-motto {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 6;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font: 12px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0;
}

.site-motto a {
  color: inherit;
  text-decoration: none;
}

.site-motto a:hover {
  text-decoration: underline;
}
@media (max-width: 820px) {
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .brand { padding: 8px 10px; }
  h1 { font-size: 13px; }
  .controls {
    justify-content: start;
    gap: 2px;
    flex-wrap: wrap;
    padding: 6px;
  }
  .utility-menu-panel {
    left: auto;
    right: 0;
    min-width: min(240px, calc(100vw - 16px));
  }
  input { width: 100%; }
  input, select, button {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }
  .legend { display: none; }
  .corner-label {
    top: auto;
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
  .corner-label strong { font-size: 22px; }
  .site-motto {
    left: 8px;
    bottom: 8px;
    font-size: 11px;
  }
  .node-card {
    top: var(--sidebar-top, 142px);
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }
  .card-close {
    top: 8px;
    right: 8px;
  }
}
