:root {
  --sf-accent: #2563eb;
  --sf-accent-soft: #eef4ff;
  --sf-ink: #0f172a;
  --sf-muted: #64748b;
  --sf-line: #e5e7eb;
  --sf-panel: #ffffff;
  --sf-side: #f8fafc;
  --sf-code: #111827;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--sf-ink);
  background: var(--sf-panel);
  font: 16px/1.65 Inter, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}
a { color: var(--sf-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.qd-top {
  position: sticky; top: 0; z-index: 40;
  height: 72px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 28px;
  background: var(--sf-panel);
  border-bottom: 1px solid var(--sf-line);
}
.qd-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--sf-ink); font-weight: 700; text-decoration: none;
  min-width: max-content;
}
.qd-brand img { width: 28px; height: 28px; object-fit: contain; }
.qd-tabs {
  display: flex; align-items: center; gap: 4px;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.qd-tabs::-webkit-scrollbar { display: none; }
.qd-tabs .tab {
  border: 0; background: transparent; color: var(--sf-muted);
  font: inherit; font-size: 14px; font-weight: 650;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.qd-tabs .tab.active { color: var(--sf-accent); background: var(--sf-accent-soft); }
.qd-search {
  margin-left: auto;
  width: min(32vw, 360px); height: 40px;
  border: 1px solid var(--sf-line); border-radius: 8px;
  padding: 0 14px; font: inherit; color: var(--sf-ink); background: var(--sf-side);
}
.qd-actions { display: flex; align-items: center; gap: 10px; }
.qd-ghost {
  border: 0; background: transparent; color: var(--sf-muted);
  font: inherit; cursor: pointer; padding: 6px 8px;
}
.qd-cloud {
  display: inline-flex; align-items: center;
  min-height: 36px; padding: 6px 14px; border-radius: 8px;
  background: var(--sf-accent); color: #fff; font-weight: 650; text-decoration: none;
}
.qd-cloud:hover { text-decoration: none; filter: brightness(0.95); }
.search-hits {
  position: fixed; top: 66px; right: 116px; z-index: 50;
  width: min(360px, calc(100vw - 32px)); background: #fff;
  border: 1px solid var(--sf-line); border-radius: 8px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}
.search-hits:empty { display: none; }
.search-hits button {
  width: 100%; border: 0; background: #fff; text-align: left; cursor: pointer;
  padding: 10px 12px; color: var(--sf-ink); font: inherit;
}
.search-hits button:hover { background: var(--sf-side); }
.search-hits small { display: block; color: var(--sf-muted); }

.qd-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 220px;
  min-height: calc(100vh - 72px);
}
.qd-side, .qd-toc {
  position: sticky; top: 72px; height: calc(100vh - 72px);
  overflow: auto; padding: 20px 14px 48px;
}
.qd-side { border-right: 1px solid var(--sf-line); background: var(--sf-side); }
.qd-toc { border-left: 1px solid var(--sf-line); }
.group-title {
  margin: 18px 8px 6px;
  color: var(--sf-muted); font-size: 12px; font-weight: 750;
}
.nav-link {
  display: block; width: 100%;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--sf-ink); cursor: pointer; font: inherit; text-align: left;
  padding: 9px 10px;
}
.nav-link:hover { background: #fff; }
.nav-link.active { background: #fff; color: var(--sf-accent); font-weight: 750; }
.nav-subtitle {
  margin: 12px 10px 4px;
  color: var(--sf-muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
}
.qd-main {
  max-width: 920px; width: 100%;
  padding: 42px 48px 96px;
}
.qd-note {
  display: inline-flex; align-items: center;
  min-height: 34px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--sf-line); background: var(--sf-side);
  color: var(--sf-muted); font-size: 14px;
}
.qd-note.warn { margin-top: 12px; color: #92400e; background: #fffbeb; border-color: #fde68a; }
.crumb { margin-top: 28px; color: var(--sf-muted); font-weight: 650; }
.page-title { margin: 14px 0 8px; font-size: clamp(34px, 5vw, 56px); line-height: 1.05; }
.source-line { margin: 0 0 28px; }
.content h1 { display: none; }
.content h2 { margin: 36px 0 12px; font-size: 26px; line-height: 1.2; }
.content h3 { margin: 28px 0 10px; font-size: 20px; line-height: 1.25; }
.content p { margin: 14px 0; }
.content ul, .content ol { padding-left: 24px; }
.content li { margin: 6px 0; }
.content figure,
.content .frame {
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
}
.content img,
.content .doc-img,
.content video,
.content canvas,
.content iframe {
  display: block;
  max-width: 100%;
  height: auto;
}
.content table { border-collapse: collapse; width: 100%; max-width: 100%; margin: 18px 0; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--sf-line); padding: 8px 10px; vertical-align: top; }
.content th { background: var(--sf-side); }
.content code {
  background: var(--sf-side); color: var(--sf-code);
  border: 1px solid var(--sf-line); border-radius: 6px; padding: 1px 5px;
}
.content pre {
  max-width: 100%;
  overflow: auto; padding: 14px; border-radius: 8px;
  background: #0f172a; color: #e5e7eb;
}
.content pre code { background: transparent; color: inherit; border: 0; padding: 0; }
.qd-toc a {
  display: block; color: var(--sf-muted); padding: 6px 8px; border-radius: 8px; font-size: 14px;
}
.qd-toc a:hover { color: var(--sf-accent); background: var(--sf-accent-soft); text-decoration: none; }
.qd-toc .toc-sub { padding-left: 18px; font-size: 13px; }
.qd-error { color: #b91c1c; }

@media (max-width: 960px) {
  .qd-top { height: auto; min-height: 72px; flex-wrap: wrap; padding: 14px 18px; }
  .qd-brand { width: 100%; }
  .qd-tabs { order: 3; width: 100%; }
  .qd-search { width: min(100%, 360px); margin-left: 0; }
  .search-hits { top: 120px; right: 16px; }
  .qd-layout { display: block; }
  .qd-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--sf-line); }
  .qd-toc { display: none; }
  .qd-main { padding: 28px 20px 72px; }
  .page-title { font-size: 34px; }
}
