:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #667070;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #d8ded8;
  --green: #0f766e;
  --green-soft: #dff3ee;
  --gold: #a15c00;
  --gold-soft: #fff0cf;
  --red: #a23b3b;
  --red-soft: #f9e2df;
  --blue: #315f8a;
  --blue-soft: #e4eef7;
  --shadow: 0 18px 50px rgba(20, 32, 36, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(49, 95, 138, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 56px 56px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.topbar {
  align-items: center;
  background: rgba(251, 250, 247, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px clamp(16px, 5vw, 56px);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  align-items: center;
  background: var(--ink);
  border: 3px solid #e8b34b;
  color: #fffdf8;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 800;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
  margin: 0;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.topbar-note {
  color: var(--muted);
  max-width: 420px;
  text-align: right;
}

.app-shell {
  margin: 0 auto;
  max-width: 1280px;
  padding: 26px clamp(16px, 5vw, 56px) 60px;
}

.tabbar {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 22px;
  padding: 8px;
}

.tab,
.mini-tab {
  background: transparent;
  border: 1px solid transparent;
  color: #4b5555;
  cursor: pointer;
  font-weight: 750;
  min-height: 42px;
  padding: 8px 10px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.tab:hover,
.mini-tab:hover,
.tab:focus-visible,
.mini-tab:focus-visible {
  background: #f2f6f4;
  border-color: var(--line);
  outline: none;
}

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

.panel {
  animation: lift 180ms ease;
}

@keyframes lift {
  from {
    opacity: 0.45;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-grid,
.split-layout,
.two-column,
.ledger,
.formula-grid,
.workboard {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
}

.lede-panel,
.status-board,
.strip,
.section-head,
.hierarchy-stage,
.ledger > article,
.validation-card,
.formula-block,
.workboard > article,
.pipeline-step,
.two-column > article {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lede-panel,
.strip,
.section-head,
.ledger > article,
.validation-card,
.formula-block,
.workboard > article,
.two-column > article {
  padding: 24px;
}

.lede-panel h2,
.section-head h2 {
  font-size: 34px;
  line-height: 1.08;
  margin: 0 0 14px;
  max-width: 780px;
}

.lede-panel p,
.section-head p,
.strip p,
.two-column p,
.workboard p,
.validation-card p {
  color: #4e5757;
  margin: 0;
}

.lede-panel p + p,
.validation-card p + p {
  margin-top: 14px;
}

.callout {
  background: var(--green-soft);
  border-left: 5px solid var(--green);
  margin-top: 22px;
  padding: 14px 16px;
}

.status-board {
  align-content: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.stat {
  background: #f7f4ee;
  border: 1px solid #e8e1d5;
  min-height: 122px;
  padding: 16px;
}

.stat-value {
  display: block;
  font-size: 42px;
  font-weight: 850;
  line-height: 1;
}

.stat-label {
  color: #5f6666;
  display: block;
  font-size: 14px;
  margin-top: 10px;
}

.accent-green {
  background: var(--green-soft);
  border-color: #abd9cc;
}

.accent-gold {
  background: var(--gold-soft);
  border-color: #e7c77d;
}

.split-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
  margin-top: 18px;
}

.split-layout > section {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  padding: 22px;
}

h3 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0 0 14px;
}

.plain-list {
  display: grid;
  gap: 12px;
}

.plain-list p {
  border-left: 4px solid #d6a43d;
  margin: 0;
  padding-left: 12px;
}

.name-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.name-grid span {
  background: #f4f6f4;
  border: 1px solid var(--line);
  display: block;
  font-weight: 750;
  min-height: 46px;
  padding: 10px 12px;
}

.strip {
  margin-top: 18px;
}

.section-head {
  align-items: end;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.75fr);
  margin-bottom: 18px;
}

.hierarchy-stage {
  min-height: 360px;
  overflow: hidden;
  position: relative;
}

#hierarchyCanvas {
  display: block;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

.stage-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(32, 33, 36, 0.16);
  box-shadow: 0 12px 30px rgba(32, 33, 36, 0.12);
  min-height: 108px;
  padding: 15px;
  position: absolute;
  width: 210px;
}

.stage-card span,
.test-card .meta,
.enumerator-card .meta,
.test-page-link,
.metric span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.stage-card strong {
  display: block;
  font-size: 25px;
  margin: 6px 0;
}

.stage-card small {
  color: #505858;
  display: block;
}

.stage-72 {
  left: 5%;
  top: 64px;
}

.stage-56 {
  left: 30%;
  top: 188px;
}

.stage-40 {
  right: 29%;
  top: 64px;
}

.stage-24 {
  right: 5%;
  top: 188px;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.formula-block pre {
  background: #1f2524;
  color: #f9f6ed;
  margin: 0;
  overflow-x: auto;
  padding: 18px;
}

.formula-block code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  white-space: pre;
}

.metric-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 102px;
  padding: 16px;
}

.metric b {
  display: block;
  font-size: 36px;
  line-height: 1;
}

.ledger {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.75fr);
}

table {
  border-collapse: collapse;
  width: 100%;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.test-toolbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.filter-tabs {
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px;
}

.search-box {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  gap: 10px;
  min-height: 48px;
  min-width: 280px;
  padding: 8px 12px;
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-box input {
  border: 0;
  min-width: 0;
  outline: 0;
  width: 100%;
}

.test-summary {
  color: var(--muted);
  font-weight: 750;
  margin: 0 0 12px;
}

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

.test-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: 16px;
}

.test-card h3 {
  font-size: 16px;
  margin: 8px 0 10px;
}

.test-card p {
  color: #515858;
  margin: 0 0 10px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 10px;
}

.badge {
  border: 1px solid var(--line);
  color: #3f4848;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 26px;
  padding: 4px 8px;
}

.badge.kill {
  background: var(--red-soft);
  border-color: #e6aaa1;
  color: var(--red);
}

.badge.open {
  background: var(--gold-soft);
  border-color: #e7c77d;
  color: var(--gold);
}

.badge.validation {
  background: var(--blue-soft);
  border-color: #b6cfe4;
  color: var(--blue);
}

.badge.saturates {
  background: var(--green-soft);
  border-color: #abd9cc;
  color: var(--green);
}

.test-page-link {
  color: var(--blue);
  margin-top: 8px;
  text-decoration: none;
}

.test-page-link:hover {
  text-decoration: underline;
}

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

.pipeline-step {
  min-height: 230px;
  padding: 18px;
}

.pipeline-step b {
  align-items: center;
  background: var(--ink);
  color: white;
  display: inline-flex;
  font-size: 18px;
  height: 38px;
  justify-content: center;
  margin-bottom: 16px;
  width: 38px;
}

.pipeline-step p {
  color: #4f5858;
  margin: 0;
}

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

.download-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.download-panel > article {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px;
}

.download-panel p {
  color: #4f5858;
  margin: 0;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button-link {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  color: white;
  display: inline-flex;
  font-weight: 800;
  min-height: 42px;
  padding: 8px 12px;
  text-decoration: none;
}

.button-link.secondary {
  background: var(--panel);
  color: var(--ink);
}

.button-link:hover {
  filter: brightness(1.08);
}

.enumerator-summary {
  color: var(--muted);
  font-weight: 750;
  margin: 18px 0 12px;
}

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

.enumerator-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 16px;
}

.enumerator-card h3 {
  font-size: 16px;
  margin: 8px 0 10px;
}

.enumerator-card p {
  color: #515858;
  margin: 0 0 10px;
}

.enumerator-card a {
  color: var(--blue);
  font-weight: 800;
  margin-top: auto;
  text-decoration: none;
}

.enumerator-card a:hover {
  text-decoration: underline;
}

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

ul {
  margin: 0;
  padding-left: 20px;
}

li + li {
  margin-top: 10px;
}

@media (max-width: 980px) {
  .topbar,
  .section-head,
  .dashboard-grid,
  .split-layout,
  .two-column,
  .ledger,
  .formula-grid,
  .workboard {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    display: grid;
  }

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

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

  .metric-row,
  .pipeline,
  .test-grid,
  .download-panel,
  .enumerator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-card {
    width: 188px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .tabbar,
  .metric-row,
  .pipeline,
  .test-grid,
  .download-panel,
  .enumerator-grid,
  .status-board,
  .name-grid {
    grid-template-columns: 1fr;
  }

  .tab {
    text-align: left;
  }

  .lede-panel h2,
  .section-head h2 {
    font-size: 28px;
  }

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

  .search-box {
    min-width: 0;
  }

  .hierarchy-stage {
    min-height: 620px;
  }

  .stage-card {
    left: 18px;
    right: 18px;
    width: auto;
  }

  .stage-72 {
    top: 34px;
  }

  .stage-56 {
    top: 178px;
  }

  .stage-40 {
    top: 322px;
  }

  .stage-24 {
    top: 466px;
  }
}
