:root {
  --bg: #eef3f4;
  --panel: #ffffff;
  --ink: #172126;
  --muted: #667479;
  --line: #d2dddf;
  --soft: #f7fafb;
  --accent: #0f7f8c;
  --recipient: #b65c31;
  --cpp: #5b6fca;
  --outcome: #7c4d8f;
  --good: #23835b;
  --bad: #9f3e3e;
  --shadow: 0 18px 34px rgba(20, 37, 43, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

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

.shell-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.3fr);
  gap: 20px;
  align-items: end;
  padding: 22px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 243, 244, 0.95);
  backdrop-filter: blur(14px);
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  font-size: 14px;
}

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

.stage-tabs,
.subtabs,
.choice-row,
.controls,
.section-head,
.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stage-tabs {
  justify-content: flex-end;
}

.stage-tab,
.subtab,
.action-button,
.choice,
.persona-row,
.scenario-row,
.subcomponent-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  color: var(--ink);
  cursor: pointer;
}

.stage-tab,
.subtab {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

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

.overview-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#stageSummary,
.body-copy,
.note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.stat-grid,
.stat-row,
.mini-metrics {
  display: grid;
  gap: 10px;
}

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

.stat-row,
.mini-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.stat-grid article,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 11px;
}

.stat-grid span,
.stat-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stat-grid strong,
.stat-card strong {
  font-size: 17px;
}

.subtabs {
  margin: 0 0 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.section-flow {
  margin-bottom: 16px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.split-grid.wide-left {
  grid-template-columns: minmax(0, 1.25fr) 330px;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.dimension-card,
.flow-step,
.resource-card,
.scale-card,
.lock-card,
.lock-registry-card,
.lock-review-card,
.option-card,
.question-card,
.text-box,
.formula-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 12px;
}

.flow-step {
  position: relative;
  width: 100%;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.inspectable {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.inspectable::after {
  content: "Click to inspect";
  position: absolute;
  right: 10px;
  top: 10px;
  opacity: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.inspectable:hover,
.inspectable:focus-visible {
  border-color: var(--ink);
  background: white;
  box-shadow: 0 14px 28px rgba(20, 37, 43, 0.12);
  transform: translateY(-2px);
}

.inspectable:hover::after,
.inspectable:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.dimension-card {
  border-top: 4px solid var(--accent);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.resource-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  gap: 10px;
}

.resource-meta,
.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.resource-meta {
  justify-content: space-between;
}

.resource-meta span,
.resource-meta b {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.resource-meta span {
  background: var(--ink);
  color: white;
}

.resource-meta b {
  background: #e7eef0;
  color: var(--muted);
}

.resource-card h3 {
  font-size: 15px;
}

.resource-card p {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.resource-actions {
  margin-top: auto;
}

.small-button,
.resource-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.resource-link {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.timeline-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 13px;
}

.timeline-item > span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.timeline-item p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.scale-guide,
.lock-grid,
.lock-registry,
.lock-review-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.scale-guide {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.scale-card {
  min-height: 112px;
}

.scale-card b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 9px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
}

.scale-card span,
.lock-card p,
.lock-registry-card p,
.lock-review-card p {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.scale-card.force,
.lock-card.is-locked {
  border-color: var(--bad);
  box-shadow: inset 4px 0 0 var(--bad);
}

.lock-stack {
  display: grid;
  gap: 9px;
  margin: 16px 0;
}

.lock-stack article {
  display: grid;
  grid-template-columns: 34px minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 10px;
}

.lock-stack b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
}

.lock-stack span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.lock-head,
.lock-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.lock-head div {
  display: grid;
  gap: 4px;
}

.lock-head span,
.lock-foot span {
  color: var(--muted);
  font-size: 12px;
}

.lock-head > b {
  border-radius: 999px;
  background: #edf2f3;
  color: var(--ink);
  padding: 5px 8px;
  font-size: 11px;
}

.lock-card.is-locked .lock-head > b,
.lock-review-card.ask .lock-head > b {
  background: var(--bad);
  color: white;
}

.lock-scale-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
}

.lock-scale-button {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.lock-scale-button span {
  font-weight: 900;
}

.lock-scale-button small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.lock-scale-button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.lock-scale-button.is-active small {
  color: white;
}

.lock-scale-button.force.is-active {
  border-color: var(--bad);
  background: var(--bad);
}

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

.range-control {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 84px;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 12px;
}

.range-control label {
  font-size: 13px;
  font-weight: 900;
}

.range-control strong {
  text-align: right;
}

.range-control input[type="range"] {
  min-height: auto;
  border: 0;
  background: transparent;
  padding: 0;
}

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

.lock-review-card.wait {
  box-shadow: inset 4px 0 0 var(--cpp);
}

.lock-review-card.ask {
  box-shadow: inset 4px 0 0 var(--bad);
}

.release-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2eaed;
  margin-top: 12px;
}

.release-meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.lock-review-card.ask .release-meter i {
  background: var(--bad);
}

.release-events {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.release-events span {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.release-events span.seen {
  border-color: rgba(35, 131, 91, 0.4);
  background: #edf7f2;
  color: var(--ink);
}

.release-events b {
  color: var(--good);
}

.dimension-card span,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 6px 0;
  border-radius: 999px;
  background: #eef1fb;
  color: var(--cpp);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.dimension-card p,
.dimension-card small,
.flow-step p,
.option-card p,
.question-card p,
.question-card small,
.formula-box span,
.text-box {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.chart-panel {
  min-width: 0;
}

.spider {
  display: block;
  width: min(100%, 420px);
  margin: 8px auto 4px;
}

.spider-grid circle,
.spider-grid line {
  fill: none;
  stroke: #cad5d8;
  stroke-width: 1;
}

.spider-grid text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.spider-main {
  fill: rgba(15, 127, 140, 0.19);
  stroke: var(--accent);
  stroke-width: 2.5;
}

.spider-base {
  fill: rgba(91, 111, 202, 0.12);
  stroke: var(--cpp);
  stroke-width: 2;
}

.legend-row {
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.legend-row i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -2px;
}

.legend-row .main {
  background: var(--accent);
}

.legend-row .base {
  background: var(--cpp);
}

.flow-grid,
.pipeline-wide,
.compare-grid,
.analysis-grid,
.evidence-lanes {
  display: grid;
  gap: 12px;
}

.flow-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.pipeline-wide,
.compare-grid,
.analysis-grid,
.evidence-lanes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

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

.flow-step b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
}

.window-diagram {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.window-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.window-block div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2eaed;
  margin-bottom: 10px;
}

.window-block i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--outcome);
}

.window-block span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.bar-table {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.metric-bar,
.weight-row,
.delta-row {
  display: grid;
  grid-template-columns: 150px 1fr 160px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.metric-bar div,
.weight-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2eaed;
}

.metric-bar i,
.weight-row i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.metric-bar .neg {
  background: var(--recipient);
}

.metric-bar .pos {
  background: var(--accent);
}

.status-badge {
  margin: 0;
  color: var(--ink);
  background: #edf2f3;
}

.status-badge.promoted {
  color: white;
  background: var(--outcome);
}

.section-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.question-list,
.persona-list,
.scenario-list,
.subcomponent-list,
.delta-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.question-list.compact {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.question-head strong {
  color: var(--ink);
}

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

.weight-row {
  grid-template-columns: 62px 1fr 34px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-row span {
  border-radius: 999px;
  background: #eef1fb;
  color: var(--cpp);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
}

.persona-row,
.scenario-row,
.subcomponent-row {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px;
  text-align: left;
}

.persona-row.is-active,
.scenario-row.is-active,
.subcomponent-row.is-active {
  border-color: var(--ink);
  box-shadow: inset 4px 0 0 var(--ink);
}

.persona-row span,
.scenario-row span,
.subcomponent-row span {
  color: var(--muted);
  font-size: 12px;
}

.text-box {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

.decision-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.decision-card.vertical {
  grid-template-columns: 1fr;
}

.decision-card div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 11px;
}

.decision-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.decision-card strong {
  font-size: 13px;
  line-height: 1.45;
}

.lane {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.evidence-pill {
  margin-top: 9px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 7px;
  background: white;
  padding: 10px;
}

.evidence-pill.recipient {
  border-left-color: var(--recipient);
}

.evidence-pill.cpp {
  border-left-color: var(--cpp);
}

.evidence-pill span {
  float: right;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.evidence-pill p {
  clear: both;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 14px 0 10px;
}

.choice {
  min-height: 42px;
  font-weight: 900;
}

.choice.is-active.yes {
  border-color: var(--good);
  background: var(--good);
  color: white;
}

.choice.is-active.no {
  border-color: var(--bad);
  background: var(--bad);
  color: white;
}

textarea,
input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 0 10px;
}

textarea {
  min-height: 116px;
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
}

.action-button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  font-weight: 900;
}

.delta-row {
  grid-template-columns: 1fr 56px 54px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 9px;
  font-size: 12px;
}

.delta-row em {
  color: var(--muted);
  font-style: normal;
}

.controls {
  justify-content: flex-end;
}

.controls select {
  width: 220px;
}

.controls input {
  width: 280px;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 24, 30, 0.44);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(720px, 86vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(3, 17, 23, 0.28);
}

.modal-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 1180px) {
  .shell-head,
  .overview-band,
  .split-grid,
  .split-grid.wide-left,
  .flow-grid,
  .pipeline-wide,
  .compare-grid,
  .analysis-grid,
  .evidence-lanes,
  .dimension-grid,
  .resource-grid,
  .scale-guide,
  .lock-grid,
  .lock-registry,
  .lock-review-grid,
  .window-diagram,
  .stat-grid,
  .stat-row,
  .mini-metrics {
    grid-template-columns: 1fr;
  }

  .stage-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .shell-head,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .decision-card,
  .weight-grid,
  .metric-bar,
  .timeline-item,
  .lock-stack article,
  .range-control,
  .controls,
  .section-head {
    grid-template-columns: 1fr;
  }

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

  .controls {
    display: grid;
    width: 100%;
  }

  .controls select,
  .controls input {
    width: 100%;
  }
}
