:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --ink: #191919;
  --muted: #66645f;
  --line: #d9d7d0;
  --soft: #eeece5;
  --panel: #ffffff;
  --accent: #145c54;
  --warn: #a05a00;
  --bad: #8f1d1d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

nav {
  display: flex;
  gap: 16px;
  white-space: nowrap;
}

nav a {
  text-decoration: none;
  font-weight: 600;
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 24px 36px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  margin-bottom: 24px;
}

.summary div {
  background: var(--panel);
  padding: 14px 16px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary strong {
  display: block;
  margin-top: 3px;
  font-size: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

input,
select,
button {
  height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.plain-button {
  cursor: pointer;
  font-weight: 700;
}

input[type="search"] {
  width: min(360px, 50vw);
}

.table-wrap {
  overflow: auto;
  max-height: 720px;
}

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

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 9px 10px;
  border-bottom: 1px solid var(--soft);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #faf9f5;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td.score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.status {
  display: inline-block;
  min-width: 58px;
  color: #fff;
  background: var(--accent);
  padding: 2px 7px;
  font-size: 11px;
  text-align: center;
}

.status.active {
  background: #315f8b;
}

.status.monitor,
.status.planned {
  background: var(--warn);
}

.status.stale,
.status.closed,
.status.negative {
  background: var(--bad);
}

.subject {
  min-width: 260px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.action {
  max-width: 520px;
}

.evidence {
  min-width: 150px;
  color: var(--muted);
}

.citation-hover {
  border-bottom: 1px dotted var(--muted);
  cursor: help;
}

.citation-button {
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.citation-row td {
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.citation-panel {
  background: #fbfaf6;
  padding: 10px 14px 14px 96px;
}

.citation-item {
  max-width: 1100px;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft);
}

.citation-item:last-child {
  border-bottom: 0;
}

.citation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.citation-path {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

blockquote {
  margin: 8px 0 0;
  padding: 0 0 0 10px;
  border-left: 2px solid var(--line);
  color: #34332f;
}

.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 560px;
}

#graphSvg {
  display: block;
  width: 100%;
  height: 560px;
  background:
    linear-gradient(#fbfaf6, #fbfaf6) padding-box,
    repeating-linear-gradient(0deg, transparent 0, transparent 55px, rgba(25, 25, 25, 0.035) 56px),
    repeating-linear-gradient(90deg, transparent 0, transparent 55px, rgba(25, 25, 25, 0.035) 56px);
  border-right: 1px solid var(--line);
}

.graph-edge {
  stroke: #8d8a80;
  stroke-linecap: round;
  opacity: 0.42;
}

.graph-edge[data-active="false"] {
  opacity: 0.08;
}

.graph-node {
  stroke: #fff;
  stroke-width: 1.4;
  cursor: pointer;
  opacity: 0.92;
}

.graph-node[data-active="false"] {
  opacity: 0.22;
}

.graph-node[data-selected="true"] {
  stroke: #111;
  stroke-width: 2.6;
}

.graph-label {
  fill: #262520;
  font-size: 11px;
  paint-order: stroke;
  stroke: #fbfaf6;
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.graph-label[data-active="false"] {
  opacity: 0.22;
}

.graph-details {
  padding: 16px;
  overflow: auto;
  max-height: 560px;
  background: #fff;
}

.graph-details h3 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.2;
}

.graph-details h4 {
  margin: 18px 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.graph-details ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.graph-details li {
  padding: 10px 0;
  border-top: 1px solid var(--soft);
}

.graph-details li strong,
.graph-details li span {
  display: block;
}

.graph-details li span {
  color: var(--muted);
  font-size: 12px;
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
}

.entity {
  background: #fff;
  padding: 14px;
}

.entity h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.community-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px;
  background: var(--line);
}

.community {
  background: #fff;
  padding: 14px;
}

.community h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.community ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
}

.downloads a {
  display: block;
  background: #fff;
  padding: 12px 14px;
  text-decoration: none;
  font-weight: 700;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  padding: 0 32px 28px;
  font-size: 12px;
}

@media (max-width: 760px) {
  .topbar,
  .section-head,
  footer {
    display: block;
  }

  nav {
    margin-top: 14px;
  }

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

  .controls {
    margin-top: 14px;
    justify-content: start;
  }

  input[type="search"] {
    width: 100%;
  }

  .citation-panel {
    padding-left: 12px;
  }

  .graph-layout {
    display: block;
  }

  #graphSvg {
    height: 420px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .graph-details {
    max-height: none;
  }
}
