:root {
  --bg: #fff; --bg-soft: #f6f8fa; --text: #1f2328; --muted: #59636e; --line: #d8dee4;
  --accent: #1565c0; --accent-soft: #e8f1fd; --code-bg: #f3f5f7;
  --free: #1a7f37; --free-bg: #dafbe1; --new: #b42318; --new-bg: #fee4e2;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --top: 56px;
}
[data-theme="dark"] {
  --bg: #0f1419; --bg-soft: #161b22; --text: #e6edf3; --muted: #9aa7b4; --line: #2d353e;
  --accent: #6cb2ff; --accent-soft: #14283f; --code-bg: #1b222b;
  --free: #56d364; --free-bg: #12301b; --new: #ff8b85; --new-bg: #3b1716;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + var(--adm, 0px) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 var(--font); overflow-x: hidden; }
body.admin-bar { --adm: 32px; }
@media (max-width: 782px) { body.admin-bar { --adm: 46px; } }
a { color: var(--accent); }
img, svg, video { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* Top bar */
.topbar { position: sticky; top: var(--adm, 0px); z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand img { border-radius: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.menu-btn { display: none; margin-left: -8px; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }

/* Search */
.site-search { position: relative; margin-left: auto; width: 320px; max-width: 100%; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.site-search:focus-within { border-color: var(--accent); }
.site-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.site-search kbd { font: 12px var(--mono); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; color: var(--muted); }
.results { position: absolute; top: 44px; left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.14); overflow: hidden; z-index: 40; }
.results a { display: block; padding: 10px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.on { background: var(--accent-soft); }
.results b { display: block; font-weight: 600; font-size: 14px; }
.results small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.results .none { padding: 12px 14px; color: var(--muted); font-size: 14px; }

/* Layout */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar { position: sticky; top: calc(var(--top) + var(--adm, 0px)); align-self: start; height: calc(100vh - var(--top) - var(--adm, 0px)); overflow-y: auto; padding: 16px 12px 32px; border-right: 1px solid var(--line); background: var(--bg-soft); }
.side-title { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; line-height: 1.35; }
.side-link span:not(.badge) { flex: 1; min-width: 0; }
.side-link:hover { background: var(--line); color: var(--text); }
.side-link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-outside { margin-top: 14px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 14px; }
.ico { flex: none; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.badge-free { background: var(--free-bg); color: var(--free); }
.badge-new { background: var(--new-bg); color: var(--new); }
.scrim { display: none; }

.main { display: flex; justify-content: center; gap: 40px; padding: 28px 32px 48px; min-width: 0; }
.doc { width: 100%; max-width: 780px; min-width: 0; }
.toc { width: 210px; flex: none; position: sticky; top: calc(var(--top) + var(--adm, 0px) + 28px); align-self: start; font-size: 14px; display: none; }
.toc:not([hidden]) { display: none; }
@media (min-width: 1240px) { .toc:not([hidden]) { display: block; } }
.toc p { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a.h3 { padding-left: 24px; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }

/* Content */
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.entry { overflow-wrap: anywhere; }
.entry h1 { font-size: 32px; line-height: 1.25; margin: 4px 0 20px; font-weight: 650; letter-spacing: -.01em; }
.entry h2 { font-size: 23px; line-height: 1.3; margin: 2.2em 0 .6em; padding-top: .2em; font-weight: 650; }
.entry h3 { font-size: 18px; line-height: 1.4; margin: 1.8em 0 .5em; font-weight: 650; }
.entry p { margin: 0 0 1em; }
.entry p > b:only-child, .entry p > strong:only-child { font-weight: 400; }
.entry b, .entry strong { font-weight: 600; }
.entry ul, .entry ol { padding-left: 1.4em; margin: 0 0 1em; }
.entry li { margin: .25em 0; }
.entry center { display: block; text-align: center; }
.entry center h1, .entry center h2, .entry center h3 { text-align: center; }
.entry img { vertical-align: middle; }
.entry figure { margin: 1.2em 0; }
.entry hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.entry code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .15em .4em; border-radius: 6px; }
.entry pre { position: relative; margin: 1em 0 1.4em; padding: 14px 16px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font: 13.5px/1.65 var(--mono); max-width: 100%; }
.entry pre code { background: none; padding: 0; font-size: inherit; white-space: pre; overflow-wrap: normal; }
.copy { position: absolute; top: 8px; right: 8px; font: 12px var(--font); padding: 3px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.entry pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy.done { opacity: 1; color: var(--free); }
@media (hover: none) { .copy { opacity: 1; } }
.table-wrap { overflow-x: auto; margin: 1em 0 1.4em; border: 1px solid var(--line); border-radius: 10px; }
.entry table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.entry th, .entry td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.entry th { background: var(--bg-soft); font-weight: 600; }
.entry tr:last-child td { border-bottom: 0; }

/* Legacy callout box from the original pages (their inline <style> is overridden) */
.entry .alert { position: relative; margin: 1.2em 0; padding: 14px 44px 14px 16px !important; background: var(--accent-soft) !important; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; color: var(--text) !important; }
.entry .alert * { color: inherit !important; }
.entry .alert pre { background: var(--bg); }
.entry .alert .closebtn { position: absolute; right: 12px; top: 6px; float: none !important; margin: 0; font-size: 22px; line-height: 1; cursor: pointer; opacity: .6; }
.entry .alert .closebtn:hover { opacity: 1; }
/* Dark mode: transparent logos with dark artwork (detected in docs.js) get lightened instead of being framed */
[data-theme="dark"] .entry img.logo-dark { filter: invert(1) hue-rotate(180deg); }

/* FAQ accordion */
details.faq { border-top: 1px solid var(--line); }
details.faq:last-of-type { border-bottom: 1px solid var(--line); }
details.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 4px; cursor: pointer; list-style: none; font-size: 17px; font-weight: 600; line-height: 1.4; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
details.faq[open] summary::after { transform: rotate(-135deg); }
details.faq summary { color: var(--accent); }
details.faq summary:hover { filter: brightness(1.15); }
details.faq .faq-body { margin: 0 0 14px; padding: 12px 16px; background: var(--bg-soft); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; color: var(--muted); }
details.faq .faq-body > :last-child { margin-bottom: 0; }
details.faq .faq-body a { color: var(--accent); }

.updated { margin: 2.5em 0 0; font-size: 13px; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.pager-link { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); }
.pager-link:hover { border-color: var(--accent); }
.pager-link small { display: block; color: var(--muted); font-size: 12px; }
.pager-link span { color: var(--accent); font-weight: 600; }
.pager-next { text-align: right; grid-column: 2; }
.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); }
.hits { list-style: none; padding: 0; }
.hits li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.hits a { font-weight: 600; font-size: 18px; }
.hits p { margin: 4px 0 0; color: var(--muted); }

/* Mobile drawer */
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: 290px; max-width: 86vw; height: 100vh; height: 100dvh; transform: translateX(-100%); transition: transform .2s; padding-top: calc(var(--adm, 0px) + 16px); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.25); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.45); }
  .main { padding: 20px 16px 40px; }
  .site-search { width: auto; flex: 1; margin-left: 0; }
  .site-search kbd { display: none; }
  .brand span { display: none; }
  .entry h1 { font-size: 26px; }
  .entry h2 { font-size: 21px; }
}
/* Responsive tables: stacked cards on small screens */
@media (max-width: 760px) {
  .table-wrap { overflow: visible; border: 0; margin: 1em 0 1.2em; }
  .entry table, .entry thead, .entry tbody, .entry tr, .entry th, .entry td { display: block; width: 100%; }
  .entry tr { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
  .entry th { border-bottom: 1px solid var(--line); }
  .entry td { border-bottom: 1px solid var(--line); padding: 9px 14px; }
  .entry tr td:last-child { border-bottom: 0; }
  .table-stack thead { display: none; }
  .table-stack td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
  .table-list thead tr { margin-bottom: 0; border-bottom: 0; border-radius: 10px 10px 0 0; }
  .table-list tbody tr { border-top: 0; border-radius: 0 0 10px 10px; }
  .table-list:not(:has(thead)) tbody tr { border-radius: 10px; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } .pager-next { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .topbar, .sidebar, .toc, .pager, .copy { display: none !important; } .shell { display: block; } }
