:root {
  --red: #e0234e;
  --red-soft: #fff1f4;
  /* 交互色：青色系，与行内代码 #3DAAD6 同一色相 */
  /* 文字层：深青，白底对比度 ~5.6:1，行内代码与链接共用 */
  --accent: #15708f;
  --accent-hover: #0f5a74;
  /* 装饰层：亮青，只用于竖条、描边、暗底悬停，不承载正文 */
  --accent-bright: #3daad6;
  --accent-soft: #ecf7fd;
  --ink: #14161d;
  --ink-2: #3d4250;
  --ink-3: #6b7180;
  --ink-4: #9aa0ad;
  --line: #e9eaf0;
  --line-2: #f1f2f6;
  --bg: #ffffff;
  --bg-soft: #fbfbfd;
  --code-bg: #f8f9fc;
  --radius: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono",
    Menlo, "Sarasa Mono SC", "Noto Sans Mono CJK SC", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- 进度条 ---------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: transparent; pointer-events: none;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent));
  transition: width .1s linear;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  height: 60px; padding: 0 22px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.menu-btn {
  display: none; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; align-items: center; justify-content: center;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: block; object-fit: cover;
  box-shadow: 0 2px 8px rgba(15, 37, 48, .22), 0 0 0 1px rgba(15, 37, 48, .06);
}
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-text em { font-style: normal; font-weight: 500; color: var(--ink-4); font-size: 12.5px; margin-left: 6px; }
.crumb {
  font-size: 13px; color: var(--ink-4); padding-left: 18px; border-left: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb span { margin: 0 6px; color: #d4d7df; }

.search-trigger {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px 0 12px; min-width: 210px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  color: var(--ink-4); font-size: 13px; font-family: inherit; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: #d9dbe4; box-shadow: 0 2px 10px rgba(20, 22, 29, .05); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd {
  font-family: var(--sans); font-size: 11px; color: var(--ink-4);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: var(--bg-soft);
}
.progress-chip {
  font-size: 12.5px; color: var(--ink-4); white-space: nowrap;
  padding: 4px 10px; border-radius: 20px; background: var(--bg-soft); border: 1px solid var(--line);
}
.progress-chip b { color: var(--accent); font-weight: 600; }

/* ---------- 布局 ---------- */
.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 220px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow-y: auto;
  padding: 22px 10px 60px 18px;
  border-right: 1px solid var(--line-2);
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e4ec; border-radius: 3px; }

.nav-group { margin-bottom: 4px; }
.nav-group-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; font-size: 12.5px; font-weight: 600; letter-spacing: .3px;
  color: var(--ink-4); text-transform: uppercase; cursor: pointer; user-select: none;
  border-radius: 7px;
}
.nav-group-title:hover { background: var(--bg-soft); color: var(--ink-3); }
.nav-group-title span::before {
  content: ''; display: inline-block; width: 0; height: 0; margin-right: 7px;
  border-left: 4px solid #cdd1db; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
  transition: transform .15s; vertical-align: 1px;
}
.nav-group.open .nav-group-title span::before { transform: rotate(90deg); }
.nav-group-title em { font-style: normal; font-size: 11px; color: #c3c6d0; font-weight: 500; }
.nav-items { display: none; padding: 2px 0 8px; }
.nav-group.open .nav-items { display: block; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 5.5px 10px; margin: 1px 0; border-radius: 7px;
  font-size: 13.8px; color: var(--ink-3); line-height: 1.5;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  border-left-color: var(--accent-bright);
}
.nav-item.pending { color: #c8ccd6; cursor: default; pointer-events: none; }
.nav-item.pending i {
  font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 3px;
  background: #f3f4f8; color: #b9bdc9;
}

/* ---------- 正文 ---------- */
.main { min-width: 0; padding: 34px 54px 90px; }
.article { max-width: 780px; }

.article-head { margin-bottom: 26px; }
.article h1 {
  font-size: 33px; line-height: 1.3; font-weight: 700; letter-spacing: -.4px;
  color: var(--ink); margin: 0 0 12px;
}
.meta { display: flex; align-items: center; gap: 14px; font-size: 12.5px; }
.meta a { color: var(--ink-4); }
.meta a:hover { color: var(--accent); }
.meta .md-link {
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-3);
}
.meta .md-link:hover { border-color: var(--accent-bright); color: var(--accent); }

.article h2 {
  font-size: 22px; font-weight: 650; color: var(--ink); letter-spacing: -.2px;
  margin: 46px 0 14px; padding-top: 6px;
  scroll-margin-top: 78px;
}
.article h3 {
  font-size: 17.5px; font-weight: 650; color: var(--ink);
  margin: 32px 0 10px; scroll-margin-top: 78px;
}
.article h4, .article h5, .article h6 {
  font-size: 15.5px; font-weight: 650; color: var(--ink);
  margin: 26px 0 8px; scroll-margin-top: 78px;
}
.article .anchor {
  opacity: 0; margin-left: 8px; font-weight: 400; color: #cfd3dd;
  text-decoration: none; font-size: .85em;
}
.article h2:hover .anchor, .article h3:hover .anchor, .article h4:hover .anchor { opacity: 1; }

.article p { margin: 0 0 15px; }
.article strong { color: var(--ink); font-weight: 600; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; }
.article li { margin: 5px 0; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }

/* 行内代码 */
.article code {
  font-family: var(--mono); font-size: 13px;
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 5px; border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(61, 170, 214, .32);
}
.article pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 13px; box-shadow: none; border-radius: 0; }

/* 引用 */
.article blockquote {
  margin: 18px 0; padding: 12px 18px;
  border-left: 3px solid #d8dbe6; background: var(--bg-soft);
  color: var(--ink-3); border-radius: 0 8px 8px 0;
}
.article blockquote p:last-child { margin-bottom: 0; }

/* 提示块 */
.callout {
  margin: 20px 0; padding: 13px 16px 13px 15px; border-radius: 10px;
  border: 1px solid; font-size: 14.5px;
}
.callout p:last-child { margin-bottom: 0; }
.callout-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; margin-bottom: 3px;
}
.callout.tip { background: var(--accent-soft); border-color: #d3ecf9; }
.callout.tip .callout-label { color: var(--accent); }
.callout.warn { background: #fff9f0; border-color: #fae6c8; }
.callout.warn .callout-label { color: #c07b16; }
.callout.danger { background: #fff5f5; border-color: #f8d7d9; }
.callout.danger .callout-label { color: #c02b32; }

/* 代码卡片 */
.code-card {
  margin: 20px 0; border: 1px solid #222a3a; border-radius: 12px;
  background: #1b2130; overflow: hidden;
  box-shadow: 0 8px 22px rgba(18, 24, 38, .16), 0 1px 0 rgba(255, 255, 255, .04) inset;
}
.code-file {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .2px;
  color: #93a0ba;
  background: #161b26; border-bottom: 1px solid #222a3a;
  cursor: pointer;
  transition: color .15s;
}
.code-file:hover { color: #e8eefc; }
.code-file.copied { color: #9ece6a; }
.code-file .dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #ff5f57; box-shadow: 15px 0 0 #febc2e, 30px 0 0 #28c840;
  margin-right: 26px;
}
.code-card pre {
  margin: 0; padding: 16px 18px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.75;
  color: #d7e0f0;
  tab-size: 2;
}
.code-card .tabs {
  display: flex; gap: 2px; padding: 6px 10px 0; background: #161b26;
  border-bottom: 1px solid #222a3a;
}
.code-card .tab {
  border: 0; background: none; font-family: var(--sans); font-size: 12px;
  color: #8492ad; padding: 7px 13px; border-radius: 7px 7px 0 0; cursor: pointer;
  transition: color .15s;
}
.code-card .tab:hover { color: #c3cde0; }
.code-card .tab.active { background: #1b2130; color: #e8eefc; font-weight: 600; }
.code-card .pane { display: none; }
.code-card .pane.active { display: block; }

/* 高亮配色 */
.hljs-comment, .hljs-quote { color: #6d7b95; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section { color: #c792ea; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #c3e88d; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #f78c6c; }
.hljs-title, .hljs-title.class_, .hljs-title.function_ { color: #82aaff; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #7fdbca; }
.hljs-built_in, .hljs-type { color: #ffcb6b; }
.hljs-meta, .hljs-link { color: #89ddff; }
.hljs-deletion { color: #ff6b81; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }
.hljs-meta { color: #7c8497; }
.hljs-deletion { color: #c0392b; }

/* 表格 */
.article table {
  width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px;
  display: block; overflow-x: auto;
}
.article table th, .article table td {
  border: 1px solid var(--line); padding: 9px 13px; text-align: left; vertical-align: top;
}
.article table th { background: var(--bg-soft); font-weight: 600; color: var(--ink); }
.article table tr:nth-child(even) td { background: #fcfcfe; }
.article table code { white-space: nowrap; }

/* 图片 */
.article img {
  max-width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--line); margin: 20px 0;
  box-shadow: 0 4px 18px rgba(20, 22, 29, .05);
}
.article figure { margin: 22px 0; }
.article figure img { margin: 0; }

/* 文件树 */
.file-tree {
  font-family: var(--mono); font-size: 13px; line-height: 1.75;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; margin: 18px 0; overflow-x: auto; color: var(--ink-3);
}
.file-tree .item { padding: 1px 0; }
.file-tree .children {
  margin-left: 3px; padding-left: 16px;
  border-left: 1px dashed #dcdfe9;
}

/* 分页 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.pager-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.pager-item:hover { text-decoration: none; border-color: #d9dbe4; box-shadow: 0 3px 14px rgba(20, 22, 29, .05); }
.pager-item small { font-size: 11.5px; color: var(--ink-4); letter-spacing: .4px; }
.pager-item strong { font-size: 14.5px; font-weight: 600; }
.pager-item.next { text-align: right; align-items: flex-end; }
.pager-item.empty { border: 0; }

/* ---------- 右目录 ---------- */
.toc {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow-y: auto;
  padding: 38px 18px 60px 0; font-size: 13px;
}
.toc-title { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; color: var(--ink-4); text-transform: uppercase; margin-bottom: 10px; }
.toc-body a {
  display: block; padding: 3.5px 0 3.5px 11px; color: var(--ink-3);
  border-left: 1px solid var(--line); line-height: 1.6;
}
.toc-body a:hover { color: var(--ink); text-decoration: none; border-left-color: #cfd3dd; }
.toc-body a.active { color: var(--accent); border-left-color: var(--accent-bright); font-weight: 500; }
.toc-body a.lv3 { padding-left: 22px; font-size: 12.5px; color: var(--ink-4); }

/* ---------- 搜索 ---------- */
.search-modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 22, 29, .32);
  backdrop-filter: blur(3px); display: grid; place-items: start center; padding-top: 12vh;
}
.search-modal[hidden] { display: none; }
.search-box {
  width: min(620px, 92vw); background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(20, 22, 29, .24); overflow: hidden;
  border: 1px solid var(--line);
}
.search-box input {
  width: 100%; border: 0; outline: 0; padding: 18px 22px; font-size: 15px;
  font-family: inherit; color: var(--ink); border-bottom: 1px solid var(--line-2);
}
.search-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.search-results a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 8px; color: var(--ink-2); font-size: 14px;
}
.search-results a:hover, .search-results a.sel { background: var(--bg-soft); text-decoration: none; }
.search-results a small { color: var(--ink-4); font-size: 11.5px; }
.search-empty { padding: 26px; text-align: center; color: var(--ink-4); font-size: 13.5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 30px 40px 80px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: flex; }
  .crumb { display: none; }
  .progress-chip { display: none; }
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; z-index: 45;
    background: #fff; transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 10px 40px rgba(20, 22, 29, .12);
  }
  body.nav-open .sidebar { transform: none; }
  .main { padding: 24px 20px 70px; }
  .article h1 { font-size: 26px; }
  .article h2 { font-size: 19.5px; }
  .pager { grid-template-columns: 1fr; }
}

/* 复制按钮 */
.code-card { position: relative; }
.copy-btn {
  position: absolute; top: 7px; right: 9px; z-index: 2;
  border: 1px solid #2f394c; background: rgba(255, 255, 255, .07);
  color: #a3b0c8; font-size: 11.5px; font-family: var(--sans);
  padding: 3px 9px; border-radius: 6px; cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s, background .15s;
}
.code-card:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: #7fd6f0; border-color: #2f5d72; background: rgba(255, 255, 255, .12); }
.code-card.has-tabs .copy-btn { top: 7px; }
/* 没有文件名条的卡片：按钮放到右下，避免压住第一行代码 */
.code-card:not(:has(.code-file)):not(.has-tabs) .copy-btn { top: auto; bottom: 8px; }

/* 代码区滚动条 */
.code-card pre::-webkit-scrollbar { height: 10px; }
.code-card pre::-webkit-scrollbar-track { background: transparent; }
.code-card pre::-webkit-scrollbar-thumb {
  background: #33405a; border-radius: 8px; border: 2px solid #1b2130;
}
.code-card pre::-webkit-scrollbar-thumb:hover { background: #44536f; }



/* 原文的折叠块 <details> */
.article details {
  margin: 18px 0; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfbfd;
}
.article details[open] { padding-bottom: 6px; }
.article details > summary {
  padding: 12px 0; cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 500; color: var(--ink-3);
}
.article details > summary::-webkit-details-marker { display: none; }
.article details > summary::before {
  content: '▸'; display: inline-block; margin-right: 8px;
  color: #9aa0ae; transition: transform .15s;
}
.article details[open] > summary::before { transform: rotate(90deg); }
.article details > summary:hover { color: var(--accent); }

/* 原文的折叠块 <details> */
.article details {
  margin: 18px 0; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfbfd;
}
.article details[open] { padding-bottom: 6px; }
.article details > summary {
  padding: 12px 0; cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 500; color: var(--ink-3);
}
.article details > summary::-webkit-details-marker { display: none; }
.article details > summary::before {
  content: '▸'; display: inline-block; margin-right: 8px;
  color: #9aa0ae; transition: transform .15s;
}
.article details[open] > summary::before { transform: rotate(90deg); }
.article details > summary:hover { color: var(--accent); }

/* 原文直出的 <pre>（如 cron 字段图例） */
.article > pre {
  margin: 20px 0; padding: 16px 18px; overflow-x: auto;
  background: #1b2130; border: 1px solid #222a3a; border-radius: 12px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.75; color: #d7e0f0;
  box-shadow: 0 8px 22px rgba(18, 24, 38, .16);
}
.article > pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 13.5px; box-shadow: none; border-radius: 0; }
