.setup-page {
  min-height: var(--desktop-stage-height, 100dvh);
  display: grid;
  grid-template-columns: minmax(320px, 392px) minmax(0, 1fr);
  background:
    radial-gradient(circle at top left, rgba(var(--theme-primary-rgb), 0.24), transparent 24rem),
    radial-gradient(circle at 36% 14%, rgba(var(--theme-primary-rgb), 0.16), transparent 18rem),
    linear-gradient(135deg, #04110d 0%, #0b1f18 26%, #10281f 26%, #eef5f1 26%, #f6fbf8 100%);
}

.setup-context {
  padding: 42px 28px 32px;
  color: rgba(255, 255, 255, 0.92);
  display: grid;
  align-content: start;
  gap: 22px;
  border-right: 1px solid rgba(110, 231, 183, 0.08);
  background: linear-gradient(180deg, rgba(4, 17, 13, 0.92), rgba(16, 40, 31, 0.9));
}

.setup-brand {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.setup-brand-mark {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
}

.setup-brand-ring {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--theme-primary-soft) 96%, white), rgba(var(--theme-primary-rgb), 0.58)),
    linear-gradient(145deg, rgba(var(--theme-primary-rgb), 0.4), rgba(var(--theme-primary-rgb), 0.6));
  box-shadow:
    0 18px 36px rgba(var(--theme-primary-rgb), 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.46);
  transform: rotate(-8deg);
}

.setup-brand-ring::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 14px;
  border: 1px solid rgba(var(--theme-primary-rgb), 0.22);
}

.setup-brand-core {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 32, 24, 0.92);
  color: var(--theme-primary-soft-strong);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.setup-kicker {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--theme-primary-soft) 86%, transparent);
}

.setup-kicker-light {
  color: color-mix(in srgb, var(--theme-primary-soft) 82%, transparent);
}

.setup-context h1 {
  color: #f8fafc;
  font-size: clamp(1.9rem, 2.4vw, 2.5rem);
  line-height: 1.08;
  text-shadow: 0 12px 36px rgba(2, 12, 8, 0.34);
}

.setup-lead {
  color: rgba(226, 232, 240, 0.84);
  font-size: 14px;
  line-height: 1.8;
}

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

.setup-nav-item {
  width: 100%;
  padding: 14px 14px 14px 12px;
  border: 1px solid rgba(var(--theme-primary-rgb), 0.14);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  background: linear-gradient(160deg, rgba(10, 18, 27, 0.82), rgba(16, 31, 43, 0.72));
  color: inherit;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.setup-nav-item:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--theme-primary-rgb), 0.28);
}

.setup-nav-item.is-active {
  border-color: rgba(var(--theme-primary-rgb), 0.4);
  box-shadow: 0 14px 28px rgba(3, 10, 7, 0.22);
}

.setup-nav-item.is-complete {
  background: linear-gradient(160deg, rgba(10, 25, 36, 0.96), rgba(20, 50, 68, 0.86));
}

.setup-nav-index {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--theme-primary-rgb), 0.16);
  color: var(--theme-primary-soft-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.setup-nav-copy {
  display: grid;
  gap: 4px;
}

.setup-nav-copy strong {
  color: var(--theme-primary-soft);
  font-size: 14px;
}

.setup-nav-copy small {
  color: color-mix(in srgb, var(--theme-primary-soft) 72%, transparent);
  font-size: 12px;
  line-height: 1.55;
}

.setup-nav-check {
  color: #6ee7b7;
  font-size: 14px;
}

.setup-progress {
  margin-top: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(110, 231, 183, 0.14);
  border-radius: 8px;
  background: rgba(7, 33, 25, 0.76);
}

.setup-progress strong {
  color: var(--theme-primary-soft);
  font-size: 15px;
}

.setup-progress p {
  margin-top: 8px;
  color: color-mix(in srgb, var(--theme-primary-soft) 72%, transparent);
  font-size: 13px;
  line-height: 1.65;
}

.setup-complete {
  margin-top: auto;
  padding: 16px 18px 0;
  border-top: 1px solid rgba(110, 231, 183, 0.12);
  display: grid;
  gap: 12px;
}

.setup-complete p {
  color: color-mix(in srgb, var(--theme-primary-soft) 76%, transparent);
  font-size: 13px;
  line-height: 1.6;
}

.setup-complete-btn {
  width: 100%;
}

.setup-complete-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--theme-primary-soft) 86%, transparent);
  font-size: 13px;
  line-height: 1.5;
}

.setup-panel {
  padding: 36px;
  display: grid;
  align-content: start;
  gap: 24px;
  background:
    radial-gradient(circle at top left, rgba(var(--theme-primary-rgb), 0.08), transparent 16rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
}

.setup-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid rgba(var(--theme-primary-rgb), 0.14);
  border-radius: 8px;
  background: linear-gradient(135deg, #063b2e, #0f5f49);
  box-shadow: 0 16px 34px rgba(6, 59, 46, 0.16);
}

.setup-panel-head h2 {
  color: #ffffff;
  font-size: 28px;
}

.setup-panel-desc {
  margin-top: 10px;
  color: rgba(236, 253, 245, 0.82);
  font-size: 14px;
  line-height: 1.65;
}

.setup-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--theme-primary-soft-strong);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--theme-primary-soft) 18%, transparent);
}

.setup-chip.is-success {
  background: rgba(var(--theme-primary-rgb), 0.22);
}

.setup-form {
  padding: 30px 32px;
  border: 1px solid rgba(var(--theme-primary-rgb), 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(244, 255, 248, 0.98), rgba(255, 255, 255, 0.94));
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  backdrop-filter: blur(14px);
}

.setup-stage {
  display: grid;
  gap: 22px;
}

.section-head {
  display: grid;
  gap: 6px;
}

.section-head h3 {
  color: #065f46;
  font-size: 18px;
}

.section-head p {
  color: #5b6f67;
  font-size: 13px;
  line-height: 1.7;
}

.field-grid {
  display: grid;
  gap: 16px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: #244239;
  font-size: 13px;
  font-weight: 600;
}

.field-note {
  color: #5f7c72;
  font-size: 12px;
  line-height: 1.5;
}

.field-group-note {
  margin-top: -6px;
  color: #5f7c72;
  font-size: 12px;
  line-height: 1.6;
}

.optional-block {
  padding: 18px 18px 0;
  border: 1px dashed rgba(var(--theme-primary-rgb), 0.22);
  border-radius: 8px;
  background: rgba(240, 253, 244, 0.52);
}

.optional-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.optional-block-head strong {
  color: #065f46;
  font-size: 14px;
}

.optional-block-head span {
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(var(--theme-primary-rgb), 0.12);
  color: var(--theme-primary-active);
  font-size: 12px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.field input:hover {
  transform: translateY(-1px);
}

.field input:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 4px var(--theme-focus-ring);
}

.field-span-2 {
  grid-column: span 2;
}

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

.setup-runtime article {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid rgba(110, 231, 183, 0.14);
  display: grid;
  gap: 10px;
  box-shadow: 0 14px 32px rgba(3, 10, 7, 0.2);
}

.setup-runtime article::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--theme-primary-soft) 92%, transparent), rgba(var(--theme-primary-rgb), 0.48));
}

.setup-runtime article:nth-child(1) {
  background: linear-gradient(150deg, rgba(7, 33, 25, 0.96), rgba(16, 67, 52, 0.9));
}

.setup-runtime article:nth-child(2) {
  background: linear-gradient(150deg, rgba(7, 28, 26, 0.96), rgba(11, 59, 61, 0.9));
}

.setup-runtime article:nth-child(3) {
  background: linear-gradient(150deg, rgba(16, 28, 19, 0.96), rgba(48, 74, 36, 0.9));
}

.setup-runtime span {
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(167, 243, 208, 0.7);
}

.setup-runtime strong {
  color: #f8fffb;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  text-shadow: 0 2px 16px rgba(4, 9, 7, 0.22);
}

.setup-error {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  white-space: pre-line;
}

.setup-status {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 8px;
  white-space: pre-line;
}

.setup-status.is-success {
  border: 1px solid rgba(var(--theme-primary-rgb), 0.18);
  background: var(--success-soft);
  color: var(--success-active);
}

.setup-status.is-danger {
  border: 1px solid rgba(239, 68, 68, 0.18);
  background: #fef2f2;
  color: #b91c1c;
}

.setup-gate {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  background: #fffbeb;
  color: #b45309;
}

.setup-actions {
  margin-top: 28px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.setup-actions-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-btn {
  background: var(--theme-gradient-primary);
  color: #fff;
  box-shadow: 0 14px 28px rgba(var(--theme-primary-rgb), 0.24);
}

.secondary-btn {
  background: rgba(240, 253, 244, 0.94);
  color: #1f4f41;
  border-color: rgba(var(--theme-primary-rgb), 0.18);
}

.secondary-btn-strong {
  background: linear-gradient(135deg, rgba(var(--theme-primary-rgb), 0.14), rgba(var(--theme-primary-rgb), 0.12));
  color: #065f46;
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.setup-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(3, 20, 15, 0.72);
  backdrop-filter: blur(10px);
}

.setup-startup-modal {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(110, 231, 183, 0.22);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  background:
    radial-gradient(circle at top right, rgba(var(--theme-primary-rgb), 0.16), transparent 18rem),
    linear-gradient(180deg, #05251d 0%, #081611 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

.setup-startup-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.setup-startup-head h2 {
  margin-top: 4px;
  color: #ffffff;
  font-size: 22px;
}

.setup-startup-head span {
  display: block;
  margin-top: 8px;
  color: color-mix(in srgb, var(--theme-primary-soft) 78%, transparent);
  font-size: 13px;
  line-height: 1.6;
}

.setup-startup-spinner {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(110, 231, 183, 0.26);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #a7f3d0;
  background: rgba(6, 78, 59, 0.34);
}

.setup-startup-spinner .mdi {
  font-size: 22px;
}

.setup-startup-spinner strong {
  color: #ffffff;
  font-size: 20px;
}

.setup-startup-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(460px, 1.14fr);
  gap: 18px;
}

.setup-startup-steps {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.setup-startup-step {
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  background: rgba(15, 23, 42, 0.24);
}

.setup-startup-step .mdi {
  margin-top: 2px;
  color: color-mix(in srgb, var(--theme-primary-soft) 46%, transparent);
}

.setup-startup-step strong {
  color: #f8fffb;
  font-size: 14px;
}

.setup-startup-step span {
  display: block;
  margin-top: 4px;
  color: color-mix(in srgb, var(--theme-primary-soft) 68%, transparent);
  font-size: 12px;
  line-height: 1.5;
}

.setup-startup-step.is-running {
  border-color: rgba(59, 130, 246, 0.34);
}

.setup-startup-step.is-running .mdi {
  color: #93c5fd;
}

.setup-startup-step.is-success {
  border-color: rgba(var(--theme-primary-rgb), 0.32);
}

.setup-startup-step.is-success .mdi {
  color: var(--theme-primary-light-5);
}

.setup-startup-step.is-error {
  border-color: rgba(248, 113, 113, 0.36);
}

.setup-startup-step.is-error .mdi {
  color: #f87171;
}

.setup-startup-console {
  min-height: 0;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(2, 6, 23, 0.42);
}

.setup-startup-console-head {
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(15, 23, 42, 0.5);
}

.setup-startup-console-head strong {
  color: #e2e8f0;
  font-size: 13px;
}

.setup-startup-console-head span {
  color: rgba(148, 163, 184, 0.9);
  font-size: 12px;
}

.setup-startup-log {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  color: rgba(226, 232, 240, 0.84);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .setup-page {
    grid-template-columns: 1fr;
    background:
      radial-gradient(circle at top right, rgba(var(--theme-primary-rgb), 0.2), transparent 22rem),
      linear-gradient(180deg, #04110d 0%, #10281f 36%, #eef5f1 36%, #f6fbf8 100%);
  }

  .setup-context,
  .setup-panel {
    padding: 28px 24px;
  }

  .setup-complete {
    padding-inline: 0;
  }
}

@media (max-width: 820px) {
  .field-grid-2,
  .setup-runtime {
    grid-template-columns: 1fr;
  }

  .setup-modal-backdrop {
    padding: 14px;
  }

  .setup-startup-modal {
    max-height: calc(100vh - 28px);
    padding: 18px;
  }

  .setup-startup-head {
    align-items: center;
  }

  .setup-startup-body {
    grid-template-columns: 1fr;
  }

  .setup-startup-steps,
  .setup-startup-console {
    max-height: none;
  }

  .setup-startup-log {
    max-height: 260px;
  }

  .field-span-2 {
    grid-column: auto;
  }

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

  .setup-actions-right {
    width: 100%;
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}
