:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --soft: #eef2f7;
  --line: #d9e0ea;
  --navy: #111827;
  --general: #3767d8;
  --agentic: #10906f;
  --physical: #c0392b;
  --hold: #cbd5e1;
  --cluster-0: #2563eb;
  --cluster-1: #dc2626;
  --cluster-2: #7c3aed;
  --cluster-3: #0891b2;
  --cluster-4: #ea580c;
  --cluster-5: #16a34a;
  --surface: #ffffff;
  --page: #f4f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

a {
  color: inherit;
}

.hero {
  background: var(--navy);
  color: white;
  padding: 24px 38px 44px;
}

.topbar,
.hero-grid,
main {
  max-width: 1640px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 52px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.16);
}

.nav-link {
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 10px 16px;
  color: rgba(255, 255, 255, 0.88);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  color: #99a4b8;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.045em;
}

h1 {
  font-size: clamp(44px, 5vw, 76px);
  line-height: 0.95;
}

h2 {
  font-size: 26px;
}

.subtitle {
  margin: 20px 0 0;
  max-width: 860px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 20px;
}

.hero-card {
  min-width: 210px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  text-align: right;
  background: rgba(255, 255, 255, 0.06);
}

.hero-card span {
  display: block;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.hero-card small {
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

main {
  padding: 28px 38px 48px;
}

.systems-view {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 22px;
  padding: 0 2px 18px;
  border-bottom: 1px solid var(--line);
}

.systems-view .eyebrow,
.systems-view h2 {
  margin: 0;
}

.systems-view .eyebrow {
  white-space: nowrap;
}

.systems-view h2 {
  font-size: 20px;
}

.controls,
.space-panel,
.details {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(620px, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.controls,
.details {
  position: sticky;
  top: 18px;
  padding: 20px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  font-weight: 900;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--soft);
  cursor: pointer;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #445066;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid #cfd7e3;
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
}

.legend {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  color: #536076;
  font-size: 13px;
  line-height: 1.35;
}

.dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 8px;
  border-radius: 999px;
  vertical-align: -1px;
}

.general {
  background: var(--general);
}

.agentic {
  background: var(--agentic);
}

.physical {
  background: var(--physical);
}

.hold {
  background: var(--hold);
}

.hold-legend {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.hold-node {
  border: 1px solid #94a3b8;
  background: var(--hold);
}

.space-panel {
  overflow: hidden;
}

.space-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 12px;
}

.interpretation-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 24px 8px;
  color: #667085;
  font-size: 13px;
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 10px;
}

.view-pill {
  border: 1px solid #d8e0ec;
  background: white;
  font-weight: 800;
}

.view-pill.active {
  color: white;
  background: var(--navy);
}

.mode-pill {
  border: 1px solid #d8e0ec;
  background: white;
  font-weight: 800;
}

.mode-pill.active {
  color: white;
  background: var(--navy);
}

#systemModeText {
  margin-left: 6px;
}

.result-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 9px 13px;
  color: #536076;
  background: var(--soft);
  font-weight: 800;
}

.plot-wrap {
  height: min(70vh, 760px);
  min-height: 560px;
  padding: 10px 18px 6px;
}

#riskPlot {
  width: 100%;
  height: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background:
    linear-gradient(#eef2f7 1px, transparent 1px),
    linear-gradient(90deg, #eef2f7 1px, transparent 1px),
    #fbfdff;
  background-size: 48px 48px;
}

.network-edge {
  pointer-events: none;
  stroke: #64748b;
  stroke-linecap: round;
}

.network-edge.path-edge {
  stroke: #111827;
  stroke-width: 2.8;
  opacity: 0.92;
}

.point {
  cursor: pointer;
  opacity: 0.78;
  stroke: white;
  stroke-width: 1.4;
}

.point.selected {
  opacity: 1;
  stroke: #111827;
  stroke-width: 3;
}

.centroid {
  pointer-events: none;
}

.centroid text {
  fill: #111827;
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: white;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.community-label {
  pointer-events: none;
}

.community-label circle {
  fill: rgba(255, 255, 255, 0.88);
  stroke-width: 2;
}

.community-label text {
  fill: #111827;
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: white;
  stroke-width: 5px;
  stroke-linejoin: round;
}

.scale-diagnostics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  height: 100%;
  padding: 16px;
}

.scale-diagnostics figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  margin: 0;
}

.scale-diagnostics svg {
  width: 100%;
  height: 100%;
  min-height: 460px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fbfdff;
}

.scale-diagnostics figcaption {
  padding-top: 8px;
  color: #536076;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.diagnostic-axis {
  stroke: #94a3b8;
  stroke-width: 1;
}

.diagnostic-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.diagnostic-series {
  fill: none;
  stroke: var(--cluster-0);
  stroke-width: 2.5;
}

.diagnostic-node,
.diagnostic-node-label {
  cursor: pointer;
}

.diagnostic-leader {
  stroke: #94a3b8;
  stroke-width: 0.8;
}

.diagnostic-label {
  fill: #536076;
  font-size: 11px;
}

.diagnostic-title {
  fill: #111827;
  font-size: 13px;
  font-weight: 900;
}

.caption {
  margin: 0;
  padding: 0 24px 22px;
  color: #667085;
  font-size: 13px;
}

.empty {
  border: 1px dashed #cfd7e3;
  border-radius: 16px;
  padding: 18px;
  color: #667085;
  line-height: 1.55;
}

.hidden {
  display: none;
}

.card-details h3 {
  margin: 8px 0 10px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 9px;
  color: #344054;
  background: #eef2f7;
  font-size: 12px;
  font-weight: 900;
}

.badge.general {
  color: var(--general);
  background: rgba(55, 103, 216, 0.11);
}

.badge.agentic {
  color: var(--agentic);
  background: rgba(16, 144, 111, 0.11);
}

.badge.physical {
  color: var(--physical);
  background: rgba(192, 57, 43, 0.11);
}

.badge.hold {
  color: #475569;
  background: #e2e8f0;
}

.path,
.definition,
.references,
.systems-card {
  margin-top: 16px;
}

.path {
  border-radius: 14px;
  padding: 12px;
  color: #536076;
  background: #f2f5f9;
  font-size: 13px;
  line-height: 1.45;
}

.definition p {
  margin: 8px 0 0;
  color: #475467;
  line-height: 1.55;
}

.systems-card {
  border-left: 4px solid #111827;
  border-radius: 14px;
  padding: 12px;
  background: #fff7ed;
}

.systems-card p {
  margin: 8px 0 0;
  color: #475467;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.metric {
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  padding: 10px;
}

.metric span {
  display: block;
  color: #8a96aa;
  font-size: 11px;
  text-transform: uppercase;
}

.metric strong {
  font-size: 18px;
}

.references a {
  display: block;
  margin-top: 7px;
  color: #1f5edb;
  font-weight: 800;
  text-decoration: none;
}

.references small {
  color: #8a96aa;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .controls,
  .details {
    position: static;
  }
}

@media (max-width: 720px) {
  .hero,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .systems-view {
    display: block;
  }

  .systems-view h2 {
    margin-top: 6px;
  }

  .plot-wrap {
    min-height: 420px;
  }

  .scale-diagnostics {
    grid-template-columns: 1fr;
    height: auto;
  }

  .scale-diagnostics svg {
    min-height: 320px;
  }
}
