:root {
  --bg: #070a0e;
  --surface: #0b111b;
  --surface-raised: #111925;
  --surface-soft: #0e1622;
  --text: #f4f8fc;
  --copy: #c9d5e1;
  --muted: #9aa6b5;
  --cyan: #57dce9;
  --cyan-strong: #81e8f0;
  --green: #46d6a5;
  --red: #ff7185;
  --amber: #f2bd5b;
  --rule: rgba(226, 232, 240, 0.15);
  --rule-soft: rgba(226, 232, 240, 0.09);
  --focus: rgba(87, 220, 233, 0.44);
  --body: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  background: var(--cyan);
  content: "";
  z-index: 20;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.onboarding-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--rule);
  background: rgba(7, 10, 14, 0.96);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.onboarding-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.onboarding-brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.onboarding-header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.save-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.save-status[data-tone="saving"] {
  color: var(--cyan);
}

.save-status[data-tone="saved"] {
  color: var(--green);
}

.save-status[data-tone="error"] {
  color: var(--red);
}

.text-button {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--copy);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(201, 213, 225, 0.4);
  text-underline-offset: 4px;
}

.text-button:hover {
  color: var(--cyan-strong);
  text-decoration-color: var(--cyan);
}

.onboarding-shell {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  width: min(1240px, 100%);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
}

.onboarding-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 56px 40px 42px 24px;
  border-right: 1px solid var(--rule);
}

.rail-intro h1 {
  max-width: 12ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.03;
  text-wrap: balance;
}

.rail-intro p {
  max-width: 32ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.progress-list {
  position: relative;
  display: grid;
  gap: 0;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}

.progress-list::before {
  position: absolute;
  top: 21px;
  bottom: 21px;
  left: 8px;
  width: 1px;
  background: var(--rule);
  content: "";
}

.progress-list li {
  position: relative;
}

.progress-list li::before {
  position: absolute;
  top: 20px;
  left: 5px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--bg);
  content: "";
  z-index: 1;
}

.progress-list li.is-complete::before {
  border-color: var(--green);
  background: var(--green);
}

.progress-list li.is-active::before {
  width: 9px;
  height: 9px;
  top: 19px;
  left: 4px;
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(87, 220, 233, 0.1);
}

.progress-list button {
  display: grid;
  width: 100%;
  min-height: 62px;
  padding: 12px 8px 12px 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.progress-list button:disabled {
  cursor: default;
  opacity: 0.55;
}

.progress-list span {
  font-size: 13px;
  font-weight: 600;
}

.progress-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.progress-list .is-active span {
  color: var(--text);
}

.progress-list .is-complete span {
  color: var(--copy);
}

.onboarding-main {
  position: relative;
  min-width: 0;
  padding: 72px clamp(36px, 7vw, 96px) 80px;
}

.onboarding-step {
  width: min(760px, 100%);
  margin: 0 auto;
}

.onboarding-step.is-active {
  animation: step-reveal 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes step-reveal {
  from {
    opacity: 0.78;
    clip-path: inset(0 0 12% 0);
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    clip-path: inset(0);
    transform: translateY(0);
  }
}

.step-copy h2,
.onboarding-closed h2 {
  max-width: 19ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}

.step-copy p,
.onboarding-closed > p {
  max-width: 66ch;
  margin: 20px 0 0;
  color: var(--copy);
  font-size: 16px;
  line-height: 1.65;
}

.request-path {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 44px minmax(160px, 1.2fr) 44px minmax(130px, 1fr);
  align-items: center;
  margin-top: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.path-node {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 116px;
  padding: 0 10px;
}

.path-node > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.path-node:first-child {
  padding-left: 0;
}

.path-node:last-child {
  padding-right: 0;
}

.path-node strong,
.path-node small {
  display: block;
}

.path-node strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.path-node small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.path-symbol {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
}

.path-symbol-app {
  border: 1px solid var(--copy);
  border-radius: 5px;
}

.path-symbol-app::before,
.path-symbol-app::after {
  position: absolute;
  background: var(--copy);
  content: "";
}

.path-symbol-app::before {
  right: 5px;
  bottom: 6px;
  left: 5px;
  height: 1px;
}

.path-symbol-app::after {
  right: 9px;
  bottom: 10px;
  left: 9px;
  height: 8px;
  border: 1px solid var(--copy);
  background: transparent;
}

.path-symbol-vault {
  border: 1px solid var(--cyan);
  border-radius: 50%;
}

.path-symbol-vault::before,
.path-symbol-vault::after {
  position: absolute;
  top: 7px;
  width: 8px;
  height: 18px;
  border: 1px solid var(--cyan);
  content: "";
}

.path-symbol-vault::before {
  left: 7px;
  transform: skewY(26deg);
}

.path-symbol-vault::after {
  right: 7px;
  transform: skewY(-26deg);
}

.path-symbol-provider {
  border: 1px solid var(--copy);
  transform: rotate(45deg);
}

.path-symbol-provider::after {
  position: absolute;
  inset: 7px;
  border: 1px solid var(--copy);
  content: "";
}

.path-line {
  height: 1px;
  background: var(--rule);
}

.path-node-active strong {
  color: var(--cyan-strong);
}

.step-outcome {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 28px;
  margin-top: 34px;
  padding: 24px 0 0;
}

.step-outcome > strong {
  color: var(--text);
  font-size: 13px;
}

.step-outcome ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--copy);
  list-style: none;
}

.step-outcome li {
  position: relative;
  padding-left: 18px;
}

.step-outcome li::before {
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 6px;
  height: 1px;
  background: var(--cyan);
  content: "";
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 46px;
}

.step-actions-split .button:last-child,
.step-actions-final .button:last-child {
  margin-left: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover {
  border-color: rgba(87, 220, 233, 0.42);
  color: var(--cyan-strong);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button-primary {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #071013;
}

.button-primary:hover {
  border-color: var(--cyan-strong);
  background: var(--cyan-strong);
  color: #071013;
}

.button-secondary {
  background: transparent;
}

.button-danger {
  border-color: rgba(255, 113, 133, 0.4);
  background: rgba(255, 113, 133, 0.08);
  color: #ff9aaa;
}

.onboarding-form {
  display: grid;
  gap: 36px;
  margin-top: 40px;
}

.field-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group > label,
.field-group legend {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.field-group > small,
.field-help {
  display: block;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.field-group input[type="text"],
.field-group select {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
}

.field-group input[type="text"]:hover,
.field-group select:hover {
  border-color: rgba(87, 220, 233, 0.34);
}

.field-group input[aria-invalid="true"],
.field-group select[aria-invalid="true"] {
  border-color: var(--red);
}

.field-group[aria-invalid="true"] .choice-list {
  border-color: var(--red);
}

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

.choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.choice-list label {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-width: 0;
  min-height: 94px;
  padding: 17px 18px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.choice-list label:hover {
  background: var(--surface-raised);
}

.choice-list label:has(input:checked) {
  background: rgba(87, 220, 233, 0.1);
  box-shadow: inset 0 0 0 1px rgba(87, 220, 233, 0.48);
}

.choice-list input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-list input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.choice-list span,
.choice-list strong,
.choice-list small {
  display: block;
}

.choice-list span {
  min-width: 0;
  width: 100%;
  padding-left: 25px;
  overflow-wrap: anywhere;
}

.choice-list span::before {
  position: absolute;
  top: 19px;
  left: 16px;
  width: 13px;
  height: 13px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  content: "";
}

.choice-list label:has(input:checked) span::before {
  border: 4px solid var(--cyan);
  background: #071013;
}

.choice-list strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.choice-list small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.field-error {
  display: block;
  min-height: 18px;
  margin-top: 7px;
  color: #ff9aaa;
  font-size: 12px;
}

.model-ledger {
  margin-top: 44px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.model-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 18px;
  padding: 24px 0;
}

.model-row > div {
  min-width: 0;
}

.model-row + .model-row {
  border-top: 1px solid var(--rule-soft);
}

.model-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
}

.model-row strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.model-row p {
  max-width: 68ch;
  margin: 5px 0 0;
  color: var(--copy);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workspace-map {
  margin-top: 42px;
}

.workspace-map h3 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
}

.workspace-map dl,
.setup-summary dl {
  margin: 0;
}

.workspace-map dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}

.workspace-map dl > div {
  min-width: 0;
  padding: 18px 18px 18px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.workspace-map dl > div:nth-child(even) {
  padding-right: 0;
  padding-left: 18px;
  border-left: 1px solid var(--rule-soft);
}

.workspace-map dt,
.setup-summary dt {
  color: var(--cyan-strong);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.workspace-map dd {
  margin: 7px 0 0;
  color: var(--copy);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.boundary-note {
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid rgba(242, 189, 91, 0.38);
  border-bottom: 1px solid rgba(242, 189, 91, 0.2);
}

.boundary-note strong {
  color: var(--amber);
  font-size: 13px;
}

.boundary-note p {
  margin: 5px 0 0;
  color: var(--copy);
  font-size: 13px;
}

.setup-summary {
  margin-top: 42px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.setup-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.setup-summary dl > div {
  min-width: 0;
  padding: 20px 16px;
}

.setup-summary dl > div:first-child {
  padding-left: 0;
}

.setup-summary dl > div + div {
  border-left: 1px solid var(--rule-soft);
}

.setup-summary dd {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.next-sequence {
  display: grid;
  gap: 0;
  margin-top: 38px;
}

.next-sequence > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.next-sequence span {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
}

.next-sequence p {
  margin: 0;
  color: var(--copy);
  font-size: 13px;
}

.next-sequence strong {
  color: var(--text);
  font-weight: 600;
}

.page-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(760px, 100%);
  margin: 0 auto 28px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface-soft);
}

.page-message-error {
  border-color: rgba(255, 113, 133, 0.36);
}

.page-message strong,
.page-message span {
  display: block;
}

.page-message strong {
  color: #ff9aaa;
  font-size: 13px;
}

.page-message span,
.page-message:not(:has(div)) {
  margin-top: 3px;
  color: var(--copy);
  font-size: 12px;
}

.page-message button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.skip-confirm {
  position: sticky;
  bottom: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(760px, 100%);
  margin: 36px auto 0;
  padding: 18px;
  border: 1px solid rgba(242, 189, 91, 0.42);
  border-radius: 8px;
  background: #111821;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.skip-confirm strong {
  color: var(--text);
  font-size: 13px;
}

.skip-confirm p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.skip-confirm > div:last-child {
  display: flex;
  gap: 8px;
}

.onboarding-closed {
  padding-top: 40px;
}

.closed-mark {
  position: relative;
  width: 54px;
  height: 54px;
  margin-bottom: 26px;
  border: 1px solid var(--green);
  border-radius: 50%;
}

.closed-mark::before {
  position: absolute;
  top: 17px;
  left: 14px;
  width: 23px;
  height: 12px;
  border-bottom: 2px solid var(--green);
  border-left: 2px solid var(--green);
  content: "";
  transform: rotate(-45deg);
}

@media (max-width: 960px) {
  .onboarding-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .onboarding-rail {
    padding-right: 24px;
  }

  .onboarding-main {
    padding-right: 36px;
    padding-left: 36px;
  }

  .request-path {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .path-node {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 0;
    padding: 16px 0;
  }

  .path-line {
    width: 1px;
    height: 18px;
    margin-left: 17px;
  }

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

  .setup-summary dl > div:nth-child(3) {
    padding-left: 0;
    border-top: 1px solid var(--rule-soft);
    border-left: 0;
  }

  .step-actions-final {
    flex-wrap: wrap;
  }

  .step-actions-final .button:last-child {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .onboarding-header {
    min-height: 64px;
    padding: 0 18px;
  }

  .save-status {
    display: none;
  }

  .onboarding-shell {
    display: block;
    min-height: calc(100vh - 64px);
  }

  .onboarding-rail {
    display: block;
    padding: 28px 20px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .rail-intro h1 {
    max-width: 18ch;
    font-size: 28px;
  }

  .rail-intro p {
    display: none;
  }

  .progress-list {
    grid-template-columns: repeat(4, minmax(60px, 1fr));
    gap: 6px;
    margin-top: 24px;
  }

  .progress-list::before {
    top: 7px;
    right: 7px;
    bottom: auto;
    left: 7px;
    width: auto;
    height: 1px;
  }

  .progress-list li::before,
  .progress-list li.is-active::before {
    top: 3px;
    left: calc(50% - 4px);
  }

  .progress-list button {
    min-height: 52px;
    padding: 20px 2px 0;
    text-align: center;
  }

  .progress-list small {
    display: none;
  }

  .progress-list span {
    font-size: 10px;
  }

  .onboarding-main {
    padding: 44px 20px 60px;
  }

  .step-copy h2,
  .onboarding-closed h2 {
    font-size: clamp(31px, 10vw, 42px);
  }

  .field-row,
  .workspace-map dl {
    grid-template-columns: 1fr;
  }

  .choice-list {
    grid-template-columns: 1fr;
  }

  .workspace-map dl > div:nth-child(even) {
    padding-left: 0;
    border-left: 0;
  }

  .step-outcome {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .step-actions,
  .step-actions-final,
  .skip-confirm,
  .skip-confirm > div:last-child {
    align-items: stretch;
    flex-direction: column;
  }

  .step-actions-split .button:last-child,
  .step-actions-final .button:last-child {
    margin-left: 0;
  }

  .step-actions .button,
  .skip-confirm .button {
    width: 100%;
  }

  .step-actions-split .button[data-back],
  .step-actions-final .button[data-back] {
    order: 3;
  }

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

  .page-message button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .onboarding-brand span {
    font-size: 15px;
  }

  .text-button {
    font-size: 12px;
  }

  .onboarding-rail,
  .onboarding-main {
    padding-right: 16px;
    padding-left: 16px;
  }

  .setup-summary dl {
    grid-template-columns: 1fr;
  }

  .setup-summary dl > div,
  .setup-summary dl > div:first-child,
  .setup-summary dl > div:nth-child(3) {
    padding: 16px 0;
    border-top: 0;
    border-left: 0;
  }

  .setup-summary dl > div + div {
    border-top: 1px solid var(--rule-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
