:root {
  --brand: #3972f6;
  --brand-deep: #285bd8;
  --brand-soft: #edf3ff;
  --brand-soft-2: #f6f8ff;
  --cyan: #09aee8;
  --ink: #151d2f;
  --text: #475368;
  --muted: #818ca0;
  --line: #e6eaf1;
  --line-blue: #dce6ff;
  --paper: #ffffff;
  --canvas: #f7f9fc;
  --topbar: 72px;
  --sidebar: 272px;
  --toc: 260px;
  font-family: "MiSans", "HarmonyOS Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  color: var(--text);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--canvas); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.topbar {
  position: relative;
  z-index: 50;
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { color: #10192c; font-size: 24px; font-weight: 760; line-height: 1; letter-spacing: -.035em; }
.brand small { margin-top: 5px; color: #8f99aa; font-size: 10px; letter-spacing: .08em; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark img { display: block; width: 46px; height: 38px; object-fit: contain; }

.top-actions { display: flex; align-items: center; gap: 9px; }
.search-trigger {
  height: 36px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 12px;
  border: 1px solid #e0e5ed;
  border-radius: 10px;
  color: var(--muted);
  background: #f8f9fb;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.search-trigger:hover { border-color: #cdd8ee; background: white; box-shadow: 0 3px 10px rgba(34, 51, 82, .05); }
.search-trigger span { font-size: 18px; line-height: 1; }
.search-trigger b { flex: 1; text-align: left; font-size: 12px; font-weight: 500; }
kbd { padding: 2px 5px; border: 1px solid #dce1e9; border-radius: 5px; color: #929bad; background: white; font-size: 9px; box-shadow: 0 1px 2px rgba(30, 40, 60, .04); }
.system-link {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(135deg, #427cff, #2f68ed);
  box-shadow: 0 5px 14px rgba(57, 114, 246, .2);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
}
.system-link:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(57, 114, 246, .27); }
.menu-button { display: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; cursor: pointer; }

.manual-shell { height: calc(100vh - var(--topbar)); display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc); }
.sidebar, .page-toc { min-height: 0; overflow-y: auto; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fbfcfe; }
.sidebar-head { padding: 23px 22px 12px; }
.sidebar-head b { color: #6f7b90; font-size: 11px; font-weight: 650; letter-spacing: .06em; }
.chapter-nav { flex: 1; padding: 2px 12px 24px; }
.chapter-nav a,
.chapter-group > button {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 13px;
  align-items: start;
  gap: 10px;
  margin: 2px 0;
  padding: 10px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #4c586d;
  background: transparent;
  text-decoration: none;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.chapter-group { margin: 2px 0; }
.chapter-group > button { width: 100%; text-align: left; cursor: pointer; }
.chapter-nav a > span,
.chapter-group > button > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #8490a4;
  background: #f0f3f8;
  font-size: 9px;
  font-weight: 720;
}
.chapter-nav p, .chapter-group p { min-width: 0; margin: 0; }
.chapter-nav b, .chapter-group b { display: block; color: inherit; font-size: 12px; font-weight: 620; line-height: 1.45; }
.chapter-nav small, .chapter-group small { display: block; margin-top: 3px; overflow: hidden; color: #929caf; font-size: 9px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.chapter-nav i, .chapter-group i { padding-top: 3px; color: #a3adbc; font-size: 15px; font-style: normal; opacity: 0; }
.chapter-nav a:hover, .chapter-group > button:hover { color: var(--ink); background: #f4f6fa; }
.chapter-nav a.active { border-color: #dce6ff; color: #2d61d7; background: linear-gradient(135deg, #eaf1ff, #f2f6ff); }
.chapter-nav a.active > span { color: white; background: var(--brand); box-shadow: 0 4px 9px rgba(57, 114, 246, .19); }
.chapter-nav a.active i { color: var(--brand); opacity: 1; }
.chapter-group > button i { opacity: 1; transition: transform .18s ease; }
.chapter-group:not(.open) > button i { transform: rotate(-90deg); }
.chapter-group.active > button { color: #2d61d7; background: #f5f8ff; }
.chapter-group.active > button > span { color: var(--brand); background: #e5edff; }
.chapter-children { position: relative; max-height: 330px; overflow: hidden; padding: 1px 4px 6px 29px; transition: max-height .23s ease, opacity .16s ease, padding .23s ease; }
.chapter-children::before { position: absolute; left: 19px; top: 0; bottom: 13px; width: 1px; background: #dfe5ef; content: ""; }
.chapter-group:not(.open) .chapter-children { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.chapter-children a { grid-template-columns: 27px minmax(0, 1fr) 10px; margin: 1px 0; padding: 8px 7px; border-radius: 8px; }
.chapter-children a::before { position: absolute; left: -10px; top: 20px; width: 9px; height: 1px; background: #dfe5ef; content: ""; }
.chapter-children a > span { width: 22px; height: 22px; border-radius: 6px; font-size: 8px; }
.chapter-children a b { font-size: 11px; }
.chapter-children a small { font-size: 8px; }

/* 中央阅读区参考系统工作区：白色内容面，不使用独立“报告卡片” */
.content { min-width: 0; min-height: 0; overflow-y: auto; scroll-behavior: smooth; background: white; }
.content-inner { width: min(100%, 920px); margin: 0 auto; padding: 28px 42px 28px; }
.breadcrumbs { display: flex; align-items: center; gap: 7px; margin: 0 0 22px; color: #99a2b1; font-size: 10px; }
.breadcrumbs i { color: #b8bec8; font-size: 14px; font-style: normal; }
.breadcrumbs b { color: #6d788a; font-weight: 600; }
.manual-card { background: white; }
.chapter-header {
  position: relative;
  min-height: 128px;
  display: flex;
  align-items: flex-start;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--line);
}
.chapter-header > div { max-width: 700px; }
.chapter-kicker { display: inline-flex; align-items: center; gap: 7px; color: var(--brand); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.chapter-kicker::before { width: 18px; height: 2px; border-radius: 2px; background: var(--brand); content: ""; }
.chapter-header h1 { margin: 15px 0 9px; color: var(--ink); font-size: clamp(28px, 4vw, 36px); font-weight: 740; line-height: 1.2; letter-spacing: -.025em; }
.chapter-header p { max-width: 620px; margin: 0; color: #6f7a8d; font-size: 14px; line-height: 1.7; }
.chapter-header > strong { display: none; }

.markdown-body { padding: 6px 0 30px; color: var(--text); font-size: 14px; line-height: 1.86; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h2, .markdown-body h3, .markdown-body h4 { scroll-margin-top: 24px; color: var(--ink); }
.markdown-body h2 { margin: 36px 0 15px; font-size: 20px; font-weight: 720; line-height: 1.4; letter-spacing: -.015em; }
.markdown-body h2::after { display: block; width: 28px; height: 3px; margin-top: 9px; border-radius: 3px; background: linear-gradient(90deg, var(--brand), #72a5ff); content: ""; }
.markdown-body h3 { margin: 27px 0 9px; font-size: 16px; font-weight: 680; }
.markdown-body h4 { margin: 23px 0 7px; font-size: 14px; font-weight: 680; }
.markdown-body p { margin: 11px 0; }
.markdown-body strong { color: #27354b; font-weight: 680; }
.markdown-body a { color: var(--brand-deep); font-weight: 600; text-decoration-color: #bacbf3; text-underline-offset: 3px; }
.markdown-body a:hover { text-decoration-color: var(--brand); }
.markdown-body ul, .markdown-body ol { margin: 12px 0; padding-left: 25px; }
.markdown-body li { margin: 6px 0; padding-left: 3px; }
.markdown-body li::marker { color: var(--brand); font-weight: 700; }
.markdown-body code { padding: 2px 6px; border: 1px solid #e1e7f1; border-radius: 6px; color: #2557b9; background: #f4f7fc; font-family: "SFMono-Regular", Consolas, monospace; font-size: .9em; }
.markdown-body blockquote { position: relative; margin: 20px 0; padding: 15px 18px 15px 48px; border: 1px solid #dfe8fb; border-radius: 10px; background: #f6f9ff; }
.markdown-body blockquote > span { position: absolute; left: 15px; top: 16px; color: var(--brand); font-size: 10px; font-weight: 700; }
.markdown-body blockquote p { margin: 0; color: #53647f; }
.table-wrap { width: 100%; margin: 18px 0 24px; overflow-x: auto; border: 1px solid #e0e5ed; border-radius: 10px; box-shadow: 0 4px 14px rgba(35, 49, 75, .035); }
.markdown-body table { width: 100%; min-width: 570px; border-collapse: collapse; background: white; font-size: 12px; }
.markdown-body th, .markdown-body td { padding: 12px 14px; border-right: 1px solid #e8ecf2; border-bottom: 1px solid #e8ecf2; text-align: left; vertical-align: top; }
.markdown-body th:last-child, .markdown-body td:last-child { border-right: 0; }
.markdown-body th { color: #34445f; background: #f5f8ff; font-weight: 680; }
.markdown-body tr:last-child td { border-bottom: 0; }
.markdown-body tbody tr:nth-child(even) { background: #fbfcfe; }
.markdown-body tbody tr:hover { background: #f7f9ff; }
.code-block { position: relative; margin: 18px 0 23px; overflow: hidden; border: 1px solid #e0e6ef; border-radius: 10px; background: #f7f9fc; }
.code-block pre { margin: 0; padding: 18px 72px 18px 18px; overflow-x: auto; white-space: pre-wrap; }
.code-block code { padding: 0; border: 0; color: #334761; background: transparent; font-size: 12px; line-height: 1.75; }
.code-block button { position: absolute; z-index: 2; right: 9px; top: 9px; padding: 4px 8px; border: 1px solid #d9e0eb; border-radius: 6px; color: #667085; background: white; font-size: 9px; cursor: pointer; }
.task-item { list-style: none; margin-left: -24px !important; display: flex; align-items: flex-start; gap: 8px; }
.task-box { flex: 0 0 auto; width: 15px; height: 15px; display: grid; place-items: center; margin-top: 6px; border: 1.5px solid #b9c4d5; border-radius: 4px; color: white; background: white; font-size: 9px; }
.task-box.checked { border-color: var(--brand); background: var(--brand); }
.image-reference { position: relative; width: 100%; margin: 22px 0 7px; padding: 7px; overflow: hidden; border: 1px solid #dde4ef; border-radius: 12px; background: #f7f9fc; cursor: zoom-in; box-shadow: 0 5px 18px rgba(33, 48, 74, .045); }
.image-reference img { display: block; width: 100%; max-height: 430px; object-fit: contain; border-radius: 7px; }
.image-reference span { position: absolute; right: 15px; bottom: 15px; padding: 5px 9px; border-radius: 6px; color: white; background: rgba(23, 32, 51, .8); font-size: 9px; opacity: 0; transition: opacity .16s ease; }
.image-reference:hover span { opacity: 1; }

.chapter-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.chapter-pager > a { min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 12px 15px; border: 1px solid #e0e5ed; border-radius: 11px; background: white; text-decoration: none; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.chapter-pager > a:hover { border-color: #cddafa; background: #f8faff; transform: translateY(-1px); }
.chapter-pager > a > span { color: var(--brand); font-size: 21px; }
.chapter-pager p { margin: 0; }
.chapter-pager small, .chapter-pager b { display: block; }
.chapter-pager small { color: var(--muted); font-size: 9px; }
.chapter-pager b { margin-top: 3px; color: var(--ink); font-size: 11px; }
.chapter-pager .next { justify-content: flex-end; text-align: right; }
.content-footer { display: flex; justify-content: space-between; padding: 17px 2px 0; color: #9aa3b1; font-size: 9px; }

.page-toc { padding: 30px 22px; border-left: 1px solid var(--line); background: white; }
.page-toc > p { margin: 0 0 16px; color: #536176; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.page-toc nav { display: flex; flex-direction: column; border-left: 1px solid #e4e8ef; }
.page-toc a { position: relative; padding: 9px 8px 9px 16px; color: #768297; font-size: 11px; line-height: 1.55; text-decoration: none; }
.page-toc a::before { position: absolute; left: -1px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: transparent; content: ""; }
.page-toc a.level-h3 { padding-left: 28px; color: #8b95a5; font-size: 10px; }
.page-toc a:hover, .page-toc a.active { color: var(--brand-deep); }
.page-toc a.active::before { background: var(--brand); }

/* 宽屏时让正文跟随左侧目录，不再固定居中产生大面积空白 */
@media (min-width: 1500px) {
  :root { --toc: 300px; }
  .content-inner {
    width: min(100%, 1200px);
    margin-left: 0;
    margin-right: auto;
    padding-left: clamp(48px, 4vw, 72px);
    padding-right: 48px;
  }
}

.search-overlay[hidden] { display: none; }
.search-overlay { position: fixed; z-index: 100; inset: 0; display: flex; justify-content: center; align-items: flex-start; padding-top: 11vh; background: rgba(18, 29, 50, .35); backdrop-filter: blur(6px); }
.search-dialog { width: min(610px, calc(100vw - 30px)); overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 14px; background: white; box-shadow: 0 24px 80px rgba(17, 30, 54, .22); }
.search-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-input > span { color: var(--brand); font-size: 21px; }
.search-input input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); font-size: 14px; background: transparent; }
.search-results { max-height: 55vh; overflow-y: auto; padding: 7px; }
.search-results a { display: grid; grid-template-columns: 30px minmax(0,1fr) 18px; align-items: center; gap: 10px; padding: 11px; border-radius: 8px; text-decoration: none; }
.search-results a:hover { background: #f3f6fc; }
.search-results a > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-size: 8px; font-weight: 700; }
.search-results p { margin: 0; }
.search-results b, .search-results small { display: block; }
.search-results b { color: var(--ink); font-size: 12px; }
.search-results small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.search-results i { color: var(--brand); font-size: 18px; font-style: normal; }
.search-results .empty { display: flex; flex-direction: column; align-items: center; padding: 36px; color: var(--muted); }
.search-results .empty b { color: var(--ink); }
.search-results .empty span { margin-top: 5px; font-size: 10px; }

.lightbox { max-width: min(1100px, 92vw); max-height: 90vh; padding: 10px; border: 0; border-radius: 12px; background: white; box-shadow: 0 28px 90px rgba(10, 20, 38, .35); }
.lightbox::backdrop { background: rgba(10, 18, 31, .68); backdrop-filter: blur(6px); }
.lightbox img { display: block; max-width: calc(92vw - 20px); max-height: calc(85vh - 44px); border-radius: 7px; object-fit: contain; }
.lightbox p { margin: 9px 4px 1px; color: var(--text); font-size: 10px; text-align: center; }
.lightbox button { position: absolute; right: 15px; top: 15px; width: 32px; height: 32px; border: 0; border-radius: 8px; color: white; background: rgba(15, 25, 42, .78); font-size: 20px; cursor: pointer; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: 24px; padding: 9px 14px; border-radius: 8px; color: white; background: #202b3f; box-shadow: 0 10px 26px rgba(15, 25, 42, .2); font-size: 11px; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  :root { --toc: 210px; --sidebar: 248px; }
  .content-inner { padding-inline: 32px; }
  .page-toc { padding-inline: 16px; }
  .page-toc a { font-size: 10px; }
  .page-toc a.level-h3 { font-size: 9px; }
}

@media (max-width: 960px) {
  .manual-shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .page-toc { display: none; }
}

@media (max-width: 740px) {
  :root { --topbar: 60px; }
  .topbar { padding-inline: 12px; }
  .brand small, .search-trigger, .system-link span { display: none; }
  .system-link { padding-inline: 12px; }
  .menu-button { display: block; }
  .manual-shell { display: block; }
  .sidebar { position: fixed; z-index: 45; left: 0; top: var(--topbar); bottom: 0; width: min(86vw, 310px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 18px 0 50px rgba(15, 28, 48, .15); }
  .sidebar.open { transform: translateX(0); }
  .content { height: calc(100vh - var(--topbar)); }
  .content-inner { padding: 19px 20px 22px; }
  .breadcrumbs { margin-bottom: 18px; }
  .chapter-header { min-height: 120px; padding-bottom: 25px; }
  .chapter-header h1 { font-size: 27px; }
  .chapter-header p { font-size: 12px; }
  .markdown-body { padding-bottom: 28px; font-size: 13px; }
  .markdown-body h2 { margin-top: 32px; font-size: 18px; }
  .chapter-pager { grid-template-columns: 1fr; }
  .chapter-pager > span { display: none; }
  .content-footer { padding-inline: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
