:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #1d2838;
  --muted: #637083;
  --line: #d8dee8;
  --brand: #1c6fb7;
  --brand-dark: #114f86;
  --brand-soft: #e8f2fb;
  --accent: #30a46c;
  --code: #172033;
  --shadow: 0 12px 30px rgba(22, 34, 51, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--brand-dark);
}

.site-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.menu-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.menu-button {
  display: none;
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 210px;
}

.brand strong {
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 520px;
  margin-left: auto;
}

.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfe;
  color: var(--ink);
}

.search-wrap svg {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}

.lang-switch button {
  min-width: 38px;
  height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.lang-switch button:last-child {
  border-right: 0;
}

.lang-switch button.active {
  background: var(--brand);
  color: #fff;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow: auto;
  background: #eef3f8;
  border-right: 1px solid var(--line);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tabs button {
  height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.nav-pane {
  display: none;
  padding: 12px 10px 28px;
}

.nav-pane.active {
  display: block;
}

.toc-list,
.toc-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 2px 0;
}

.toc-list ul {
  margin-left: 16px;
}

.toc-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: stretch;
}

.toc-toggle,
.toc-spacer {
  width: 22px;
  min-height: 32px;
}

.toc-toggle {
  position: relative;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.toc-toggle::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #58677a;
  transform: translateY(-50%) rotate(90deg);
  transition: transform 120ms ease;
}

.is-collapsed > .toc-row .toc-toggle::before {
  transform: translateY(-50%) rotate(0deg);
}

.is-collapsed > ul {
  display: none;
}

.toc-list a {
  display: block;
  padding: 7px 8px;
  border-radius: 4px;
  color: #2e3b4d;
  text-decoration: none;
  font-size: 0.9rem;
}

.toc-list a:hover,
.toc-list a.current {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: inset 3px 0 0 var(--brand);
}

.reference-pane {
  display: none;
  padding: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.reference-pane.active {
  display: block;
}

.content {
  min-width: 0;
  background: var(--panel);
}

.article-wrap {
  max-width: 980px;
  padding: 32px 48px 56px;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 18px;
}

.article-title {
  margin: 0 0 12px;
  color: #152135;
  font-size: 2rem;
  line-height: 1.2;
}

.lead {
  max-width: 760px;
  color: #455367;
  font-size: 1.05rem;
}

h2 {
  margin-top: 32px;
  padding-top: 6px;
  color: #263245;
  font-size: 1.35rem;
}

h3 {
  margin-top: 24px;
  color: #334155;
  font-size: 1.08rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}

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

th {
  background: #eef3f8;
}

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

code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #eef3f8;
}

pre {
  overflow: auto;
  padding: 14px;
  border-radius: 4px;
  background: var(--code);
  color: #f5f7fb;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.callout {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
}

.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  margin: 14px 0;
  padding-left: 42px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.tile {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  background: #fbfcfe;
}

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

.tile span {
  color: var(--muted);
  font-size: 0.92rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pager a {
  max-width: 46%;
  text-decoration: none;
  color: var(--brand-dark);
}

.footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-results {
  position: fixed;
  z-index: 40;
  top: 58px;
  right: 22px;
  width: min(520px, calc(100vw - 44px));
  max-height: 65vh;
  overflow: auto;
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.search-results.active {
  display: block;
}

.search-results a {
  display: block;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.search-results a:last-child {
  border-bottom: 0;
}

.search-results strong {
  display: block;
  color: var(--brand-dark);
}

.search-results span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 860px) {
  .menu-button {
    display: inline-flex;
  }

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

  .sidebar {
    position: fixed;
    z-index: 30;
    top: 64px;
    left: 0;
    width: min(320px, 88vw);
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: var(--shadow);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .article-wrap {
    padding: 26px 22px 42px;
  }

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

  .brand {
    min-width: 0;
  }

  .search-wrap {
    max-width: none;
  }

  .lang-switch button {
    min-width: 34px;
  }
}
