:root {
  color-scheme: dark;
  --ink: #eef1e8;
  --muted: #a8ad9e;
  --faint: #73796d;
  --canvas: #0c0f0d;
  --surface: #131713;
  --surface-raised: #191e19;
  --line: #2c332c;
  --line-strong: #414a41;
  --acid: #cbf36a;
  --acid-dim: #809c43;
  --aqua: #6ed7c6;
  --amber: #e9b968;
  --red: #ef836f;
  --violet: #b7a8ef;
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(203, 243, 106, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(203, 243, 106, 0.025) 1px, transparent 1px),
    var(--canvas);
  background-size: 48px 48px;
  font-family: var(--sans);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 1rem;
  padding: 0.65rem 1rem;
  color: var(--canvas);
  background: var(--acid);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead,
main,
footer {
  width: min(1440px, calc(100% - 48px));
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 64px 0 34px;
  border-bottom: 1px solid var(--line-strong);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--acid);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 6vw, 5.6rem);
  font-weight: 570;
  letter-spacing: -0.065em;
  line-height: 0.9;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 560;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
}

.dek {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
}

.system-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-width: 235px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(19, 23, 19, 0.84);
}

.system-state strong,
.system-state span {
  display: block;
}

.system-state strong {
  font-size: 0.86rem;
}

.system-state span:last-child {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 18px rgba(233, 185, 104, 0.6);
}

.state-dot.good {
  background: var(--acid);
  box-shadow: 0 0 18px rgba(203, 243, 106, 0.6);
}

.state-dot.bad {
  background: var(--red);
  box-shadow: 0 0 18px rgba(239, 131, 111, 0.6);
}

main {
  padding: 28px 0 64px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.metric {
  min-height: 150px;
  padding: 24px;
  background: var(--surface);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-family: var(--mono);
  font-size: clamp(2.15rem, 4vw, 3.5rem);
  font-weight: 500;
  line-height: 1;
}

.metric small {
  font-size: 0.77rem;
}

.metric-primary strong {
  color: var(--acid);
}

.panel {
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: rgba(19, 23, 19, 0.93);
}

.priority-panel {
  border-color: var(--acid-dim);
  background:
    linear-gradient(135deg, rgba(203, 243, 106, 0.055), transparent 55%),
    var(--surface);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 24px;
}

.section-note {
  max-width: 470px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.bet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.bet-card {
  min-height: 160px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
}

.bet-card.empty {
  display: grid;
  color: var(--faint);
  background: transparent;
  border-style: dashed;
  place-items: center;
}

.bet-index,
.tag,
.status-pill {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bet-index {
  color: var(--acid);
}

.bet-card h3 {
  margin: 16px 0 8px;
}

.bet-card p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.bet-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.status-active {
  border-color: var(--acid-dim);
  color: var(--acid);
}

.status-ready,
.evidence-exploratory {
  border-color: #8b703d;
  color: var(--amber);
}

.status-published,
.evidence-paid,
.evidence-retained {
  border-color: #3c8176;
  color: var(--aqua);
}

.status-paused,
.status-blocked {
  border-color: #8c4e45;
  color: var(--red);
}

.status-researching,
.status-selected,
.evidence-pilot {
  border-color: #6f65a1;
  color: var(--violet);
}

.stream-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.stream-card {
  position: relative;
  min-height: 205px;
  padding: 20px;
  background: var(--surface-raised);
}

.stream-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 34px;
  height: 2px;
  background: var(--acid);
  content: "";
}

.stream-card h3 {
  margin: 22px 0 8px;
}

.stream-card p {
  color: var(--muted);
  font-size: 0.78rem;
}

.stream-card strong {
  position: absolute;
  right: 18px;
  bottom: 14px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 400;
}

.filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.filters label span {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--ink);
  background: var(--canvas);
  outline: none;
}

input {
  width: min(28vw, 270px);
}

input:focus,
select:focus {
  border-color: var(--acid);
  box-shadow: 0 0 0 2px rgba(203, 243, 106, 0.13);
}

.filter-count {
  margin: -8px 0 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th,
td {
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td:first-child {
  min-width: 205px;
}

.project-name {
  display: block;
  color: var(--ink);
  font-weight: 650;
}

.project-type {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.67rem;
}

.gate-cell {
  max-width: 360px;
  color: var(--muted);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.legend {
  display: flex;
  gap: 14px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.legend i {
  display: inline-block;
  width: 16px;
  height: 2px;
  margin: 0 5px 3px 0;
  background: var(--aqua);
}

.legend .legend-proposed {
  background: repeating-linear-gradient(90deg, var(--violet) 0 3px, transparent 3px 6px);
}

.relationship-list {
  display: grid;
  gap: 7px;
}

.relationship {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  font-size: 0.76rem;
}

.relationship.proposed {
  border-style: dashed;
  color: var(--muted);
}

.relationship-kind {
  color: var(--aqua);
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.relationship.proposed .relationship-kind {
  color: var(--violet);
}

.relationship span:last-child {
  text-align: right;
}

.outcome-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.outcome-stat span {
  color: var(--muted);
  font-size: 0.8rem;
}

.outcome-stat strong {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 400;
}

.boundary {
  margin-top: 18px;
  padding: 18px;
  border-left: 2px solid var(--amber);
  background: rgba(233, 185, 104, 0.055);
}

.boundary strong {
  color: var(--amber);
  font-size: 0.82rem;
}

.boundary p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.source-good {
  display: flex;
  gap: 14px;
}

.source-good strong {
  color: var(--acid);
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 400;
}

.source-good p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.source-issue {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #8c4e45;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.source-issue.registration-candidate {
  border-color: var(--amber);
  color: var(--ink);
}

.source-issue.registration-candidate .project-type {
  display: block;
  margin-top: 4px;
}

footer {
  padding: 0 0 36px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.65rem;
}

footer p {
  margin: 0;
}

@media (max-width: 1050px) {
  .metrics,
  .stream-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .split-layout {
    grid-template-columns: 1fr;
  }

  .section-heading-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .masthead,
  main,
  footer {
    width: min(100% - 24px, 1440px);
  }

  .masthead {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 38px;
  }

  .system-state {
    width: 100%;
  }

  .metrics,
  .stream-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 125px;
  }

  .panel {
    padding: 20px 16px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-note {
    text-align: left;
  }

  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .filters label,
  input,
  select {
    width: 100%;
  }

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

  .relationship-kind::after {
    content: " ↓";
  }

  .relationship span:last-child {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
