:root {
  --bg: #f5f7f4;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --ink: #101828;
  --muted: #5f6b7a;
  --line: rgba(16, 24, 40, 0.08);
  --line-strong: rgba(16, 24, 40, 0.13);
  --accent: #15803d;
  --accent-strong: #166534;
  --accent-soft: rgba(21, 128, 61, 0.1);
  --warning: #b45309;
  --danger: #b91c1c;
  --success: #166534;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.06);
  --radius: 24px;
  --radius-sm: 16px;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "IBM Plex Sans", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    linear-gradient(rgba(16, 24, 40, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 40, 0.04) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(21, 128, 61, 0.12), transparent 26%),
    linear-gradient(180deg, #fafcf9 0%, var(--bg) 100%);
  background-size: 24px 24px, 24px 24px, auto, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(21, 128, 61, 0.28);
  text-underline-offset: 3px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.inline-link:hover {
  color: var(--accent-strong);
  text-decoration-color: rgba(22, 101, 52, 0.5);
}

button,
input,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
}

.eyebrow,
.section-kicker,
.caption {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand-title,
.hero h2,
.section-head h3 {
  margin: 8px 0 0;
}

.brand-title {
  font-size: 28px;
}

.topbar-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.nav-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.topbar-nav .nav-link:hover {
  color: var(--ink);
}

.main-layout {
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 28px;
}

.hero {
  overflow: hidden;
}

.workflow-shell {
  display: grid;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
}

.workflow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.workflow-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workflow-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
}

.workflow-head .section-note {
  max-width: none;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.4;
  color: #667085;
}

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

.step-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.step-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(16, 24, 40, 0.14);
}

.step-tab.active {
  border-color: rgba(21, 128, 61, 0.22);
  background: linear-gradient(180deg, rgba(21, 128, 61, 0.05), #ffffff);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.04);
}

.step-tab.completed .step-index {
  background: rgba(21, 128, 61, 0.1);
  color: var(--accent);
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f3f5f2;
  color: #667085;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.step-meta {
  display: grid;
  gap: 0;
}

.step-meta strong {
  font-size: 13px;
  line-height: 1.35;
}

.step-meta small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.step-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  min-height: var(--step-panel-height, auto);
}

.step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.step-footer-meta {
  color: var(--muted);
  font-size: 14px;
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.hero-copy-block {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-self: start;
  padding-top: 4px;
}

.hero h2 {
  max-width: 640px;
  font-size: clamp(26px, 2.8vw, 38px);
  line-height: 1.12;
  margin-bottom: 10px;
}

.hero-copy {
  max-width: 660px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  margin-top: 0;
  margin-bottom: 14px;
}

.hero-visual {
  display: grid;
  gap: 16px;
  align-self: stretch;
}

.hero-terminal {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  background: #101a13;
}

.hero-terminal-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
}

.hero-terminal-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.hero-terminal-body {
  padding: 18px 20px 22px;
  color: #d6f4dc;
}

.hero-terminal-title {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #91d7a5;
}

.hero-terminal pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}

.hero-actions,
.export-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
.text-button {
  cursor: pointer;
  border: 0;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
}

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

.button.primary:hover {
  background: var(--accent-strong);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid var(--line);
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.hero-inline-points {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  color: #344054;
  font-size: 14px;
}

.hero-inline-points .divider {
  color: rgba(52, 64, 84, 0.42);
}

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

.section-note {
  max-width: 420px;
  color: var(--muted);
  margin: 0;
}

#routing .section-note {
  max-width: none;
  white-space: nowrap;
  font-size: 13px;
}

.import-grid,
.routing-layout,
.export-layout {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.import-grid,
.export-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: stretch;
}

.routing-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
}

.input-card,
.stack-card,
.summary-card,
.preview-card,
.guide-card,
.group-card {
  background: var(--panel-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.input-card-flex {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.card-head h4,
.stack-card h4,
.summary-card h4,
.guide-card h4 {
  margin: 0;
}

.raw-textarea,
.field input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(16, 24, 40, 0.14);
  background: #ffffff;
}

.raw-textarea {
  min-height: 280px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
  font-family: var(--mono);
  font-size: 13px;
  flex: 1 1 auto;
}

.status-wrap {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-wrap-bottom,
.helper-text-bottom {
  margin-top: auto;
}

.status-wrap-bottom,
.helper-text-bottom {
  min-height: 52px;
  display: flex;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  width: fit-content;
  font-size: 13px;
  font-weight: 600;
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.16);
  color: #334155;
}

.badge-success {
  background: rgba(22, 101, 52, 0.12);
  color: var(--success);
}

.badge-warning {
  background: rgba(180, 83, 9, 0.12);
  color: var(--warning);
}

.badge-danger {
  background: rgba(185, 28, 28, 0.1);
  color: var(--danger);
}

.status-message,
.helper-text,
.caption {
  color: var(--muted);
}

.status-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.helper-text {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

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

.normalized-stack {
  display: flex;
  flex: 1 1 auto;
  gap: 0;
}

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

.normalized-grid {
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbf8);
  width: 100%;
  height: 100%;
  align-content: start;
}

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

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

.field span {
  font-size: 13px;
  color: #334155;
}

.field input {
  min-height: 40px;
  padding: 0 12px;
}

.field-type input[readonly] {
  background: #f3f5f7;
  color: #475467;
}

.field-toggle {
  align-items: center;
  grid-template-columns: 1fr auto;
  padding-top: 21px;
}

.field-udp-row {
  min-height: 40px;
}

.field-name {
  grid-column: 1 / span 1;
}

.field-type {
  grid-column: 2 / span 1;
}

.field-udp-row {
  grid-column: 3 / span 1;
}

.field-server {
  grid-column: 1 / span 2;
}

.field-port {
  grid-column: 3 / span 1;
}

.field-user {
  grid-column: 1 / span 1;
}

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

.field-readonly input {
  background: #f3f5f7;
}

.switch {
  position: relative;
  width: 56px;
  height: 32px;
  display: inline-flex;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.4);
  transition: background-color 180ms ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  top: 4px;
  left: 4px;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.15);
  transition: transform 180ms ease;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.choice-grid,
.mode-list,
.selection-groups,
.guide-grid {
  display: grid;
  gap: 14px;
}

.choice-list {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

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

.selection-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 0;
  padding: 2px 0;
  cursor: pointer;
  background: transparent;
  white-space: nowrap;
  flex: 0 0 auto;
}

.selection-option input,
.item-row input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
}

.group-card .subtle,
.guide-card p {
  color: var(--muted);
  line-height: 1.55;
}

.mode-list {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.choice-card,
.mode-card,
.item-row {
  min-width: fit-content;
  min-height: 24px;
}

.option-label {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  color: #344054;
}

.routing-panel {
  display: grid;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbf8);
  padding: 8px 16px;
  min-height: 0;
}

.routing-section {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 0;
}

.routing-section + .routing-section,
.routing-section + .routing-helper,
.selection-groups + .routing-helper {
  border-top: 1px solid rgba(16, 24, 40, 0.08);
}

.routing-section h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  padding-top: 7px;
}

.routing-helper {
  margin: 0;
  padding: 14px 0 8px 148px;
}

.selection-groups {
  grid-template-columns: 1fr;
  gap: 0;
}

.selection-groups.is-disabled {
  opacity: 0.74;
  filter: saturate(0.9);
}

.routing-row-body {
  display: grid;
  gap: 8px;
}

.group-items {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.routing-dynamic-area {
  display: grid;
  gap: 0;
}

.routing-global-note {
  padding: 14px 0;
}

.item-label {
  white-space: nowrap;
}

.selection-option.selected .option-label,
.selection-option:has(input:checked) .option-label {
  color: var(--accent);
}

.summary-list {
  display: grid;
  gap: 0;
  margin: 0 0 18px;
}

.summary-card,
.preview-card {
  display: flex;
  flex-direction: column;
}

.summary-card h4,
.preview-card h4 {
  margin-bottom: 10px;
}

.summary-item {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
}

.summary-item:first-child {
  border-top: 0;
  padding-top: 4px;
}

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

.summary-value {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  text-align: right;
  color: #1f2937;
}

.export-actions {
  margin-top: auto;
  padding-top: 4px;
}

.yaml-preview {
  margin: 0;
  min-height: 332px;
  max-height: 420px;
  overflow: auto;
  border-radius: 18px;
  background: #0f1720;
  color: #daf6e5;
  padding: 16px;
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--mono);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.guide-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
  align-content: start;
}

.guide-card {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 248, 0.98));
  position: relative;
}

.guide-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, rgba(21, 128, 61, 0.8), rgba(21, 128, 61, 0.2));
}

.guide-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(21, 128, 61, 0.1);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.guide-card h4 {
  font-size: 15px;
  line-height: 1.35;
}

.guide-card p {
  margin: 0;
  font-size: 14px;
}

.guide-card ul {
  margin: 0;
  padding-left: 17px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

@media (max-width: 1120px) {
  .import-grid,
  .export-layout,
  .guide-grid,
  .routing-layout,
  .hero-content {
    grid-template-columns: 1fr;
  }

  .routing-section {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .routing-helper {
    padding-left: 126px;
  }

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

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

  .field-name,
  .field-type,
  .field-udp-row,
  .field-server,
  .field-port,
  .field-user,
  .field-password {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding-top: 14px;
    padding-bottom: 32px;
  }

  .topbar {
    flex-direction: column;
    gap: 12px;
  }

  .panel {
    padding: 16px;
  }

  .topbar-nav,
  .hero-visual,
  .hero-inline-points {
    display: none;
  }

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

  .hero {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hero-copy-block {
    padding-top: 0;
  }

  .hero h2 {
    max-width: none;
    font-size: 22px;
    line-height: 1.12;
    margin-bottom: 8px;
  }

  .hero-copy {
    max-width: none;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
  }

  .hero-inline-points {
    gap: 8px;
    font-size: 13px;
    line-height: 1.6;
  }

  .hero-terminal {
    border-radius: 18px;
  }

  .hero-terminal-body {
    padding: 14px 16px 18px;
  }

  .hero-terminal pre {
    font-size: 12px;
  }

  .workflow-shell {
    gap: 16px;
  }

  .workflow-head,
  .section-head,
  .step-footer {
    align-items: flex-start;
  }

  .workflow-head > div {
    align-items: flex-start;
  }

  .workflow-head .section-note {
    white-space: normal;
  }

  .workflow-shell {
    gap: 14px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .step-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding-bottom: 0;
    overflow: visible;
  }

  .step-panel {
    grid-template-rows: auto;
    min-height: auto;
  }

  .step-tab {
    min-width: 0;
    width: 100%;
    padding: 9px 8px;
    gap: 0;
    border-radius: 12px;
    justify-content: center;
  }

  .step-index {
    display: none;
  }

  .step-meta strong {
    font-size: 12px;
    text-align: center;
  }

  .step-meta small {
    display: none;
  }

  .step-meta {
    width: 100%;
    justify-items: center;
  }

  .section-note {
    max-width: none;
    font-size: 14px;
  }

  #routing .section-note {
    white-space: normal;
  }

  .status-wrap {
    align-items: flex-start;
  }

  .import-grid,
  .export-layout,
  .guide-grid,
  .routing-layout {
    grid-template-columns: 1fr;
  }

  .routing-panel {
    padding: 8px 14px;
  }

  .routing-section {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .routing-section h4 {
    padding-top: 0;
  }

  .routing-helper {
    padding-left: 0;
  }


  .raw-textarea {
    min-height: 240px;
    font-size: 12px;
  }

  .input-card,
  .stack-card,
  .summary-card,
  .preview-card,
  .guide-card,
  .group-card {
    padding: 14px;
  }

  .card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

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

  .compact-grid {
    grid-template-columns: 1fr;
  }

  .inline-actions,
  .hero-actions,
  .group-actions,
  .export-actions {
    width: 100%;
  }

  .inline-actions .text-button,
  .group-actions .text-button {
    min-height: 36px;
  }

  .hero-actions .button,
  .export-actions .button,
  .step-footer .button {
    width: 100%;
  }

  .step-footer {
    flex-direction: column;
    gap: 12px;
  }

  .step-footer-meta {
    font-size: 13px;
  }

  .mode-list,
  .group-items {
    gap: 10px;
  }

  .yaml-preview {
    min-height: 280px;
    max-height: 360px;
    padding: 14px;
    font-size: 12px;
  }

  .summary-item {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 10px 0;
  }

  .summary-value {
    text-align: left;
  }

  .guide-card ul {
    padding-left: 16px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

}
