:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --ink: #262b43;
  --muted: #676a7b;
  --line: #e6e6e8;
  --accent: #666cff;
  --accent-dark: #5a5fe0;
  --accent-soft: rgba(102, 108, 255, 0.12);
  --warn: #9a3412;
  --warn-bg: #fff4ed;
  --ok: #166534;
  --ok-bg: #ecfdf3;
  --bad: #991b1b;
  --bad-bg: #fef2f2;
  --shadow: 0 0.25rem 1.125rem rgba(47, 43, 61, 0.08);
  --radius: 0.5rem;
  --sans: Inter, "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-size: 1.075rem;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: clip;
}
a { color: var(--accent-dark); }
code { font-family: var(--mono); font-size: 0.92em; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.75rem;
  background: #fff;
  border-bottom: 0;
  box-shadow: 0 1px 0 rgba(47, 43, 61, 0.06);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.logo {
  width: 2.9rem;
  height: 1.65rem;
  color: var(--accent);
  display: block;
  flex: none;
}
.brand-name { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.15rem; margin-left: auto; }
.lang-switch { margin-inline-start: 0.4rem; }
.lang-switch label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.lang-switch select { width: auto; padding: 0.35rem 0.5rem; }
html[dir="rtl"] .nav { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .hero, html[dir="rtl"] .feature { text-align: center; }
.nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 0.45rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  font-weight: 500;
}
.nav a.active, .nav a:hover { color: var(--accent); background: transparent; }
.nav-toggle {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.28rem;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 1.25rem;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.wrap { width: min(1140px, calc(100% - 2rem)); margin: 0 auto; padding: 0 0 3rem; }
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 1rem 2rem;
  background: #fff;
  border-top: 1px solid var(--line);
}

.hero {
  position: relative;
  text-align: center;
  max-width: 40rem;
  margin: 0 auto;
  padding: 5.5rem 0 3.5rem;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2rem -20vw auto;
  height: 28rem;
  background:
    radial-gradient(420px 220px at 18% 30%, rgba(102, 108, 255, 0.18), transparent 70%),
    radial-gradient(380px 200px at 82% 20%, rgba(255, 159, 67, 0.16), transparent 68%),
    radial-gradient(320px 180px at 60% 70%, rgba(40, 199, 111, 0.1), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0.3rem;
  background: linear-gradient(135deg, var(--accent), #9b8cff);
}
.hero h1 {
  color: var(--accent);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.16;
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
}
h1 { font-size: clamp(1.7rem, 3vw, 2.15rem); line-height: 1.2; margin: 0 0 0.75rem; letter-spacing: -0.03em; font-weight: 700; }
h2 { margin: 0 0 0.75rem; font-size: 1.15rem; letter-spacing: -0.02em; font-weight: 600; }
h3 { margin: 1.25rem 0 0.4rem; font-size: 1.05rem; }
.page-head { margin: 2.5rem 0 1.25rem; max-width: 46rem; }
.page-head p, .hero p { color: var(--muted); font-size: 1.05rem; font-weight: 500; }
.section-kicker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-kicker::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0.3rem;
  background: linear-gradient(135deg, var(--accent), #9b8cff);
}
.section-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0 0 1.75rem;
}
.section-title strong { font-size: 1.55rem; font-weight: 700; }
.feature-block { padding: 1rem 0 2rem; }

.hero-actions, .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.hero-actions { justify-content: center; }
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: white;
  border-radius: 0.375rem;
  padding: 0.7rem 1.35rem;
  font: inherit;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(102, 108, 255, 0.35);
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); box-shadow: none; }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); box-shadow: none; }
.text-link { font-weight: 600; text-decoration: none; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin: 0 0 1.5rem; }
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.4rem;
  box-shadow: var(--shadow);
}
.feature { text-align: center; padding: 1.6rem 1.3rem 1.5rem; }
.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.6rem;
  height: 4.6rem;
  margin: 0 auto 1rem;
  border-radius: 50rem;
  border: 2px solid color-mix(in srgb, #fff 68%, var(--accent));
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.2s ease;
}
.feature:hover .feature-icon { background: color-mix(in srgb, #fff 84%, var(--accent)); }
.feature p { margin-inline: auto; max-width: 34ch; }
.feature ul { text-align: left; display: inline-block; }
.card ul { margin: 0.4rem 0 0.8rem; padding-left: 1.1rem; color: var(--muted); }
.stack { display: grid; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 1rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; font-weight: 650; }
label.check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
input, select, textarea {
  font: inherit;
  font-weight: 450;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d1d0d4;
  border-radius: 0.375rem;
  padding: 0.65rem 0.75rem;
  width: 100%;
}
input[type="radio"],
input[type="checkbox"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}
textarea { resize: vertical; min-height: 12rem; font-family: var(--mono); font-size: 0.82rem; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(102, 108, 255, 0.28);
  border-color: var(--accent);
}
.hint, .meta { color: var(--muted); font-size: 0.92rem; }
.note, .alert {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.note { background: var(--accent-soft); color: var(--accent-dark); }
.alert { background: var(--warn-bg); color: var(--warn); }
.choices { display: flex; gap: 1rem; flex-wrap: wrap; }
.choices label { font-weight: 550; display: flex; align-items: center; gap: 0.4rem; }
.mode-switch {
  display: inline-flex;
  gap: 0.4rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem;
}
.mode-switch label { display: flex; gap: 0.45rem; align-items: center; padding: 0.35rem 0.8rem; font-weight: 650; white-space: nowrap; }
.choices label { display: flex; }

.rows { display: grid; gap: 0.8rem; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.6rem; align-items: center; }
.line-item { border-top: 1px dashed var(--line); padding-top: 0.9rem; }
.line-item:first-child { border-top: 0; padding-top: 0; }

.stat-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; }
.badge { border-radius: 999px; padding: 0.15rem 0.6rem; font-weight: 700; font-size: 0.85rem; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
pre.code {
  background: #241e38;
  color: #f4f0ff;
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.03em; text-transform: uppercase; }
.flow {
  background: #221c36;
  color: #f3efff;
  border-radius: 0;
  padding: 1rem 1.25rem 1.15rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  position: sticky;
  top: 4.6rem;
  z-index: 4;
}
.flow-canvas {
  --flow-scale: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: calc(0.4rem + 0.95rem * var(--flow-scale));
  overflow: visible;
  padding: 0.2rem calc(0.55rem + 1.45rem * var(--flow-scale)) 0.5rem;
  position: relative;
}
.flow-canvas.is-wrapped {
  flex-wrap: wrap;
  row-gap: calc(2rem + 0.8rem * var(--flow-scale));
}
.flow-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
.flow-link { fill: none; stroke: #433a62; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flow-link.is-ok { stroke: #4ade80; }
.flow-link.is-bad { stroke: #f87171; }
.flow-link.is-run {
  stroke: #c4b5fd;
  stroke-dasharray: 7 6;
  animation: flow-dash-path 0.7s linear infinite;
}
@keyframes flow-dash-path { to { stroke-dashoffset: -26; } }
.flow-step {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  position: relative;
  z-index: 1;
}
.flow-node {
  appearance: none;
  text-align: left;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  background: #2c2544;
  color: inherit;
  border: 1px solid #433a62;
  border-radius: calc(8px + 6px * var(--flow-scale));
  padding: calc(0.32rem + 0.38rem * var(--flow-scale)) calc(0.4rem + 0.35rem * var(--flow-scale));
  cursor: pointer;
  font: inherit;
  font-size: calc(0.52rem + 0.46rem * var(--flow-scale));
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  align-items: center;
  column-gap: 0.4em;
  row-gap: 0.12em;
}
.flow-node:hover, .flow-node.is-open { background: #362d54; }
.flow-node.is-run {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.32);
}
.flow-node.is-ok { border-color: #4ade80; }
.flow-node.is-bad { border-color: #f87171; }
.flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45em;
  height: 1.45em;
  margin-bottom: 0;
  border-radius: 999px;
  background: #433a62;
  color: #f3efff;
  font-size: 0.78em;
  font-weight: 700;
}
.flow-node.is-run .flow-num { background: #c4b5fd; color: #221c36; }
.flow-node.is-ok .flow-num { background: #4ade80; color: #14532d; }
.flow-node.is-bad .flow-num { background: #f87171; color: #450a0a; }
.flow-kicker {
  font-size: 0.72em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #b7abd4;
  white-space: nowrap;
}
.flow-node.is-run .flow-kicker { color: #ddd6fe; }
.flow-node.is-ok .flow-kicker { color: #4ade80; }
.flow-node.is-bad .flow-kicker { color: #fca5a5; }
.flow-node strong, .flow-sub { grid-column: 1 / -1; white-space: nowrap; }
.flow-node strong { font-size: 1.05em; }
.flow-sub { color: #ddd6f0; font-size: 0.82em; font-weight: 450; }
.flow-edge {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.flow-panel {
  display: none;
  margin-top: 0.85rem;
  background: #1a152c;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  max-height: 220px;
  overflow: auto;
  color: #efeaff;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.flow-panel.is-open { display: block; }

body.catalog-settled .page-head,
body.catalog-settled .note,
body.catalog-settled #cxml-form,
body.catalog-settled #oci-form,
body.catalog-settled .result { display: none; }
.catalog-stage[hidden] { display: none !important; }
.catalog-stage {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0 0 1.25rem;
  min-height: 70vh;
}
.catalog-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.catalog-url {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  word-break: break-all;
  flex: 1;
}
.catalog-cart-note {
  margin: 0;
  flex: 1;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}
body.is-framed .catalog-cart-note { display: none; }
.catalog-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.catalog-stage iframe {
  flex: 1;
  width: 100%;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
body.is-framed .topbar,
body.is-framed .flow,
body.is-framed .footer,
body.is-framed .page-head { display: none; }
body.is-framed .wrap { width: min(1080px, calc(100% - 1.2rem)); padding-top: 0.6rem; }

.steps ol { margin: 0; padding-left: 1.2rem; }
.toc { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.toc a {
  text-decoration: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}
.doc p, .doc li { max-width: 68ch; }
.product .price { font-size: 1.25rem; font-weight: 700; margin: 0.2rem 0; }
body.catalog-open .form-fold,
body.catalog-open #oci-form { display: none; }
.form-fold {
  margin: 0 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.form-fold > summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 700;
}
.form-fold > .stack { padding: 0 1rem 1rem; }
.form-fold:not([open]) > summary { border-radius: 16px; }
body.advanced-mode [data-panel="basic"] { display: none; }
body:not(.advanced-mode) [data-panel="advanced"] { display: none; }
#bill-fields.is-hidden { display: none; }

@media (max-width: 560px) {
  .flow {
    position: static;
    width: auto;
    margin-left: 0;
    margin-right: 0;
    border-radius: 18px;
  }
}

@media (max-width: 860px) {
  .cards, .grid-2, .row-3 { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  html[dir="rtl"] .nav-toggle { margin-left: 0; margin-right: auto; }
  .nav { display: none; width: 100%; }
  .nav.open { display: flex; }
  .topbar { flex-wrap: wrap; }
}
