:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --bg-sidebar: #f6f8fa;
  --text: #1f2328;
  --text-muted: #59636e;
  --link: #0969da;
  --link-hover: #0550ae;
  --border: #d1d9e0;
  --border-muted: #e5e7eb;
  --code-bg: #f6f8fa;
  --code-text: #1f2328;
  --note-bg: #ddf4ff;
  --note-border: #54aeff;
  --warn-bg: #fff8c5;
  --warn-border: #d4a72c;
  --topbar-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-alt: #151b23;
    --bg-sidebar: #010409;
    --text: #f0f6fc;
    --text-muted: #9198a1;
    --link: #4493f8;
    --link-hover: #79b8ff;
    --border: #3d444d;
    --border-muted: #21262d;
    --code-bg: #151b23;
    --code-text: #f0f6fc;
    --note-bg: rgba(56, 139, 253, 0.1);
    --note-border: #1f6feb;
    --warn-bg: rgba(187, 128, 9, 0.15);
    --warn-border: #9e6a03;
    --topbar-bg: #010409;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-muted);
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px 16px;
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.45;
}
pre code {
  background: none;
  border: none;
  padding: 0;
}

/* Topbar */
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo span {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.topnav { display: flex; gap: 18px; }
.topnav a {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

/* Layout */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  padding: 0 24px;
}

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border-muted);
  padding: 24px 12px 24px 0;
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}
.side-section { margin-bottom: 24px; }
.side-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 12px 8px;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar li a {
  display: block;
  padding: 6px 12px;
  color: var(--text);
  font-size: 14px;
  border-radius: 6px;
}
.sidebar li a:hover {
  background: var(--bg-alt);
  text-decoration: none;
}
.sidebar li a.active {
  background: var(--bg-alt);
  font-weight: 600;
  color: var(--link);
}

/* Content */
.content {
  padding: 32px 0 80px;
  max-width: 820px;
  min-width: 0;
}
.article { margin-bottom: 56px; }
.article:last-of-type { margin-bottom: 24px; }

.article h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}
.article h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin: 32px 0 12px;
  color: var(--text);
}
.article h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 10px;
}
.article p {
  margin: 12px 0;
  color: var(--text);
}
.article ul, .article ol {
  margin: 12px 0;
  padding-left: 24px;
}
.article li { margin: 4px 0; }

.meta {
  color: var(--text-muted) !important;
  font-size: 13px !important;
  margin: 0 0 16px !important;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  background: var(--bg-alt);
  font-weight: 600;
}
.data-table tbody tr:nth-child(even) td {
  background: var(--bg-alt);
}

.icon-inline {
  display: inline-block;
  margin-right: 4px;
  font-size: 14px;
}

/* Note callouts */
.note {
  border-left: 4px solid var(--note-border);
  background: var(--note-bg);
  padding: 12px 16px;
  margin: 20px 0;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  color: var(--text);
}
.note.warn {
  border-left-color: var(--warn-border);
  background: var(--warn-bg);
}
.note strong { color: var(--text); }

/* Coming soon */
.coming-soon {
  color: var(--text-muted);
  font-style: italic;
  padding: 24px 0;
}

/* Footer */
.page-footer {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--border-muted);
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-muted);
    padding: 16px 0;
  }
  .content { padding: 24px 0 64px; }
  .article h1 { font-size: 26px; }
}
