:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-muted: #f1f5f3;
  --ink: #161a1d;
  --muted: #5f686f;
  --line: #d9dfdd;
  --accent: #0f766e;
  --accent-soft: #dff4ef;
  --amber: #b45309;
  --amber-soft: #fff3d6;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --shadow: 0 16px 40px rgba(22, 26, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body.has-open-drawer {
  overflow: hidden;
}

a {
  color: inherit;
}

svg {
  display: block;
  height: 20px;
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 100;
  transform: translateY(-140%);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  text-decoration: none;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(180px, 280px) minmax(260px, 620px) auto;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 0 24px;
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 12px;
  font-weight: 800;
}

.brand-mark-fallback {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
  padding: 0;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-title,
.brand-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title {
  font-size: 15px;
  font-weight: 760;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.icon-button,
.text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.text-button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
}

.icon-button:hover,
.text-button:hover {
  border-color: #aeb9b5;
  background: var(--surface-muted);
}

.mobile-menu-button {
  display: none;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
  padding: 0 14px;
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  max-height: min(440px, calc(100vh - 100px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 6px;
}

.search-result {
  display: grid;
  gap: 3px;
  border-radius: 6px;
  padding: 10px;
  text-decoration: none;
}

.search-result:hover {
  background: var(--surface-muted);
}

.search-result strong {
  font-size: 14px;
}

.search-result span,
.search-result p,
.search-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 260px;
  max-width: 1560px;
  margin: 0 auto;
}

.sidebar {
  border-right: 1px solid var(--line);
}

.sidebar-inner {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow: auto;
  padding: 24px 18px;
}

.version-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.panel-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.version-panel strong {
  font-size: 14px;
}

.version-panel span:last-of-type {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.version-panel dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 0;
}

.version-panel dl div {
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 8px;
}

.version-panel dt {
  color: var(--muted);
  font-size: 11px;
}

.version-panel dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.docs-nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-section {
  border-radius: 8px;
}

.nav-section-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 4px;
}

.nav-section-row-simple {
  grid-template-columns: minmax(0, 1fr);
}

.nav-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  border-radius: 8px;
  color: var(--muted);
  min-height: 38px;
  padding: 9px 8px 9px 10px;
  text-decoration: none;
}

.nav-link span {
  font-size: 11px;
  font-weight: 800;
}

.nav-link strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.nav-toggle:hover {
  background: var(--surface-muted);
  color: var(--accent);
}

.nav-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.nav-toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.nav-link:hover,
.nav-section.is-active > .nav-section-row .nav-link {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-subsections {
  display: grid;
  gap: 2px;
  padding: 2px 0 7px 52px;
}

.nav-subsections[hidden] {
  display: none;
}

.nav-subsection-link {
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 8px 6px 10px;
  text-decoration: none;
}

.nav-subsection-link:hover {
  border-left-color: var(--accent);
  color: var(--accent);
}

.main-content {
  min-width: 0;
  padding: 34px 54px 64px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin: 0 auto 22px;
  max-width: 840px;
}

.breadcrumb a {
  text-decoration: none;
}

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

.doc-article {
  max-width: 840px;
  margin: 0 auto;
}

.article-header {
  margin-bottom: 28px;
  padding-bottom: 24px;
}

.article-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 10px;
}

.article-header h1 {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
  margin: 0;
}

.article-lead {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
  margin-top: 18px;
}

.article-lead p {
  margin: 0;
}

.article-body {
  font-size: 16px;
  line-height: 1.8;
}

.content-heading {
  color: var(--ink);
  scroll-margin-top: 96px;
}

.content-h3 {
  font-size: 25px;
  line-height: 1.22;
  margin: 34px 0 14px;
}

.content-h4,
.content-h5,
.content-h6 {
  font-size: 18px;
  margin: 28px 0 10px;
}

.content-paragraph {
  margin: 14px 0;
}

.content-list {
  margin: 14px 0;
  padding-left: 24px;
}

.content-list li {
  margin: 8px 0;
  padding-left: 2px;
}

.content-link {
  color: var(--accent);
  font-weight: 650;
  text-underline-offset: 3px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin: 20px 0;
}

.content-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}

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

.content-table th {
  background: var(--surface-muted);
  font-weight: 800;
}

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

.callout {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  margin: 20px 0;
  padding: 14px 16px;
}

.callout-warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout-danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.callout-success {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.component-cards {
  margin: 20px 0;
}

.component-cards .content-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.component-cards li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin: 0;
  padding: 14px;
}

.toc {
  border-left: 1px solid var(--line);
}

.toc-inner {
  position: sticky;
  top: 68px;
  padding: 28px 18px;
}

.toc nav {
  display: grid;
  gap: 3px;
  margin-top: 12px;
}

.toc a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  padding: 7px 8px;
  text-decoration: none;
}

.toc a:hover,
.toc a.is-active {
  background: var(--surface-muted);
  color: var(--accent);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 840px;
  margin: 44px auto 0;
}

.pager-link {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  text-decoration: none;
}

.pager-link:hover {
  border-color: var(--accent);
}

.pager-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pager-link strong {
  font-size: 15px;
}

.pager-next {
  text-align: right;
}

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.mobile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 26, 29, 0.44);
}

.mobile-panel {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(390px, 88vw);
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mobile-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.mobile-panel-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 760;
}

.mobile-search {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.mobile-panel .docs-nav {
  overflow: auto;
  margin: 0;
  padding: 12px;
}

.not-found {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 18px;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px;
}

.not-found h1 {
  margin: 0;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0 14px;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .topbar-search {
    display: none;
  }

  .brand-subtitle {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .layout {
    display: block;
  }

  .main-content {
    padding: 24px 18px 46px;
  }

  .breadcrumb,
  .doc-article,
  .pager {
    max-width: none;
  }

  .article-header h1 {
    font-size: 36px;
  }

  .article-lead {
    font-size: 16px;
  }

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

  .pager-next {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .text-button {
    padding: 0 10px;
  }

  .article-header h1 {
    font-size: 31px;
  }

  .content-h3 {
    font-size: 22px;
  }
}
