/* QSICK 文档中心：独立、轻量的左栏文档布局。
   刻意不加载站点样式与动效脚本——文档只需要读得清楚，不需要毛玻璃和滚动动画。
   主题与官网共用 localStorage 的 qsick-theme（light / dark）。 */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --side: #f7f8fb;
  --panel: #ffffff;
  --ink: #151b26;
  --muted: #586476;
  --faint: #8b95a7;
  --line: #e6e9f1;
  --line-strong: #d5dae5;
  --accent: #2f6bff;
  --accent-soft: #eaf1ff;
  --code-bg: #0f172a;
  --code-ink: #dbe6ff;
  --warn-bg: #fff9e6;
  --warn-line: #f0dfa8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px rgba(16, 24, 40, .06);
  --radius: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d131f;
  --bg-soft: #111a29;
  --side: #0f1725;
  --panel: #121c2d;
  --ink: #e6eefb;
  --muted: #9fb0c8;
  --faint: #7d8ca4;
  --line: #22304a;
  --line-strong: #2d3e5c;
  --accent: #7aa4ff;
  --accent-soft: rgba(122, 164, 255, .14);
  --code-bg: #080f1d;
  --code-ink: #dbe6ff;
  --warn-bg: #2a2413;
  --warn-line: #4a3f1d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 34px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ 骨架 */
.docs-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.docs-side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  padding: 18px 14px 22px;
  background: var(--side);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.docs-brand-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.docs-brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--ink); font-weight: 700; font-size: 15px; min-width: 0;
}
.docs-brand:hover { text-decoration: none; }
.docs-brand img {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: #fff; flex: none;
}
.docs-brand em {
  font-style: normal; font-size: 10.5px; font-weight: 600; line-height: 1;
  color: var(--accent); border: 1px solid var(--accent);
  padding: 3px 6px; border-radius: 999px; font-family: var(--mono);
}
.docs-close {
  display: none; margin-left: auto; border: 0; background: transparent;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px;
}

.docs-search {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; margin-bottom: 15px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); color: var(--faint);
}
.docs-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.docs-search svg { width: 14px; height: 14px; flex: none; }
.docs-search input {
  width: 100%; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font: inherit; font-size: 13px;
}
.docs-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.docs-search kbd {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; white-space: nowrap;
}

.docs-nav { display: block; }
.docs-nav-top {
  display: block; padding: 6px 10px; border-radius: 7px;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.docs-nav-top:hover, .docs-nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.docs-nav-top.active, .docs-group a.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}

.docs-group { margin-top: 5px; }
.docs-group summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  list-style: none; padding: 7px 10px;
  color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.docs-group summary::-webkit-details-marker { display: none; }
.docs-group summary::after {
  content: ""; width: 6px; height: 6px; margin-left: auto;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .15s ease;
}
.docs-group:not([open]) summary::after { transform: rotate(-45deg); }
.docs-group a {
  display: block; padding: 6px 10px 6px 19px; border-radius: 7px;
  color: var(--muted); font-size: 13px; line-height: 1.55;
}
.docs-nav-empty {
  display: none; margin: 8px 0; padding: 8px 10px;
  color: var(--faint); font-size: 12px;
}
.docs-nav-empty.show { display: block; }

.docs-side-foot {
  display: grid; gap: 5px; margin-top: 22px; padding-top: 13px;
  border-top: 1px solid var(--line); font-size: 12px;
}
.docs-side-foot a { color: var(--muted); }

/* ------------------------------------------------------------------ 主区 */
.docs-pane { min-width: 0; display: flex; flex-direction: column; }

.docs-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 26px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.docs-burger {
  display: none; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); color: var(--muted); cursor: pointer;
}
.docs-burger svg { width: 16px; height: 16px; }
.docs-top-crumb {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; font-size: 12.5px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.docs-top-crumb a { color: var(--muted); }
.docs-top-links {
  display: flex; align-items: center; gap: 16px;
  margin-left: auto; font-size: 13px;
}
.docs-top-links a { color: var(--muted); white-space: nowrap; }
.docs-top-links a:hover { color: var(--accent); text-decoration: none; }
.docs-theme {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.docs-theme:hover { color: var(--accent); border-color: var(--accent); }
.docs-theme svg { width: 15px; height: 15px; }
.docs-theme .docs-theme-sun { display: none; }
[data-theme="dark"] .docs-theme .docs-theme-sun { display: block; }
[data-theme="dark"] .docs-theme .docs-theme-moon { display: none; }

.docs-main {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 30px 32px 72px;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 208px;
  gap: 46px;
  align-items: start;
}
.docs-main-index { display: block; width: min(100%, 900px); }
.docs-main-index .docs-toc { display: none; }
.docs-content { min-width: 0; max-width: 840px; }

/* 右侧「页面导航」：类似 NapCat 的三级目录，从正文 h2/h3 自动生成。 */
.docs-toc {
  position: sticky; top: 76px;
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding: 4px 0 18px;
  font-size: 12.5px; line-height: 1.7;
}
.docs-toc-title {
  margin: 0 0 8px; color: var(--faint);
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
}
.docs-toc a {
  display: block; padding: 3px 0 3px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis;
}
.docs-toc a.lv3 { padding-left: 22px; font-size: 12px; color: var(--faint); }
.docs-toc a:hover { color: var(--accent); text-decoration: none; border-left-color: var(--accent-soft); }
.docs-toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.docs-crumbs { margin-bottom: 12px; font-size: 12px; color: var(--faint); }
.docs-crumbs span { margin: 0 6px; }

.docs-head h1 {
  margin: 0 0 10px;
  font-size: 32px; line-height: 1.25; letter-spacing: -.02em;
}
.docs-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin: 0; color: var(--faint); font-size: 12px;
}
.docs-lead { margin: 10px 0 0; color: var(--muted); font-size: 14.5px; }

/* ------------------------------------------------------------------ 正文 */
.docs-body { margin-top: 24px; }
.docs-body h2, .docs-body h3 { scroll-margin-top: 78px; }
.docs-body h2 {
  margin: 34px 0 12px;
  font-size: 21px; line-height: 1.4; letter-spacing: -.01em;
}
.docs-body h3 { margin: 26px 0 8px; font-size: 16.5px; line-height: 1.5; }
.docs-body h4 { margin: 20px 0 6px; font-size: 14.5px; }
.docs-body p, .docs-body li { color: var(--muted); font-size: 14px; }
.docs-body p { margin: 10px 0; }
.docs-body strong { color: var(--ink); }
.docs-body .req { color: var(--err, #c0392b); font-weight: 700; margin-left: 1px; }
.docs-body .ptype { margin-left: 2px; color: var(--faint); font-family: var(--mono); font-size: 10px; }
.docs-body .docs-dim { color: var(--faint); font-weight: 400; }
.docs-body code.json {
  display: block; margin: 0; padding: 5px 7px;
  color: var(--muted); background: var(--bg-soft);
  font-size: 10.5px; line-height: 1.55; border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
}
.docs-body .table-wrap table { font-size: 12px; }
.docs-body .table-wrap th, .docs-body .table-wrap td { padding: 7px 9px; }
.docs-body .table-wrap td code { font-size: 11px; }
.docs-body .table-wrap .badge-pill { margin: 0; }
.docs-body .table-wrap td code:not(.json) { white-space: nowrap; overflow-wrap: normal; }
.docs-body .table-wrap td:first-child { white-space: nowrap; vertical-align: top; }


.docs-body del { color: var(--faint); text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--faint) 65%, transparent); }
.docs-body del strong { color: var(--faint); }
.docs-body ul, .docs-body ol { margin: 10px 0; padding-left: 22px; }
.docs-body li { margin: 5px 0; }
.docs-body hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.docs-body code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  color: var(--accent); background: var(--accent-soft);
  padding: 1px 5px; border-radius: 5px;
  overflow-wrap: anywhere;
}
.docs-body pre {
  margin: 12px 0; padding: 15px 17px;
  background: var(--code-bg); color: var(--code-ink);
  border-radius: 10px; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  tab-size: 2;
}
.docs-body pre code {
  padding: 0; color: inherit; background: transparent;
  font-size: inherit; border-radius: 0;
}

.docs-body .code-block {
  margin: 14px 0; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: var(--panel);
}
.docs-body .code-block pre { margin: 0; border-radius: 0; }
.docs-body .cb-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 12px; background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  color: var(--faint); text-transform: uppercase;
}
.docs-body .copy-code {
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel); color: var(--muted);
  font: inherit; font-size: 10.5px; letter-spacing: 0;
  padding: 2px 8px; cursor: pointer; text-transform: none;
}
.docs-body .copy-code:hover { color: var(--accent); border-color: var(--accent); }

.docs-body .table-wrap {
  margin: 14px 0; overflow-x: auto;
  border: 1px solid var(--line); border-radius: 10px;
}
.docs-body table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.docs-body th, .docs-body td {
  padding: 8px 11px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); color: var(--muted);
}
.docs-body th {
  background: var(--bg-soft); color: var(--ink);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.docs-body tr:last-child td { border-bottom: 0; }
.docs-body td code { font-size: 11.5px; }

.docs-body .callout {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 14px 0; padding: 12px 14px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); font-size: 12.5px; line-height: 1.75;
}
.docs-body .callout svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent); }
.docs-body .callout.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.docs-body .callout.warn svg { color: #b7791f; }
.docs-body .callout div { min-width: 0; }

.docs-body .badge-pill {
  display: inline-block; margin: 0 4px 2px 0; padding: 1px 8px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--muted); background: var(--panel);
  font-size: 11px; line-height: 1.7;
}

.docs-body .status-pill {
  display: inline-block; padding: 1px 8px; border: 1px solid var(--line-strong);
  border-radius: 999px; font-size: 11px; line-height: 1.7; white-space: nowrap;
}
.docs-body .status-pill.ok { color: #137a54; background: rgba(19, 122, 84, .08); border-color: rgba(19, 122, 84, .22); }
.docs-body .status-pill.partial { color: #946200; background: rgba(148, 98, 0, .08); border-color: rgba(148, 98, 0, .22); }
.docs-body .status-pill.no { color: #a33b3b; background: rgba(163, 59, 59, .07); border-color: rgba(163, 59, 59, .2); }
.docs-body .status-pill.extra { color: var(--muted); background: var(--panel); }
.docs-body .csv-body {
  display: inline-block; max-width: 100%; font-size: 11px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.docs-body .table-wrap td code.csv-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.docs-body .doc-source {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  margin-top: 28px; padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint); font-size: 12px;
}
.docs-body .doc-source svg { width: 14px; height: 14px; }
.docs-body .doc-source a { color: var(--muted); }

/* ------------------------------------------------------------------ 索引卡片 */
.docs-cards { margin-top: 22px; }
.docs-cards h2 { margin: 30px 0 12px; font-size: 18px; }
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.docs-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.docs-card:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.docs-card .emoji { font-size: 21px; line-height: 1.3; flex: none; }
.docs-card b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 14px; }
.docs-card small { display: block; font-size: 12.5px; line-height: 1.65; }

/* ------------------------------------------------------------------ 翻页 / 页脚 */
.docs-pager {
  display: flex; align-items: stretch; gap: 14px;
  margin-top: 38px; padding-top: 18px; border-top: 1px solid var(--line);
}
.docs-pager a {
  display: flex; flex-direction: column; gap: 2px;
  max-width: 48%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); font-size: 13px;
}
.docs-pager a:hover { border-color: var(--accent); text-decoration: none; }
.docs-pager a span { color: var(--faint); font-size: 11px; }
.docs-pager a.next { margin-left: auto; text-align: right; }

.docs-foot {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint); font-size: 12px;
}
.docs-foot a { color: var(--muted); }

.docs-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 25;
  background: rgba(10, 15, 25, .35);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}

/* ------------------------------------------------------------------ 响应式 */
@media (max-width: 1180px) {
  .docs-main { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
  .docs-toc { display: none; }
}

@media (max-width: 980px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-side {
    position: fixed; inset: 0 auto 0 0;
    width: min(84vw, 300px);
    transform: translateX(-102%);
    transition: transform .18s ease;
    box-shadow: 0 12px 44px rgba(0, 0, 0, .18);
  }
  body.docs-nav-open .docs-side { transform: none; }
  body.docs-nav-open .docs-overlay { opacity: 1; pointer-events: auto; }
  .docs-overlay { display: block; }
  .docs-close { display: block; }
  .docs-burger { display: grid; }
  .docs-top { padding: 9px 14px; gap: 10px; }
  .docs-top-links { gap: 12px; }
  .docs-top-links a { font-size: 12.5px; }
  .docs-main { padding: 24px 18px 60px; }
  .docs-head h1 { font-size: 26px; }
  .docs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .docs-top-crumb { display: none; }
  .docs-top-links a:not(:first-child) { display: none; }
  .docs-body p, .docs-body li { font-size: 13.5px; }
  .docs-body .table-wrap { margin-left: -2px; margin-right: -2px; }
  .docs-pager a { max-width: 100%; }
  .docs-pager { flex-direction: column; }
  .docs-pager a.next { margin-left: 0; }
}
