:root {
  color-scheme: light;
  --ink: #101010;
  --muted: #584a3f;
  --paper: #fff0d2;
  --cream: #fff8e7;
  --white: #ffffff;
  --sun: #ffd53d;
  --pink: #f71b8c;
  --green: #00a86b;
  --blue: #2f7df6;
  --orange: #ff7a00;
  --violet: #8d35ff;
  --line: #101010;
  --shadow: 4px 4px 0 #101010;
  --soft-shadow: 2px 2px 0 #101010;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(47, 125, 246, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(247, 27, 140, 0.055) 1px, transparent 1px),
    #fff6e3;
  background-size: 42px 42px;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}

a {
  color: var(--ink);
  font-weight: 900;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 12px 18px;
  background: var(--paper);
  border-bottom: 3px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  background: var(--sun);
  border: 2px solid var(--line);
  border-radius: 4px;
}

h1 {
  color: var(--pink);
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 20px;
  line-height: 1;
  text-transform: uppercase;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tabs,
.actions,
.detail-meta,
.link-stack,
.intent-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.top-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.top-search label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.top-search span {
  width: fit-content;
  padding: 3px 7px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--pink);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.top-search input,
.top-search select {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  background: var(--white);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  font-size: 13px;
  font-weight: 900;
}

.tab,
.action-button {
  min-height: 34px;
  padding: 0 12px;
  background: var(--sun);
  border: 2px solid var(--line);
  border-radius: 5px;
  box-shadow: 2px 2px 0 var(--line);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.action-button.small {
  min-height: 30px;
  padding: 0 10px;
}

.tab:hover,
.action-button:hover,
.link-button:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--line);
}

.tab.is-active {
  color: var(--white);
  background: var(--ink);
}

main {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
  padding: 30px;
  background: var(--paper);
  border: 3px solid var(--line);
  box-shadow: var(--shadow);
}

.hero h2 {
  max-width: 860px;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: clamp(34px, 5vw, 72px);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 760px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
}

.eyebrow,
.north-star span,
.search span,
.filter-grid span,
.edit-field span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 10px;
  padding: 4px 8px;
  color: var(--white);
  background: var(--pink);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.north-star {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.north-star strong {
  font-size: 17px;
  line-height: 1.25;
}

.north-star small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
}

.intent-panel {
  align-items: stretch;
  margin: 0 0 22px;
}

.intent-card {
  flex: 1 1 230px;
  display: grid;
  gap: 7px;
  min-height: 132px;
  padding: 14px;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  text-align: left;
}

.intent-card:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--line);
}

.intent-card.is-active {
  background: var(--sun);
}

.intent-card span,
.decision-card span {
  width: fit-content;
  padding: 4px 7px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--line);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.intent-card strong {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 21px;
  line-height: 0.98;
  text-transform: uppercase;
}

.intent-card small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(260px, 370px) minmax(0, 1fr);
  gap: 18px 14px;
  align-items: end;
  margin: 24px 0;
}

.search,
.filter-grid .filter-card,
.edit-field,
.advanced-filters {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 9px;
  background: var(--cream);
  border: 3px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.search span,
.filter-grid span,
.edit-field span {
  margin-bottom: 0;
  background: var(--ink);
}

.search input,
.edit-field select,
.edit-field textarea,
.filter-grid select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 800;
}

.search input,
.edit-field select,
.edit-field textarea {
  min-height: 36px;
}

.advanced-filters {
  align-self: stretch;
}

.advanced-filters summary {
  width: fit-content;
  padding: 6px 10px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--pink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.edit-field textarea {
  resize: vertical;
  min-height: 100px;
}

.multi-check {
  display: grid;
  gap: 5px;
  max-height: 132px;
  overflow: auto;
  padding-right: 4px;
}

.multi-check label {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 28px;
  padding: 4px 7px;
  background: var(--white);
  border: 2px solid rgba(16, 16, 16, 0.32);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.multi-check label:has(input:checked) {
  color: var(--white);
  background: var(--ink);
  border-color: var(--line);
}

.multi-check input {
  flex: 0 0 auto;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.control-panel > .actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.layer-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 10px;
  background: var(--cream);
  border: 3px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.layer-panel legend {
  padding: 4px 8px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--pink);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.layer-panel label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  background: var(--white);
  border: 2px solid var(--line);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.search-status {
  min-height: 30px;
  padding: 7px 10px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--pink);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.network-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: stretch;
}

.graph-shell,
.detail-panel,
.table-wrap,
.review-copy,
.review-list,
.metric-card {
  background: rgba(255, 248, 231, 0.86);
  border: 3px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.graph-shell {
  position: relative;
  min-height: 660px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(247, 27, 140, 0.16), transparent 26%),
    radial-gradient(circle at 78% 30%, rgba(47, 125, 246, 0.14), transparent 24%),
    radial-gradient(circle at 52% 82%, rgba(0, 168, 107, 0.14), transparent 28%),
    var(--cream);
}

#graphCanvas {
  display: block;
  width: 100%;
  height: 660px;
  cursor: grab;
}

#graphCanvas:active {
  cursor: grabbing;
}

.graph-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: calc(100% - 28px);
  padding: 8px 10px;
  color: var(--white);
  background: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--pink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.map-legend {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  gap: 5px;
  width: min(260px, calc(100% - 28px));
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
}

.map-legend strong {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1;
  text-transform: uppercase;
}

.map-legend span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.detail-panel {
  display: grid;
  align-content: start;
  gap: 15px;
  min-width: 0;
  max-height: 660px;
  overflow: auto;
  padding: 18px;
}

.detail-panel h3,
.review-copy h3,
.shortlist-header h3 {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 26px;
  line-height: 1;
  text-transform: uppercase;
}

.decision-card {
  display: grid;
  gap: 9px;
  padding: 13px;
  background: var(--sun);
  border: 3px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
}

.decision-card strong {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 20px;
  line-height: 1;
  text-transform: uppercase;
}

.decision-card p,
.decision-card small {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
}

.muted,
.review-item p,
.metric-card p,
dd {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 8px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.pill[data-tier="qualified"] {
  color: var(--white);
  background: var(--green);
}

.pill[data-tier="review"] {
  color: var(--white);
  background: var(--pink);
}

.pill[data-tier="low_priority"] {
  background: var(--sun);
}

.pill[data-tier="disqualified"] {
  color: var(--white);
  background: var(--ink);
}

dl {
  display: grid;
  gap: 10px;
}

dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(16, 16, 16, 0.12);
}

dt {
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.link-stack a {
  padding: 7px 10px;
  background: var(--sun);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 12px;
}

.link-stack.compact {
  gap: 6px;
}

.link-stack.compact a,
.link-stack.compact button {
  font-size: 11px;
}

.profile-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--white);
  border: 2px solid rgba(16, 16, 16, 0.18);
}

.profile-section h4 {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1;
  text-transform: uppercase;
}

.profile-section ul {
  display: grid;
  gap: 5px;
  max-height: 220px;
  margin: 0;
  overflow: auto;
  padding-left: 18px;
}

.profile-section li {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.metadata-table {
  min-width: 0;
  table-layout: fixed;
}

.metadata-table th {
  position: static;
  width: 42%;
  padding: 7px 8px;
  background: transparent;
  border-bottom: 1px solid rgba(16, 16, 16, 0.12);
  font-size: 11px;
}

.metadata-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(16, 16, 16, 0.12);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.link-modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  background: transparent;
  border: 0;
}

.link-modal::backdrop {
  background: rgba(16, 16, 16, 0.42);
}

.link-modal form {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: var(--paper);
  border: 3px solid var(--line);
  box-shadow: var(--shadow);
}

.link-modal h3 {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 26px;
  line-height: 1;
  text-transform: uppercase;
}

.modal-actions {
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: var(--white);
}

th,
td {
  padding: 12px;
  border-bottom: 2px solid rgba(16, 16, 16, 0.12);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 73px;
  z-index: 5;
  background: var(--paper);
  border-bottom: 3px solid var(--line);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  font-weight: 800;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.link-button {
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
  font-weight: 950;
  text-align: left;
  text-decoration: underline;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  background: var(--white);
}

.metric-card span {
  color: var(--pink);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.metric-card strong {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 34px;
  line-height: 0.9;
}

.review-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.shortlist-header {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 18px;
  background: rgba(255, 248, 231, 0.86);
  border: 3px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.review-copy,
.review-list {
  padding: 18px;
}

.review-list {
  display: grid;
  gap: 12px;
  max-height: 760px;
  overflow: auto;
}

.review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px;
  background: var(--white);
  border: 2px solid var(--line);
}

.review-item h4 {
  margin: 7px 0 5px;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.05;
  text-transform: uppercase;
}

@media (max-width: 1180px) {
  .topbar,
  .hero,
  .control-panel,
  .network-layout,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .top-search {
    grid-template-columns: minmax(0, 1fr) 120px;
  }

  .filter-grid,
  .insight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions {
    justify-content: start;
  }

  .control-panel > .advanced-filters {
    grid-column: 1;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 10px;
  }

  main {
    width: min(100vw - 20px, 1440px);
    padding-top: 18px;
  }

  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .top-search {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 22px;
    box-shadow: 5px 5px 0 var(--line);
  }

  .hero h2 {
    font-size: clamp(36px, 13vw, 66px);
  }

  .filter-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .graph-shell {
    min-height: 520px;
  }

  .map-legend {
    position: static;
    width: auto;
    margin: 10px;
  }

  #graphCanvas {
    height: 520px;
  }

  dl div {
    grid-template-columns: 1fr;
  }
}
