/* QuotaDesk docs. Same dark tokens and fonts as the main site (docs/index.html). */
:root {
  --bg: #0b0d1a;
  --bg-2: #11142a;
  --card: #161a33;
  --card-2: #1c2142;
  --edge: #262b52;
  --edge-2: #343a63;
  --text: #e7e9f6;
  --muted: #a3a8c9;
  --cyan: #4fd8ff;
  --cyan-hover: #9ae9ff;
  --orange: #ff8a3d;
  --violet: #a774ff;
  --green: #3ee6a1;
  --code-bg: #070912;
  --code-text: #d6f6ff;
  --radius: 14px;
  --radius-sm: 8px;
  --top: 60px;
  --side: 264px;
  --toc: 224px;
  --font: Inter, system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  --pixel: Silkscreen, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 var(--font); overflow-x: hidden; }
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--cyan-hover); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; height: auto; }
code, pre { font-family: var(--mono); }
.icon { flex: none; vertical-align: middle; }
.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 { position: absolute; left: -999px; top: 8px; background: var(--orange); color: #000; padding: 8px 14px; border-radius: 8px; z-index: 50; font-weight: 600; }
.skip:focus { left: 12px; color: #000; }

/* ---------- Top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(11, 13, 26, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--edge); }
.topbar-row { display: flex; align-items: center; gap: 16px; min-height: var(--top); max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.logo { font-family: var(--pixel); font-size: 20px; color: var(--text); text-decoration: none; letter-spacing: 1px; white-space: nowrap; }
.logo b { color: var(--orange); font-weight: 400; }
.logo:hover { color: var(--text); }
.docs-home { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; padding-left: 16px; border-left: 1px solid var(--edge); white-space: nowrap; }
.docs-home:hover { color: var(--text); }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--edge); background: var(--bg-2); color: var(--text); font: 15px var(--font); }
.search input::placeholder { color: var(--muted); }
.search input:hover { border-color: var(--edge-2); }
.search input:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(79, 216, 255, .25); }
.gh-stars { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; border: 1px solid transparent; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.gh-stars:hover { color: var(--text); background: var(--bg-2); border-color: var(--edge); }
.gh-stars .star-icon { color: var(--violet); display: inline-flex; align-items: center; }
.lang { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.lang a, .lang [aria-current] { display: inline-grid; place-items: center; min-width: 34px; height: 32px; padding: 0 9px; border-radius: 9px; text-decoration: none; transition: background .15s, color .15s; }
.lang a { color: var(--muted); }
.lang a:hover { color: var(--text); background: var(--bg-2); }
.lang [aria-current] { color: #cbb6ff; background: rgba(167,116,255,.16); box-shadow: inset 0 0 0 1px rgba(167,116,255,.32); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--edge); background: var(--bg-2); color: var(--text); cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--cyan); color: var(--text); }
.nav-toggle { display: none; }

/* ---------- Three-column layout */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--toc); gap: 40px; max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.layout > * { min-width: 0; }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 28px 8px 40px 0; border-right: 1px solid var(--edge); scrollbar-width: thin; }
.nav-group { margin-bottom: 22px; }
.nav-title { font-family: var(--pixel); font-weight: 400; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--cyan); margin: 0 0 6px; padding: 0 12px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 6px 12px; margin: 1px 0; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; line-height: 1.45; border-left: 2px solid transparent; }
.sidebar li a:hover { color: var(--text); background: var(--bg-2); }
.sidebar li a[aria-current="page"] { color: var(--text); background: var(--card); border-left-color: var(--orange); font-weight: 600; }
.sidebar mark { background: rgba(255, 138, 61, .25); color: inherit; border-radius: 3px; }
.nav-empty { color: var(--muted); padding: 0 12px; font-size: 14px; }

.content { padding: 28px 0 64px; outline: none; }
.content article { max-width: 780px; }

/* ---------- Page header */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--edge-2); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); }
h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.15; letter-spacing: -.5px; margin: 0 0 12px; }
.lead { font-size: 19px; line-height: 1.6; color: var(--muted); margin: 0 0 20px; }

/* ---------- Page action bar */
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 22px; margin: 0 0 30px; border-bottom: 1px solid var(--edge); }
.action { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--edge); background: var(--bg-2); color: var(--text); font: 500 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.action:hover { border-color: var(--cyan); color: var(--text); background: var(--card); }
.action[aria-expanded="true"] { border-color: var(--cyan); background: var(--card); }
.action .icon { color: var(--muted); }
.action:hover .icon, .action[aria-expanded="true"] .icon { color: var(--cyan); }
.action.done { border-color: var(--green); }
.action.done .icon { color: var(--green); }
.ask { position: relative; }
.ask-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 230px; list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--edge-2); border-radius: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.ask-menu[hidden] { display: none; }
.ask-menu a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.ask-menu a:hover, .ask-menu a:focus-visible { background: var(--card-2); color: var(--text); }
.ask-menu a:focus-visible { outline-offset: -2px; }
.ask-menu .icon { color: var(--muted); }

/* ---------- Prose */
.prose { overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.3px; margin: 44px 0 12px; padding-top: 4px; }
.prose h3 { font-size: 19px; line-height: 1.35; margin: 30px 0 8px; }
.prose h4 { font-size: 16px; margin: 24px 0 6px; }
.prose .anchor { margin-left: 8px; color: var(--edge-2); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0 0 8px; }
.prose li::marker { color: var(--muted); }
.prose strong { color: #fff; font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--edge); margin: 36px 0; }
.prose :not(pre) > code { font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--card); border: 1px solid var(--edge); color: var(--code-text); overflow-wrap: anywhere; }
.prose pre { position: relative; margin: 0 0 20px; padding: 16px 18px; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--edge); border-radius: 12px; color: var(--code-text); font-size: 14px; line-height: 1.6; }
.prose pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 6px; right: 10px; font: 11px var(--mono); color: var(--muted); text-transform: lowercase; }
.prose pre code { font-size: inherit; }
.prose blockquote { margin: 0 0 20px; padding: 12px 18px; border-left: 3px solid var(--orange); background: rgba(255, 138, 61, .08); border-radius: 0 10px 10px 0; color: var(--text); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { display: block; border-radius: 12px; box-shadow: 0 0 0 1px var(--edge), 0 20px 50px rgba(0, 0, 0, .45); margin: 8px 0; }
.table-scroll { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--edge); border-radius: 12px; }
.table-scroll:focus-visible { outline-offset: 2px; }
.prose table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--edge); vertical-align: top; }
.prose th { background: var(--card-2); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }

/* ---------- Prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--edge); }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: 12px; text-decoration: none; background: var(--bg-2); }
.pager a:hover { border-color: var(--cyan); }
.pager-next { grid-column: 2; text-align: right; align-items: flex-end; }
.pager-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pager-title { color: var(--text); font-weight: 600; }

/* ---------- On this page */
.toc { padding: 28px 0 40px; }
.toc-inner { position: sticky; top: calc(var(--top) + 28px); max-height: calc(100vh - var(--top) - 56px); overflow-y: auto; }
.toc-title { font-family: var(--pixel); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--cyan); margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--edge); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.45; }
.toc .toc-l3 a { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); border-left-color: var(--orange); }

/* ---------- Footer */
.site-footer { border-top: 1px solid var(--edge); color: var(--muted); font-size: 14px; }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 32px 20px 48px; display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
.footer-inner p { margin: 0; }

/* ---------- Responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--side) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .topbar-row { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav-toggle { display: inline-grid; }
  .docs-home { display: none; }
  .lang { margin-left: auto; }
  .search { order: 10; flex-basis: 100%; max-width: none; margin: 0; }
  .layout { display: block; padding: 0 16px; }
  .sidebar { display: none; position: fixed; z-index: 25; top: var(--header-h, 108px); left: 0; right: 0; bottom: 0; height: auto; padding: 18px 16px 40px; background: var(--bg); border-right: 0; border-top: 1px solid var(--edge); }
  .sidebar.open { display: block; }
  body.nav-open { overflow: hidden; }
  .content { padding-top: 20px; }
  .lead { font-size: 17px; }
  .prose h2 { font-size: 22px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
  .footer-inner { padding: 28px 16px 40px; }
}
@media (max-width: 420px) {
  .action { padding: 0 10px; font-size: 13px; }
  .logo { font-size: 18px; }
}
