:root {
  --ink: #111827;
  --muted: #596273;
  --subtle: #7a8495;
  --line: #dce1e8;
  --surface: #f6f8fa;
  --surface-strong: #edf1f5;
  --white: #ffffff;
  --blue: #3266e8;
  --blue-dark: #244db5;
  --cyan: #16a8c7;
  --green: #159a74;
  --violet: #6857dc;
  --red: #c83e3a;
  --yellow: #b6780b;
  --header-height: 68px;
  --sidebar-width: 280px;
  --content-width: 860px;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 28px);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

body.menu-open,
body.toc-open {
  overflow: hidden;
}

a {
  color: var(--blue-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--blue);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  color: var(--white);
  background: var(--ink);
  border-radius: 4px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(1440px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 18px;
  flex: 0 0 30px;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.brand-mark::before {
  left: 0;
  background: var(--violet);
}

.brand-mark::after {
  right: 0;
  background: var(--cyan);
}

.brand-docs {
  color: var(--muted);
  font-weight: 500;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.primary-nav a {
  padding: 9px 12px;
  color: var(--muted);
  border-radius: 5px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
}

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

.icon-button,
.search-trigger,
.mobile-menu-button,
.mobile-toc-button {
  min-height: 40px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.search-trigger {
  min-width: 190px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.search-trigger kbd {
  padding: 1px 7px;
  color: var(--subtle);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
}

.mobile-menu-button,
.mobile-toc-button {
  display: none;
  width: 42px;
  padding: 0;
  align-items: center;
  justify-content: center;
  font-size: 21px;
}

.doc-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 56px;
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  padding: 32px 20px 48px 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.sidebar-label {
  margin: 0 0 10px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-group + .sidebar-group {
  margin-top: 28px;
}

.sidebar-nav {
  display: grid;
  gap: 3px;
}

.sidebar-nav a {
  padding: 8px 10px;
  color: var(--muted);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  font-weight: 570;
  line-height: 1.35;
  text-decoration: none;
}

.sidebar-nav a:hover {
  color: var(--ink);
  background: var(--surface);
}

.sidebar-nav a[aria-current="page"] {
  color: var(--blue-dark);
  background: #eef3ff;
  border-left-color: var(--blue);
  font-weight: 720;
}

.toc a.active {
  color: var(--blue-dark);
  border-left-color: var(--blue);
}

.doc-main {
  min-width: 0;
  padding: 58px 0 100px;
}

.doc-content {
  width: min(var(--content-width), 100%);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  color: var(--subtle);
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs span + span::before,
.breadcrumbs a + span::before {
  content: "/";
  margin-right: 8px;
  color: #b1b7c0;
}

.page-eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-header h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.03;
  letter-spacing: 0;
}

.page-lead {
  max-width: 760px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.55;
}

.page-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--subtle);
  font-size: 13px;
}

.content-section {
  margin-top: 72px;
}

.content-section h2,
.content-section h3 {
  position: relative;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.content-section h2 {
  margin: 0 0 22px;
  padding-top: 4px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
}

.content-section h3 {
  margin: 42px 0 15px;
  font-size: 23px;
  line-height: 1.25;
}

.content-section p,
.content-section li {
  color: #303949;
}

.content-section p {
  margin: 0 0 18px;
}

.content-section ul,
.content-section ol {
  margin: 18px 0 24px;
  padding-left: 24px;
}

.content-section li + li {
  margin-top: 9px;
}

.anchor-copy {
  position: absolute;
  left: -34px;
  top: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--subtle);
  background: transparent;
  border: 0;
  opacity: 0;
  transform: translateY(-50%);
}

h2:hover .anchor-copy,
h3:hover .anchor-copy,
.anchor-copy:focus {
  opacity: 1;
}

.module-grid {
  margin-top: 38px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.module-card {
  min-height: 250px;
  padding: 26px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 5px solid var(--blue);
  border-radius: 7px;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.module-card:nth-child(2) {
  border-top-color: var(--cyan);
}

.module-card:nth-child(3) {
  border-top-color: var(--green);
}

.module-card:hover {
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.module-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 22px;
}

.module-card p {
  margin: 0;
  color: var(--muted);
}

.module-card .card-link {
  display: inline-block;
  margin-top: 22px;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 750;
}

.flow {
  margin: 36px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 3px solid var(--line);
}

.flow-step {
  position: relative;
  padding: 34px 20px 0 0;
}

.flow-step::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  width: 17px;
  height: 17px;
  background: var(--blue);
  border: 4px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--blue);
}

.flow-step:nth-child(2)::before {
  background: var(--violet);
  box-shadow: 0 0 0 1px var(--violet);
}

.flow-step:nth-child(3)::before {
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

.flow-step:nth-child(4)::before {
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.flow-step b {
  display: block;
  margin-bottom: 7px;
}

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

.step-list {
  margin: 30px 0;
  padding: 0;
  list-style: none;
  counter-reset: docs-step;
}

.step-list > li {
  position: relative;
  min-height: 70px;
  margin: 0;
  padding: 0 0 32px 72px;
  counter-increment: docs-step;
}

.step-list > li::before {
  content: counter(docs-step, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--ink);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.step-list > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 52px;
  bottom: 4px;
  left: 23px;
  width: 1px;
  background: var(--line);
}

.step-list strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 18px;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 30px;
  margin: 26px 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  position: relative;
  margin: 0;
  padding: 0 0 0 24px;
}

.feature-list li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 50%;
}

.notice {
  margin: 28px 0;
  padding: 18px 20px;
  background: #eef3ff;
  border-left: 4px solid var(--blue);
  border-radius: 0 6px 6px 0;
}

.notice.warning {
  background: #fff8e8;
  border-left-color: var(--yellow);
}

.notice.success {
  background: #edf9f5;
  border-left-color: var(--green);
}

.notice.danger {
  background: #fff0ef;
  border-left-color: var(--red);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
}

.notice p:last-child,
.notice ul:last-child {
  margin-bottom: 0;
}

.screenshot-placeholder {
  margin: 32px 0;
  min-height: 280px;
  padding: 34px;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--surface);
  border: 2px dashed #bcc5d1;
  border-radius: 7px;
}

.screenshot-placeholder.compact {
  min-height: 190px;
}

.screenshot-placeholder strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 18px;
}

.screenshot-placeholder span {
  display: block;
  max-width: 620px;
  color: var(--muted);
}

.screenshot-placeholder code {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 8px;
  color: var(--blue-dark);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
}

.doc-image {
  margin: 32px 0;
}

.doc-image-link {
  display: block;
  color: inherit;
  cursor: zoom-in;
}

.doc-image img {
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.doc-image figcaption {
  margin-top: 10px;
  color: var(--subtle);
  font-size: 13px;
  text-align: center;
}

.table-wrap {
  margin: 26px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 13px 15px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
}

td {
  color: #303949;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.code-block {
  position: relative;
  margin: 26px 0;
  overflow: hidden;
  background: var(--ink);
  border-radius: 7px;
}

.code-block pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  color: #e8edf5;
  font-size: 14px;
  line-height: 1.6;
}

.inline-code {
  padding: 2px 6px;
  color: #2d4da1;
  background: #eef3ff;
  border-radius: 3px;
  font-size: 0.9em;
}

.checklist {
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 32px;
}

.checklist li::before {
  content: "✓";
  position: absolute;
  top: 1px;
  left: 0;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--green);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.page-navigation {
  margin-top: 80px;
  padding-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.page-navigation a {
  padding: 18px;
  color: var(--ink);
  background: var(--surface);
  border-radius: 6px;
  text-decoration: none;
}

.page-navigation a:last-child {
  text-align: right;
}

.page-navigation small {
  display: block;
  margin-bottom: 4px;
  color: var(--subtle);
}

.site-footer {
  margin-top: 80px;
  padding: 36px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 13px;
}

.footer-inner {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
}

.search-dialog {
  width: min(720px, calc(100% - 30px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(17, 24, 39, 0.25);
}

.search-dialog::backdrop {
  background: rgba(17, 24, 39, 0.58);
}

.search-head {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.search-head input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
}

.search-head input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 102, 232, 0.13);
}

.search-close {
  width: 46px;
  height: 46px;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 21px;
}

.search-results {
  max-height: 560px;
  padding: 10px;
  overflow-y: auto;
}

.search-empty {
  padding: 42px 22px;
  color: var(--muted);
  text-align: center;
}

.search-result {
  display: block;
  padding: 14px;
  color: var(--ink);
  border-radius: 5px;
  text-decoration: none;
}

.search-result:hover,
.search-result:focus {
  color: var(--ink);
  background: var(--surface);
}

.search-result strong,
.search-result span {
  display: block;
}

.search-result span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.search-result small {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

mark {
  color: inherit;
  background: #fff0a8;
}

.mobile-toc-bar {
  display: none;
}

.screen-overlay {
  display: none;
}

:focus-visible {
  outline: 3px solid rgba(50, 102, 232, 0.35);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .primary-nav {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: min(360px, 88vw);
    height: calc(100vh - var(--header-height));
    padding: 20px;
    display: none;
    align-content: start;
    background: var(--white);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  body.menu-open .primary-nav {
    display: grid;
  }

  .primary-nav a {
    padding: 13px 14px;
    font-size: 16px;
  }

  .mobile-menu-button {
    display: inline-flex;
    width: auto;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 700;
  }

  .search-trigger {
    min-width: 0;
    width: auto;
    padding: 0 12px;
    justify-content: center;
  }

  .search-trigger kbd {
    display: none;
  }
}

@media (max-width: 880px) {
  :root {
    --header-height: 62px;
  }

  .header-inner,
  .doc-shell,
  .footer-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .brand-docs {
    display: none;
  }

  .doc-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 90;
    width: min(340px, 88vw);
    height: calc(100vh - var(--header-height));
    padding: 24px;
    display: none;
    background: var(--white);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  body.toc-open .sidebar {
    display: block;
  }

  .mobile-toc-bar {
    position: sticky;
    top: var(--header-height);
    z-index: 70;
    margin: 0 -18px;
    padding: 10px 18px;
    display: flex;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
  }

  .mobile-toc-button {
    width: auto;
    padding: 0 12px;
    display: inline-flex;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
  }

  .doc-main {
    padding-top: 34px;
  }

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

  .module-card {
    min-height: 0;
  }

  .flow {
    grid-template-columns: 1fr 1fr;
    gap: 32px 18px;
    border-top: 0;
  }

  .flow-step {
    padding: 20px 12px 0 24px;
    border-left: 3px solid var(--line);
  }

  .flow-step::before {
    top: 24px;
    left: -10px;
  }

  .anchor-copy {
    display: none;
  }

  .screen-overlay {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 80;
    background: rgba(17, 24, 39, 0.45);
  }

  body.menu-open .screen-overlay,
  body.toc-open .screen-overlay {
    display: block;
  }
}

@media (max-width: 640px) {
  .header-inner {
    gap: 10px;
  }

  .header-actions {
    gap: 6px;
    margin-left: auto;
  }

  .search-trigger,
  .mobile-menu-button {
    min-height: 38px;
    padding: 0 9px;
    font-size: 13px;
  }

  .doc-content,
  .content-section,
  .notice,
  .table-wrap,
  .code-block {
    max-width: 100%;
  }

  .code-block pre {
    white-space: pre-wrap;
    word-break: break-word;
  }

  .page-header h1 {
    font-size: 40px;
  }

  .content-section {
    margin-top: 58px;
  }

  .content-section h2 {
    font-size: 30px;
  }

  .feature-list,
  .page-navigation {
    grid-template-columns: 1fr;
  }

  .page-navigation a:last-child {
    text-align: left;
  }

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

  .screenshot-placeholder {
    min-height: 220px;
    padding: 24px 18px;
  }

  .footer-inner {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .site-header,
  .sidebar,
  .mobile-toc-bar,
  .site-footer,
  .page-navigation,
  .anchor-copy,
  .search-dialog {
    display: none !important;
  }

  .doc-shell {
    display: block;
    padding: 0;
  }

  .doc-main,
  .doc-content {
    width: 100%;
    max-width: none;
    padding: 0;
  }

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

  .content-section,
  .notice,
  .table-wrap,
  .screenshot-placeholder {
    break-inside: avoid;
  }
}
