:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #fbfbfd;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --border: rgba(0, 0, 0, 0.1);
  --border-soft: rgba(0, 0, 0, 0.06);
  --accent: #0066cc;
  --accent-pressed: #004f9f;
  --warning-bg: #fff8e8;
  --warning-border: #ead7a3;
  --note-bg: #f5f8ff;
  --note-border: #c7d8f2;
  --tip-bg: #f2faf6;
  --tip-border: #b9dfc8;
  --code-bg: #f6f6f7;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --max: 1120px;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1c1c1e;
    --bg-elevated: #242426;
    --bg-soft: #2c2c2e;
    --text: #f5f5f7;
    --text-muted: #b9b9bf;
    --text-subtle: #8e8e93;
    --border: rgba(255, 255, 255, 0.14);
    --border-soft: rgba(255, 255, 255, 0.08);
    --accent: #64a8ff;
    --accent-pressed: #8fc0ff;
    --warning-bg: #302818;
    --warning-border: #6f5a29;
    --note-bg: #202735;
    --note-border: #405b80;
    --tip-bg: #1f2b24;
    --tip-border: #416f51;
    --code-bg: #2b2b2e;
    --shadow-soft: 0 16px 34px rgba(0, 0, 0, 0.22);
  }
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #fbfbfd;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --border: rgba(0, 0, 0, 0.1);
  --border-soft: rgba(0, 0, 0, 0.06);
  --accent: #0066cc;
  --accent-pressed: #004f9f;
  --warning-bg: #fff8e8;
  --warning-border: #ead7a3;
  --note-bg: #f5f8ff;
  --note-border: #c7d8f2;
  --tip-bg: #f2faf6;
  --tip-border: #b9dfc8;
  --code-bg: #f6f6f7;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1c1e;
  --bg-elevated: #242426;
  --bg-soft: #2c2c2e;
  --text: #f5f5f7;
  --text-muted: #b9b9bf;
  --text-subtle: #8e8e93;
  --border: rgba(255, 255, 255, 0.14);
  --border-soft: rgba(255, 255, 255, 0.08);
  --accent: #64a8ff;
  --accent-pressed: #8fc0ff;
  --warning-bg: #302818;
  --warning-border: #6f5a29;
  --note-bg: #202735;
  --note-border: #405b80;
  --tip-bg: #1f2b24;
  --tip-border: #416f51;
  --code-bg: #2b2b2e;
  --shadow-soft: 0 16px 34px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-pressed);
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-nav {
  width: min(100% - 40px, var(--max));
  min-height: var(--nav-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.nav-links a {
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 10px 11px;
  transition: background 160ms ease, color 160ms ease;
}

.nav-links a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.nav-links a.is-active {
  background: #eaf4ff;
  color: #0057b8;
  box-shadow: inset 0 0 0 1px #c7defa;
}

.nav-links a.is-active:hover {
  background: #ddecff;
  color: #004f9f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-links a.is-active {
    color: #111113;
  }

  :root:not([data-theme="light"]) .nav-links a.is-active:hover {
    color: #111113;
  }
}

[data-theme="dark"] .nav-links a.is-active,
[data-theme="dark"] .nav-links a.is-active:hover {
  color: #111113;
}

.theme-toggle,
.menu-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  min-width: 36px;
  height: 36px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.theme-toggle:hover,
.menu-toggle:hover {
  background: var(--bg-soft);
}

.theme-toggle {
  margin-left: 6px;
  font-size: 13px;
}

.download-button {
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff !important;
  font-weight: 600;
}

.download-button:hover {
  background: var(--accent-pressed) !important;
  border-color: var(--accent-pressed);
  color: #ffffff !important;
}

.menu-toggle {
  display: none;
}

.container {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

.hero {
  padding: 88px 0 56px;
  border-bottom: 1px solid var(--border-soft);
}

.hero-inner {
  width: min(100%, 780px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.hero h1,
.page-title {
  margin: 0;
  color: var(--text);
  font-family: "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0;
}

.hero p,
.page-lead {
  margin: 18px 0 0;
  max-width: 700px;
  color: var(--text-muted);
  font-size: 19px;
  line-height: 1.65;
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.doc-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.doc-status span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg-elevated);
  font-size: 15px;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

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

.button:hover {
  background: var(--bg-soft);
  color: var(--text);
}

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

.home-section {
  padding: 46px 0;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.section-heading p {
  margin: 0;
  color: var(--text-muted);
}

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

.card {
  display: block;
  min-height: 168px;
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
  color: var(--text);
}

.card-kicker {
  display: block;
  margin-bottom: 18px;
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 600;
}

.card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.card p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.search-panel {
  margin-top: 34px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.search-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.search-input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.task-list {
  display: grid;
  gap: 1px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border-soft);
}

.task-list a {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: var(--bg-elevated);
  color: var(--text);
}

.task-list a:hover {
  background: var(--bg-soft);
}

.task-list span {
  color: var(--text-muted);
  font-size: 14px;
}

.page-shell {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
  padding: 38px 0 72px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 54px;
}

.page-shell.manual-single {
  width: min(100% - 40px, 920px);
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow: auto;
  padding-right: 8px;
}

.sidebar-title {
  margin: 0 0 12px;
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.toc {
  display: grid;
  gap: 2px;
}

.toc a {
  display: block;
  border-left: 2px solid transparent;
  padding: 7px 0 7px 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
}

.toc a:hover,
.toc a.is-active {
  border-left-color: var(--accent);
  color: var(--text);
}

.doc-article {
  min-width: 0;
}

.breadcrumb {
  margin: 0 0 22px;
  color: var(--text-subtle);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--text-muted);
}

.page-header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.doc-article section {
  padding: 34px 0;
  border-bottom: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.doc-article section:last-of-type {
  border-bottom: 0;
}

.doc-article.manual-flow {
  padding-bottom: 32px;
}

.manual-flow .page-header {
  margin-bottom: 10px;
}

.manual-flow .page-title {
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

.manual-flow .page-lead {
  max-width: none;
  font-size: 16px;
  line-height: 1.65;
}

.manual-section {
  padding: 42px 0;
}

.manual-section + .manual-section {
  border-top: 1px solid var(--border-soft);
}

.manual-subsection {
  margin: 22px 0;
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.manual-subsection h3:first-child {
  margin-top: 0;
}

.manual-flow .lead-card {
  margin: 22px 0 0;
  padding: 22px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  background: var(--warning-bg);
}

.doc-article h2 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

.doc-article h3 {
  margin: 26px 0 10px;
  font-size: 20px;
  line-height: 1.35;
}

.doc-article p {
  margin: 12px 0;
  color: var(--text-muted);
}

.doc-article ul,
.doc-article ol {
  margin: 14px 0;
  padding-left: 22px;
  color: var(--text-muted);
}

.doc-article li + li {
  margin-top: 8px;
}

.doc-article strong {
  color: var(--text);
  font-weight: 600;
}

.doc-card,
.callout,
.code-note,
.figure-placeholder {
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}

.doc-card {
  margin: 18px 0;
  padding: 20px;
  background: var(--bg-elevated);
}

.doc-card h3:first-child {
  margin-top: 0;
}

.callout {
  margin: 18px 0;
  padding: 16px 18px;
}

.callout p {
  margin: 6px 0 0;
}

.callout-title {
  color: var(--text);
  font-weight: 700;
}

.callout.note {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.callout.tip {
  background: var(--tip-bg);
  border-color: var(--tip-border);
}

.callout.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.code-note {
  margin: 18px 0;
  padding: 16px 18px;
  background: var(--code-bg);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
}

.figure-placeholder {
  margin: 18px 0;
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px),
    var(--bg-elevated);
  background-size: 28px 28px;
  color: var(--text-subtle);
  text-align: center;
}

.figure-placeholder figcaption {
  max-width: 420px;
  font-size: 14px;
}

.manual-figure {
  margin: 18px 0 26px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.manual-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--bg);
}

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

.original-note {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--text-muted);
}

.steps {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  counter-reset: step;
  display: grid;
  gap: 12px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 16px 18px 16px 54px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 17px;
  top: 18px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

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

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  background: var(--bg-elevated);
}

td {
  color: var(--text-muted);
}

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

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  padding: 16px 18px;
  color: var(--text);
  font-weight: 600;
}

.faq-item p {
  margin: 0;
  padding: 0 18px 18px;
}

.pager {
  margin-top: 38px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.pager a {
  flex: 1;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
}

.pager span {
  display: block;
  color: var(--text-subtle);
  font-size: 13px;
}

.pager strong {
  display: block;
  margin-top: 3px;
}

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 28px 0;
  color: var(--text-subtle);
  font-size: 13px;
}

.footer-inner {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .nav-links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 14px 20px 22px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 14px 10px;
  }

  .theme-toggle {
    margin-left: 0;
  }

  .download-button {
    margin-left: 0;
  }

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

  .page-shell {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .sidebar {
    position: relative;
    top: auto;
    max-height: none;
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--bg-elevated);
  }

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

@media (max-width: 640px) {
  .site-nav,
  .container,
  .page-shell,
  .footer-inner {
    width: min(100% - 28px, var(--max));
  }

  .brand-name {
    max-width: 220px;
  }

  .hero {
    padding: 58px 0 38px;
  }

  .hero h1,
  .page-title {
    font-size: 38px;
  }

  .manual-flow .page-title {
    font-size: 30px;
  }

  .hero p,
  .page-lead {
    font-size: 17px;
  }

  .card-grid,
  .toc {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 6px;
  }

  .pager,
  .footer-inner,
  .task-list a {
    flex-direction: column;
  }
}

@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;
  }
}
