
:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --text: #1b1c1f;
  --muted: #6b7280;
  --border: #e5e5e8;
  --accent: #e5484d;
  --accent-2: #c22f36;
  --accent-soft: #fdecec;
  --chart-a: #e5484d;
  --chart-b: #3b82f6;
  --ok-bg: #e9f7ef;
  --ok-fg: #166534;
  --warn-bg: #fff5e5;
  --warn-fg: #b45309;
  --cancel-bg: #f1f1f3;
  --cancel-fg: #52525b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --surface: #17181b;
    --surface-2: #1f2024;
    --text: #e7e7ea;
    --muted: #9a9aa5;
    --border: #2c2d33;
    --accent: #ff6369;
    --accent-2: #ff8b8f;
    --accent-soft: #3a1d1f;
    --chart-a: #ff6369;
    --chart-b: #60a5fa;
    --ok-bg: #12301f;
    --ok-fg: #7ee2a8;
    --warn-bg: #33230c;
    --warn-fg: #f5c26b;
    --cancel-bg: #26272c;
    --cancel-fg: #b4b4bf;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  overflow-x: hidden;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
main { padding: 32px 0 72px; min-height: 60vh; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 60px; min-width: 0; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 700; font-size: 15px; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.nav { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 11px; border-radius: 999px; color: var(--muted);
  font-size: 14px; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 650; }

/* 标题区 */
.hero { padding: 8px 0 2px; }
.eyebrow {
  margin: 0 0 6px; color: var(--accent-2); font-size: 12.5px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
h1.page-title { margin: 0 0 8px; font-size: clamp(26px, 4.2vw, 36px); line-height: 1.22; letter-spacing: -.02em; }
.hero .sub, .sub { margin: 0; color: var(--muted); font-size: 14px; }
.header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 卡片与网格 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin: 0; min-width: 0;
}
.grid > * { min-width: 0; }
.card > h2 { margin: 0 0 14px; font-size: 17px; letter-spacing: -.01em; }
.card > h2 .muted { font-weight: 400; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.section-head .meta { color: var(--muted); font-size: 13px; }

/* 指标卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 22px 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value {
  font-size: 28px; font-weight: 750; line-height: 1.2;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 2px 0 1px;
}
.stat .sub { color: var(--muted); font-size: 12px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { background: var(--surface-2); border-radius: 12px; padding: 11px 12px; }
.mini .k { color: var(--muted); font-size: 12px; }
.mini .v { font-size: 17px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .full { grid-column: 1 / -1; }

/* 笔记卡片 */
.note-card {
  display: flex; flex-direction: column; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.note-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 14px 34px rgba(16, 24, 40, .10); }
.thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top center; display: block; background: var(--surface-2); }
.thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  color: var(--muted); font-size: 13px;
}
.note-card .body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.note-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-card .date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.note-card h3 { margin: 0; font-size: 15.5px; line-height: 1.45; letter-spacing: -.01em; }
.note-card .stats { color: var(--muted); font-size: 12.5px; margin-top: auto; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 2px 8px; font-size: 11.5px; }
.tag.more { background: transparent; border: 1px dashed var(--border); }

/* 状态徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap;
}
.badge.published { background: var(--ok-bg); color: var(--ok-fg); }
.badge.scheduled { background: var(--warn-bg); color: var(--warn-fg); }
.badge.cancelled, .badge.unknown { background: var(--cancel-bg); color: var(--cancel-fg); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }

/* 表格 */
.table-wrap { overflow-x: auto; max-width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; white-space: nowrap; color: var(--text); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.wrap-cell { min-width: 280px; max-width: 460px; white-space: normal; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
.md-table { min-width: 480px; }

/* 正文排版 */
.prose { font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1 { font-size: 1.55rem; line-height: 1.35; margin: 0 0 .7em; letter-spacing: -.02em; }
.prose h2 { font-size: 1.18rem; margin: 2em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.03rem; margin: 1.6em 0 .45em; }
.prose h4, .prose h5, .prose h6 { font-size: .98rem; margin: 1.3em 0 .4em; }
.prose p { margin: .75em 0; }
.prose ul, .prose ol { margin: .7em 0; padding-left: 1.5em; }
.prose li { margin: .22em 0; }
.prose li > ul, .prose li > ol { margin: .25em 0; }
.prose blockquote {
  margin: 1em 0; padding: .65em 1em; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--muted);
}
.prose blockquote p { margin: .2em 0; }
.prose code {
  font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  padding: .12em .35em; border-radius: 4px; overflow-wrap: break-word;
}
.prose pre.code {
  background: #14161a; color: #e6e6eb; padding: 14px 16px; border-radius: 10px;
  overflow-x: auto; max-width: 100%; min-width: 0; line-height: 1.55;
  border: 1px solid rgba(255, 255, 255, .06);
}
.prose pre.code code { background: none; padding: 0; color: inherit; font-size: 12.5px; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.7em 0; }
.prose mark { background: var(--accent-soft); color: var(--accent-2); padding: 0 .15em; border-radius: 3px; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.anchor { opacity: 0; margin-left: .35em; color: var(--muted); font-weight: 400; text-decoration: none; font-size: .75em; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }
.xref { border-bottom: 1px dashed var(--border); }

/* SVG 图表 */
.chart { margin-top: 4px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11.5px; }
.chart .value { fill: var(--text); font-size: 11px; font-weight: 650; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 2px 0 10px; color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* 折叠块 */
details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
details > summary { cursor: pointer; padding: 13px 16px; font-weight: 650; list-style: none; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--muted); }
details[open] > summary::before { content: "▾ "; }
details .details-body { padding: 0 16px 16px; }
details.raw { margin-top: 12px; background: var(--surface-2); }
details.raw pre { margin: 0; white-space: pre-wrap; font-size: 12px; font-family: var(--mono); }
details.csv-block { margin: 12px 0; }
details.csv-block > summary { padding: 12px 15px; }
details.plan-block { margin: 12px 0; }

/* 图片墙 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery a {
  position: relative; display: block; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.gallery img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: transform .2s ease; }
.gallery a:hover img { transform: scale(1.025); }
.gallery .idx {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .62);
  color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px;
}
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center;
  justify-content: center; padding: 24px; background: rgba(0, 0, 0, .84);
}
.lightbox.on { display: flex; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }

/* 时间线 */
.timeline { list-style: none; margin: 0; padding: 0; max-height: 430px; overflow: auto; }
.timeline li {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 2px;
  border-bottom: 1px dashed var(--border); font-size: 13px;
}
.timeline li:last-child { border-bottom: none; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline .path { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.timeline .meta { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: 12px; }

/* 待办 / 列表 */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.checklist li:last-child { border-bottom: none; }
.checklist .box {
  flex: 0 0 auto; width: 16px; height: 16px; margin-top: 3px;
  border: 1.5px solid var(--border); border-radius: 5px; background: var(--surface);
}
.checklist .done { color: var(--muted); text-decoration: line-through; }
.empty {
  padding: 20px; border: 1px dashed var(--border); border-radius: 12px;
  color: var(--muted); text-align: center; font-size: 14px;
}

/* 文档元信息 / 锚点导航 */
.doc-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: -2px 0 12px; color: var(--muted); font-size: 12.5px;
}
.doc-meta code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.toc {
  position: sticky; top: 60px; z-index: 30;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 0; margin: 0 0 18px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.toc::-webkit-scrollbar { display: none; }
.toc .toc-label { color: var(--muted); font-size: 12px; align-self: center; padding-right: 2px; }
.toc a {
  padding: 4px 11px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-size: 13px; white-space: nowrap;
}
.toc a:hover { color: var(--accent-2); border-color: var(--accent); text-decoration: none; }
.doc-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.doc-index a {
  display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 13.5px; min-width: 0;
}
.doc-index a span:first-child { overflow-wrap: anywhere; }
.doc-index a:hover { border-color: var(--accent); text-decoration: none; }
.doc-index .n { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* 评论 / 分布条 */
.comment-text { min-width: 260px; max-width: 420px; white-space: normal; line-height: 1.65; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.bar-label { flex: 0 0 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #f59e0b); border-radius: 999px; }
.bar-value { flex: 0 0 32px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--muted); }

/* 页脚 */
.footer { border-top: 1px solid var(--border); padding: 22px 0; color: var(--muted); font-size: 12.5px; }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer .dot-sep { margin: 0 6px; opacity: .5; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  main { padding: 24px 0 56px; }
  .topbar .wrap { gap: 10px; height: 56px; }
  .brand { font-size: 14px; }
  .brand .name { display: none; }
  .toc { top: 56px; }
  .stat .value { font-size: 24px; }
  .card { padding: 16px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .mini-grid { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 104px minmax(0, 1fr); }
  .timeline li { flex-wrap: wrap; }
  .timeline .meta { margin-left: 0; }
  .doc-index { grid-template-columns: 1fr; }
}
