:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --text: #111827;
  --muted: #5c6575;
  --line: #d9e0ea;
  --blue: #2f6fed;
  --green: #12805c;
  --amber: #b45309;
  --red: #b42318;
  --shadow: 0 18px 44px rgba(17, 24, 39, 0.09);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-mark {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  min-width: 320px;
}

.notice-band {
  width: min(1180px, calc(100vw - 32px));
  margin: 14px auto -8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 0.9rem;
}

.pilot-band {
  display: grid;
  grid-template-columns: minmax(320px, 0.48fr) minmax(260px, 0.28fr) minmax(260px, 0.24fr);
  align-items: center;
  gap: 22px;
  width: min(1180px, calc(100vw - 32px));
  margin: 22px auto 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pilot-copy h2 {
  max-width: 620px;
  font-size: 1.55rem;
}

.pilot-copy p {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.pilot-terms {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.pilot-terms strong {
  font-size: 1rem;
}

.pilot-terms span {
  color: var(--muted);
  line-height: 1.4;
}

.pilot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.setup-process-band {
  width: min(1180px, calc(100vw - 32px));
  margin: 22px auto;
  padding: 22px;
}

.setup-process-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-process-list li {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.setup-process-list strong {
  color: var(--text);
}

.setup-process-list span,
.setup-process-note {
  color: var(--muted);
  line-height: 1.45;
}

.setup-process-note {
  margin: 14px 0 0;
}

.setup-preview-band {
  display: grid;
  grid-template-columns: minmax(220px, 0.24fr) minmax(280px, 0.38fr) minmax(320px, 0.38fr);
  align-items: start;
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  margin: 18px auto 22px;
  padding: 20px 22px;
  box-shadow: none;
}

.setup-preview-items {
  display: grid;
  gap: 10px;
}

.setup-preview-items span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  line-height: 1.4;
}

.setup-preview-sample {
  display: grid;
  gap: 10px;
}

.setup-preview-sample pre {
  max-height: none;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

#network-status[data-state="error"] {
  color: var(--red);
}

#network-status[data-state="ok"] {
  color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.94fr) minmax(360px, 1.06fr);
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  margin: 22px auto;
  align-items: start;
}

.tool-panel,
.operator-band,
.demo-payment-band,
.router-gas-band,
.public-status-band,
.setup-preview-band,
.setup-request-panel,
.setup-process-band,
.launch-share-panel,
.setup-offer-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-panel {
  padding: 22px;
}

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

.section-heading.compact {
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.template-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.template-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.template-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.template-button:hover,
.template-button:focus {
  border-color: var(--blue);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  padding: 12px 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.split-fields,
.amount-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.action-row,
.payment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.is-disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button.secondary {
  background: var(--surface-strong);
  color: var(--text);
  border-color: var(--line);
}

.output-box {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.finish-setup-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.finish-setup-panel[hidden] {
  display: none;
}

.finish-setup-panel h3 {
  margin-bottom: 6px;
}

.finish-setup-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

.finish-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.output-box span,
.label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

code {
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

pre {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.checkout-summary {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.checkout-summary > div {
  display: grid;
  gap: 6px;
}

.checkout-summary strong {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.memo-text {
  min-height: 44px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.flow-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.flow-map div {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.flow-map span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
}

.flow-map p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.tx-log {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.tx-log ol {
  min-height: 42px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.tx-log li {
  margin-bottom: 6px;
}

.tx-log a {
  color: var(--blue);
  font-weight: 800;
}

.pending {
  color: var(--amber);
}

.setup-offer-band,
.demo-payment-band,
.router-gas-band,
.public-status-band,
.setup-process-band,
.setup-request-panel,
.launch-share-panel,
.operator-band {
  display: grid;
  width: min(1180px, calc(100vw - 32px));
}

.setup-offer-band,
.demo-payment-band,
.router-gas-band,
.public-status-band {
  grid-template-columns: minmax(220px, 0.36fr) minmax(260px, 0.38fr) minmax(300px, 0.26fr);
  align-items: center;
  gap: 20px;
  margin: 0 auto 18px;
  padding: 18px 22px;
  box-shadow: none;
}

.setup-offer-band p,
.demo-payment-band p,
.router-gas-band p,
.public-status-band p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.setup-actions,
.demo-payment-actions,
.router-gas-actions,
.public-status-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.public-status-links a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.operator-band {
  grid-template-columns: minmax(220px, 0.35fr) minmax(320px, 0.65fr);
  gap: 24px;
  margin: 0 auto 28px;
  padding: 20px 22px;
  box-shadow: none;
}

.setup-request-panel {
  gap: 16px;
  margin: 0 auto 18px;
  padding: 20px 22px;
  box-shadow: none;
}

.launch-share-panel {
  gap: 16px;
  margin: 0 auto 18px;
  padding: 20px 22px;
  box-shadow: none;
}

.launch-share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.launch-share-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recent-links {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.recent-link {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px minmax(120px, 150px);
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.recent-link:hover {
  border-color: var(--blue);
}

@media (max-width: 980px) {
  .pilot-band {
    grid-template-columns: 1fr;
  }

  .pilot-actions {
    justify-content: flex-start;
  }

  .setup-preview-band,
  .setup-process-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar,
  .status-strip,
  .brand-block {
    align-items: stretch;
  }

  .topbar {
    position: static;
    flex-direction: column;
  }

  .status-strip {
    min-width: 0;
    justify-content: space-between;
  }

  .workspace,
  .operator-band,
  .demo-payment-band,
  .router-gas-band,
  .public-status-band,
  .setup-preview-band,
  .setup-process-band,
  .setup-request-panel,
  .launch-share-panel,
  .setup-offer-band {
    grid-template-columns: 1fr;
  }

  .setup-actions,
  .demo-payment-actions,
  .router-gas-actions,
  .public-status-links {
    justify-content: flex-start;
  }

  .launch-share-actions {
    justify-content: flex-start;
  }

  .amount-grid,
  .flow-map,
  .recent-link {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .workspace,
  .pilot-band,
  .operator-band,
  .demo-payment-band,
  .router-gas-band,
  .public-status-band,
  .setup-preview-band,
  .setup-process-band,
  .setup-request-panel,
  .launch-share-panel,
  .setup-offer-band {
    width: min(100vw - 20px, 1180px);
  }

  .tool-panel,
  .operator-band,
  .demo-payment-band,
  .router-gas-band,
  .public-status-band,
  .setup-preview-band,
  .setup-process-band,
  .setup-request-panel,
  .launch-share-panel,
  .setup-offer-band {
    padding: 16px;
  }

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

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

  .finish-setup-panel {
    grid-template-columns: 1fr;
  }

  .status-strip,
  .action-row,
  .finish-actions,
  .payment-actions,
  .demo-payment-actions,
  .router-gas-actions,
  .launch-share-actions,
  .setup-actions,
  .pilot-actions,
  .template-strip {
    flex-direction: column;
  }

  .button,
  .template-button {
    width: 100%;
  }
}
