/* GitBook-style KB shell */
body.kb-shell-body {
  margin: 0;
  padding: 0;
  background: #f4f6f8;
}

.kb-shell-root {
  --kb-sidebar-w: 280px;
  --kb-top-h: 52px;
  --kb-accent: #2fc6f6;
  --kb-bg: #f4f6f8;
  --kb-border: #dfe3e8;
  min-height: 100dvh;
  background: var(--kb-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.kb-shell-root *, .kb-shell-root *::before, .kb-shell-root *::after {
  box-sizing: border-box;
}

.kb-layout {
  display: flex;
  min-height: 100dvh;
}

.kb-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--kb-sidebar-w);
  height: 100dvh;
  background: #fff;
  border-right: 1px solid var(--kb-border);
  overflow-y: auto;
  z-index: 200;
  transform: translateX(0);
  transition: transform 0.2s ease;
  -webkit-overflow-scrolling: touch;
}

.kb-sidebar__head {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--kb-border);
  padding: 14px 16px 12px;
  z-index: 1;
}

.kb-sidebar__brand {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  text-decoration: none;
  display: block;
  line-height: 1.3;
}

.kb-sidebar__brand small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #828b95;
  margin-top: 2px;
}

.kb-nav-section {
  padding: 10px 0 4px;
}

.kb-nav-section__title {
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #828b95;
}

.kb-nav-link {
  display: block;
  padding: 7px 16px 7px 20px;
  font-size: 14px;
  line-height: 1.35;
  color: #333;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.kb-nav-link:hover {
  background: #f0fbff;
  color: #111;
}

.kb-nav-link.is-active {
  background: #e8f9fe;
  border-left-color: var(--kb-accent);
  color: #111;
  font-weight: 600;
}

.kb-nav-link__id {
  display: block;
  font-size: 10px;
  color: #a8b0b9;
  font-family: ui-monospace, monospace;
}

.kb-main {
  flex: 1;
  margin-left: var(--kb-sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kb-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--kb-top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: rgba(244, 246, 248, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--kb-border);
}

.kb-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--kb-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.kb-topbar__title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #525c69;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-topbar__hub {
  font-size: 13px;
  color: var(--kb-accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.kb-content-wrap {
  flex: 1;
  padding: 16px 20px 32px;
  max-width: 820px;
}

.kb-article-card {
  background: #fff;
  border: 1px solid var(--kb-border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(17, 24, 39, 0.06);
  overflow: hidden;
}

.kb-article-card .kb-article {
  padding: 20px 22px 24px;
}

.kb-article .kb-id {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: #828b95;
  margin-bottom: 6px;
}

.kb-article h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: #111;
  margin: 0 0 8px;
  line-height: 1.25;
}

.kb-article .kb-lead {
  font-size: 15px;
  color: #525c69;
  margin: 0 0 18px;
  line-height: 1.45;
}

.kb-article h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8ecf0;
}

.kb-article p, .kb-article li {
  font-size: 15px;
  line-height: 1.55;
  color: #333;
}

.kb-article ul, .kb-article ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.kb-article code {
  font-size: 0.88em;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

.kb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0;
}

.kb-table th, .kb-table td {
  border: 1px solid var(--kb-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.kb-table th {
  background: #f8fafc;
  font-weight: 600;
}

.kb-flow {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 8px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 12px 0;
}

.kb-steps {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.kb-step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e8ecf0;
  border-radius: 10px;
}

.kb-step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--kb-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

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

.kb-pager a {
  flex: 1;
  max-width: 48%;
  padding: 12px 14px;
  border: 1px solid var(--kb-border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  font-size: 14px;
}

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

.kb-pager a span {
  display: block;
  font-size: 11px;
  color: #828b95;
  margin-bottom: 4px;
}

.kb-pager a strong {
  color: #111;
}

.kb-pager .next {
  text-align: right;
  margin-left: auto;
}

.kb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 150;
}

.kb-check label {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .kb-sidebar {
    transform: translateX(-100%);
  }
  .kb-sidebar.is-open {
    transform: translateX(0);
  }
  .kb-overlay.is-open {
    display: block;
  }
  .kb-main {
    margin-left: 0;
  }
  .kb-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .kb-content-wrap {
    padding: 12px 12px 28px;
  }
  .kb-article-card .kb-article {
    padding: 16px 16px 20px;
  }
}

.kb-doc-sample { margin: 16px 0; padding: 0; }
.kb-doc-sample img { max-width: 100%; height: auto; border: 1px solid #dde2e8; border-radius: 8px; background: #fff; }
.kb-doc-sample figcaption { margin-top: 6px; font-size: 12px; color: #6a737d; }
