:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-hover: #f2f4f7;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2937;
  --text-mid: #4b5563;
  --text-soft: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -.5px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.2px;
}

.brand p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

.header-meta {
  font-size: 12.5px;
  color: var(--text-soft);
  text-align: right;
}

.header-meta code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11.5px;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 28px 0 20px;
}

.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-num {
  font-size: 24px;
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -.5px;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 2px;
}

/* ---------- toolbar ---------- */
.toolbar { margin-bottom: 18px; }

#search {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

#search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---------- project grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding-bottom: 8px;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s, transform .15s;
}

a.card:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.card-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.card-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 640;
  color: var(--text);
  letter-spacing: -.1px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.card-desc {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--text-mid);
  line-height: 1.6;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-mid);
}

.tag-status { background: var(--green-soft); border-color: #a7f3d0; color: var(--green); }
.tag-wip { background: var(--amber-soft); border-color: #fde68a; color: var(--amber); }

.card-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-soft);
}

.card-foot .dot { color: var(--border-strong); }

/* ---------- empty / footer ---------- */
.empty {
  text-align: center;
  color: var(--text-soft);
  padding: 48px 0;
  font-size: 14px;
}

.site-footer {
  margin-top: 40px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-soft);
}

.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- project page ---------- */
.crumbs {
  font-size: 13px;
  color: var(--text-soft);
  margin: 22px 0 14px;
}

.crumbs a { color: var(--text-soft); }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { margin: 0 7px; color: var(--border-strong); }

.proj-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}

.proj-hero h2 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 660;
  letter-spacing: -.3px;
}

.proj-hero .desc {
  margin: 0 0 14px;
  color: var(--text-mid);
  font-size: 14px;
}

.proj-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12.5px;
  color: var(--text-soft);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tabs button {
  font: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}

.tabs button:hover { color: var(--text); background: var(--bg-hover); }

.tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.doc-list { display: flex; flex-direction: column; gap: 10px; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 18px;
  transition: border-color .15s, box-shadow .15s;
}

a.doc-item:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.doc-ico {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.doc-main { flex: 1; min-width: 0; }

.doc-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.doc-note { font-size: 12.5px; color: var(--text-soft); }

.doc-go { font-size: 13px; color: var(--primary); white-space: nowrap; }

.proto-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.btn {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }

.proto-frame {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.proto-frame iframe {
  display: block;
  width: 100%;
  height: 720px;
  border: 0;
}

.proto-tip {
  font-size: 12.5px;
  color: var(--text-soft);
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.pane-empty {
  background: #fff;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
}

/* ---------- guide ---------- */
.guide {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 26px 0 0;
  overflow: hidden;
}

.guide summary {
  padding: 13px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  list-style: none;
}

.guide summary::-webkit-details-marker { display: none; }
.guide summary::before { content: "▸ "; color: var(--text-soft); }
.guide[open] summary::before { content: "▾ "; }
.guide summary:hover { background: var(--bg-hover); }

.guide-body {
  padding: 4px 18px 18px;
  font-size: 13.5px;
  color: var(--text-mid);
  border-top: 1px solid var(--border);
}

.guide-body ol { padding-left: 22px; margin: 12px 0; }
.guide-body li { margin-bottom: 6px; }

.guide-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
}

.guide-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- split layout (project page) ---------- */
.wrap-wide { max-width: none; }

.split {
  display: block;
}

.side {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.side-group { margin-bottom: 16px; }

.side-group-title {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .4px;
  color: var(--text-soft);
  text-transform: uppercase;
  padding: 0 6px;
  margin-bottom: 6px;
}

.side-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 8px;
  border-radius: 7px;
  color: var(--text);
  position: relative;
}

.side-item:hover { background: var(--bg-hover); text-decoration: none; }

.side-item.active {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .18);
}

.side-badge {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.badge-doc { background: var(--primary-soft); color: var(--primary); border-color: #c7d9fb; }
.badge-proto { background: var(--green-soft); color: var(--green); border-color: #a7f3d0; }
.badge-image { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }

.side-text { flex: 1; min-width: 0; }

.side-name {
  display: block;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-note {
  display: block;
  font-size: 11.5px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.side-del {
  flex: none;
  border: 0;
  background: none;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 3px;
  border-radius: 4px;
  opacity: 0;
}

.side-item:hover .side-del { opacity: 1; }
.side-del:hover { color: #dc2626; background: #fef2f2; }

.side-upload { border-top: 1px solid var(--border); padding-top: 14px; }

.btn-block { display: block; width: 100%; text-align: center; }

.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }

.side-hint {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 8px;
  line-height: 1.5;
  word-break: break-all;
}

.side-back {
  display: block;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-soft);
}

.side-back:hover { color: var(--primary); }

.stage {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stage-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.stage-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-actions { display: flex; gap: 8px; flex: none; }

.stage-body { flex: 1; min-height: 0; position: relative; background: var(--bg-soft); overflow: hidden; }

.stage-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.stage-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

.stage-img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #fff;
}

.stage-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13.5px;
}

.stage-empty-ico { font-size: 30px; opacity: .45; }

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .stage { position: static; height: 78vh; }
  .proto-frame iframe { height: 520px; }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .wrap { padding: 0 16px; }
  .header-meta { text-align: left; }
  .proto-frame iframe { height: 520px; }
  .stage { height: 70vh; }
}

/* ---------- 文档外壳 ---------- */
.doc-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg, #f8fafc);
}

/* ---------- 三栏文档阅读（左导航 / 中 demo / 右需求） ---------- */
.doc3 {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(420px, 46vw) minmax(0, 1fr);
  /* 关键：行高约束为可用高度，左/中栏各自 overflow 滚动，不随内容撑开 */
  grid-auto-rows: minmax(0, 1fr);
  /* 采用与参考需求文档一致的 slate-blue 文档视觉体系 */
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --border: #e2e8f0;
  --text-soft: #64748b;
  --text-mid: #475569;
  --bg-soft: #f8fafc;
  --bg-hover: #eef6ff;
  background: var(--bg);
}

/* 左侧导航 */
.doc-nav {
  border-right: 1px solid var(--line);
  overflow: auto;
  background: #f8fafc;
  box-shadow: 1px 0 0 rgba(15, 23, 42, .02);
}

.doc-nav-brand {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 18px 16px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--line);
}

.doc-nav-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.doc-nav-brand-title::before {
  content: "";
  width: 8px;
  height: 18px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.doc-nav-brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.doc-nav-scroll { padding: 16px 12px 22px; }

.nav-section { margin: 14px 0 16px; padding: 10px 0 8px; border-top: 1px solid var(--line); }
.nav-section:first-of-type { border-top: 0; margin-top: 0; }

.nav-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 6px 8px;
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.nav-section-title::before {
  content: attr(data-index);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #eaf1ff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
}

.nav-count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.tree-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
  margin: 2px 0;
  padding: 0 10px 0 18px;
  border-radius: 7px;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  white-space: normal;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.tree-row::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #cbd5e1;
  transform: translateY(-50%);
}

.tree-row:hover { background: #eef6ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #dbeafe; }
.tree-row:hover::before { background: #60a5fa; }

.tree-row.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .18);
  font-weight: 800;
}
.tree-row.active::before { background: #fff; }
.tree-row.active::after {
  content: "当前";
  flex: 0 0 auto;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.tree-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.doc-nav-demo {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 10.5px;
  font-weight: 800;
  font-style: normal;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
}

/* 中间内容 */
.doc-content { overflow: auto; background: #fff; }

.doc-content-inner { max-width: none; padding: 28px 32px 80px; }

/* 需求描述编辑栏（粘顶，仅功能页显示） */
.doc-edit-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.doc-edit-bar-title { font-size: 13px; font-weight: 800; color: var(--text); }
.doc-edit-bar-status { font-size: 12px; color: #64748b; }
.doc-edit-bar-status.is-ok { color: #15803d; font-weight: 700; }
.doc-edit-bar-status.is-warn { color: #b1541a; font-weight: 700; }
.doc-edit-bar-status.is-err { color: #c4340d; font-weight: 700; }
.doc-edit-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.doc-edit-bar-note { font-size: 12px; color: #94a3b8; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #64748b;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }

.doc-content-inner.editing[contenteditable="true"] {
  outline: 2px dashed #2563eb;
  outline-offset: -2px;
  min-height: 240px;
  cursor: text;
  background: #fff;
}

/* 需求内容组件样式（作用域限定在 .doc-content-inner，避免与站点 .card 冲突） */
.doc-content-inner h1 { margin: 0 0 14px; font-size: 30px; font-weight: 900; color: var(--text); letter-spacing: -.3px; }
.doc-content-inner h2 { margin: 32px 0 14px; font-size: 24px; line-height: 1.3; font-weight: 900; color: var(--text); }
.doc-content-inner h3 {
  margin: 20px 0 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: #f8fafc; font-size: 17px; font-weight: 900; color: var(--text); display: flex; align-items: center; gap: 10px;
}
.doc-content-inner p { margin: 0 0 12px; color: #334155; line-height: 1.65; }
.doc-content-inner .card { border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.doc-content-inner .pain-grid, .doc-content-inner .stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 4px 0 16px; }
.doc-content-inner .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.doc-content-inner .stat-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.doc-content-inner .stat-num { font-size: 24px; font-weight: 900; line-height: 1.1; }
.doc-content-inner .stat-label { margin-top: 2px; color: #64748b; font-size: 12px; font-weight: 700; }
.doc-content-inner .caption { margin: 10px 0 0; color: #64748b; font-size: 12px; }
.doc-content-inner .flow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 14px; }
.doc-content-inner .flow-step { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid #bfdbfe; border-radius: 7px; background: #eff6ff; color: #1e40af; font-size: 14px; font-weight: 850; }
.doc-content-inner .flow-arrow { color: #94a3b8; font-weight: 900; }
.doc-content-inner .hot { color: #e11d48; font-weight: 900; }
.doc-content-inner .problem { margin: 0; padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1e3a8a; font-size: 14px; }
.doc-content-inner table { width: 100%; margin: 0 0 14px; border-collapse: collapse; background: #fff; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.doc-content-inner th, .doc-content-inner td { padding: 10px 12px; border: 1px solid var(--line); vertical-align: top; text-align: left; line-height: 1.55; }
.doc-content-inner th { background: #f8fafc; color: #334155; font-weight: 800; white-space: nowrap; }
.doc-content-inner .req-table .c-prio { width: 76px; }
.doc-content-inner .req-table .c-rule { width: 34%; }
.doc-content-inner .prio { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.doc-content-inner .prio-p0 { background: #ffece5; color: #c4340d; }
.doc-content-inner .prio-p1 { background: #fff4e6; color: #b1541a; }
.doc-content-inner .prio-p2 { background: #f2f4f7; color: #667085; }
.doc-content-inner .muted { color: #94a3b8; }
.doc-content-inner .demo-link { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 4px 11px; border-radius: 6px; background: #0f172a; color: #fff; font-size: 12px; font-weight: 700; text-decoration: none; }
.doc-content-inner .demo-link:hover { background: #1e293b; }
.doc-content-inner .mod-tag { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 2px 8px; border-radius: 6px; background: #e0e7ff; color: #4338ca; font-size: 11px; font-weight: 800; font-style: normal; }
.doc-content-inner details.detail { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.doc-content-inner details.detail summary { cursor: pointer; padding: 10px 14px; background: #fcfdff; font-size: 13px; font-weight: 750; color: #1f2937; display: flex; align-items: center; gap: 8px; }
.doc-content-inner details.detail summary .prio { margin-left: auto; }
.doc-content-inner details.detail ul { margin: 0; padding: 10px 16px 14px 34px; }
.doc-content-inner details.detail li { margin: 5px 0; color: #334155; font-size: 13px; }
.doc-content-inner ol { padding-left: 22px; margin: 0 0 12px; }
.doc-content-inner li { margin: 4px 0; color: #334155; }

/* 需求文本层级（替代原三列需求表）：页面 → 区域 → 元素 → 需求详情 / 交互规则 */
.doc-content-inner .rq { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 4px; }

.doc-content-inner .rq-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.doc-content-inner .rq-group-t {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f6f8fb;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 900;
  color: #475569;
  letter-spacing: .4px;
}
.doc-content-inner .rq-group-t::before {
  content: "";
  flex: 0 0 auto;
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--primary);
}
.doc-content-inner .rq-item { padding: 12px 14px; }
.doc-content-inner .rq-item + .rq-item { border-top: 1px dashed #e8edf4; }

.doc-content-inner .rq-elem {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
}
.doc-content-inner .rq-name { font-weight: 800; }

.doc-content-inner .rq-sec { margin-top: 8px; padding-left: 12px; border-left: 2px solid #e6ecf5; }
.doc-content-inner .rq-sec + .rq-sec { margin-top: 10px; }
.doc-content-inner .rq-sec-t {
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 900;
  color: #2563eb;
  letter-spacing: .3px;
}
.doc-content-inner .rq-sec-body { color: #334155; font-size: 13.5px; line-height: 1.72; }
.doc-content-inner .rq-sec-body ul { margin: 0; padding-left: 18px; }
.doc-content-inner .rq-sec-body li { margin: 3px 0; }

/* 说明型表格转文本后的 key/value 行 */
.doc-content-inner .rq-plain .rq-item { padding: 10px 14px; }
.doc-content-inner .rq-kv-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.doc-content-inner .rq-kv { display: inline-flex; align-items: baseline; gap: 4px; }
.doc-content-inner .rq-kv-k { color: #64748b; font-size: 12.5px; font-weight: 800; }
.doc-content-inner .rq-kv-v { color: #334155; font-size: 13.5px; }
.doc-content-inner .rq-kv-sep { color: #cbd5e1; }

/* 条目内的规则键与待确认标记 */
.doc-content-inner .d-k { color: #0f766e; font-weight: 800; }
.doc-content-inner .i-k { color: #b45309; font-weight: 800; }
.doc-content-inner .area-tag { color: #64748b; font-size: 12px; font-weight: 800; }
.doc-content-inner .todo {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: #fff7ed;
  color: #b1541a;
  font-size: 12.5px;
  font-weight: 700;
}

/* 需求范围统计 */
.doc-nav-brand-src { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.doc-stat-p1 .doc-stat-num { color: #b1541a; }
.doc-stat-p1 { background: #fff8ef; border-color: #ffe2c2; }
.doc-stat-p2 .doc-stat-num { color: #667085; }
.doc-stat-p2 { background: #f3f5f8; border-color: #e3e8ef; }

/* 中间 demo 栏 */
.doc-demo { border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg); min-width: 0; overflow: hidden; }

/* 上传入口：右栏顶部全宽条，始终可见、不被裁切 */
.demo-upload-bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #eef6ff; position: sticky; top: 0; z-index: 5; }
.demo-upload-bar-hint { font-size: 12px; color: var(--text-mid, #475569); }

/* 中间内容底部的上传入口（与右栏上传共用文件选择） */
.doc-upload-foot { position: sticky; bottom: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 26px; padding: 16px 18px; border: 1px dashed var(--primary, #2563eb); border-radius: 10px; background: #f5f9ff; }
.doc-upload-foot-hint { font-size: 12.5px; color: var(--text-mid, #475569); }

/* 分页器：多个 Demo（本地原型 + 多张图片）时逐页查看 */
.demo-pager { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.demo-pager-btn { appearance: none; width: 30px; height: 30px; border: 1px solid var(--line); background: #f8fafc; color: #334155; border-radius: 8px; font-size: 17px; font-weight: 900; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.demo-pager-btn:hover:not(:disabled) { background: #eef6ff; color: #1d4ed8; border-color: #dbeafe; }
.demo-pager-btn:disabled { opacity: .35; cursor: default; }
.demo-pager-ind { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 96px; }
.demo-pager-num { font-size: 12.5px; font-weight: 800; color: #334155; white-space: nowrap; }
.demo-dots { display: flex; gap: 5px; }
.demo-dot { width: 7px; height: 7px; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: background .15s, transform .15s; }
.demo-dot:hover { background: #93c5fd; }
.demo-dot.on { background: var(--primary); transform: scale(1.25); }

/* 舞台：单页展示区 */
.demo-stage { flex: 1; min-height: 0; background: #fff; overflow: hidden; }
.demo-page { height: 100%; display: flex; flex-direction: column; }

/* 原型页 */
.demo-page-proto { display: flex; flex-direction: column; overflow: auto; }
.demo-page-proto .demo-frame { flex: 1; min-height: 0; min-width: 900px; width: 100%; border: 0; background: #fff; border-radius: 8px; }
.demo-page-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.demo-page-title { font-size: 13px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 原型页上的翻页提示：告诉用户图片 Demo 在后面几页 */
.demo-page-more { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; padding: 3px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 图片页 */
.demo-page-img { height: 100%; }
.demo-img-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; background: #f8fafc; }
.demo-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); background: #fff; }
/* 悬浮在图片右上角的删除按钮：红色实心、常驻可见 */
.demo-img-del-float {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  appearance: none;
  border: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(220, 38, 38, .28);
}
.demo-img-del-float:hover { background: #b91c1c; }
.demo-img-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; }
.demo-img-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.demo-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

@media (max-width: 1180px) {
  .doc-shell { height: auto; min-height: 0; }
  .doc3 { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .doc-nav { max-height: 280px; border-right: 0; border-bottom: 1px solid var(--line); }
  .doc-content { overflow: visible; padding: 28px 20px; }
  .doc-demo { border-right: 0; border-top: 1px solid var(--line); }
  .doc-demo .demo-stage { height: 520px; }
}

/* ============ 三级目录树导航（新增） ============ */
.doc3.no-demo { grid-template-columns: 260px minmax(0, 1fr); }
.doc3.no-demo .doc-demo { display: none; }

.nav-node { margin: 2px 0; }

.nav-branch-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px 6px 8px;
  border-radius: 7px;
  color: #1f2937;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, color .15s ease;
}
.nav-branch-head:hover { background: #eef2f7; }

.nav-caret {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 11px;
  transition: transform .18s ease;
}
.nav-branch.collapsed > .nav-branch-head .nav-caret { transform: rotate(-90deg); }

.nav-node-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-branch-count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.nav-branch-body { margin-left: 14px; padding-left: 8px; border-left: 1px solid #e8edf4; }
.nav-branch.collapsed > .nav-branch-body { display: none; }

.nav-leaf {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  margin: 2px 0;
  padding: 5px 10px 5px 6px;
  border-radius: 7px;
  color: #334155;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-leaf:hover { background: #eef6ff; color: #1d4ed8; }
.nav-leaf.active {
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .2);
}

.nav-leaf-ico {
  flex: 0 0 auto;
  width: 15px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}
.nav-leaf.kind-demo .nav-leaf-ico { color: #0ea5e9; }
.nav-leaf.kind-md .nav-leaf-ico { color: #8b5cf6; }
.nav-leaf.kind-doc .nav-leaf-ico { color: #2563eb; }
.nav-leaf.active .nav-leaf-ico { color: #fff; }

.nav-leaf-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 总览页模块卡片 */
.ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 4px 0 20px; }
.ov-mod {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.ov-mod:hover { border-color: #bfdbfe; box-shadow: 0 10px 26px rgba(37, 99, 235, .1); transform: translateY(-1px); }
.ov-mod-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.ov-mod-code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 6px; background: #eaf1ff; color: #2563eb; font-size: 12px; font-weight: 900;
}
.ov-mod-name { font-size: 15px; font-weight: 900; color: #0f172a; }
.ov-mod-count { margin-left: auto; font-size: 11.5px; color: #94a3b8; font-weight: 700; }
.ov-mod-pages { font-size: 12.5px; color: #64748b; line-height: 1.55; }

/* 原型全宽 demo */
.demo-full { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.demo-full-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; font-size: 13px; font-weight: 800; color: #1f2937; }
.demo-full-head .btn { margin-left: auto; }
.demo-full-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }

.demo-empty-page { padding: 44px 20px; text-align: center; color: #64748b; font-size: 14px; }
.doc-content-loading { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 14px; }

/* Markdown 源码 */
.md-src {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 更新日志 */
.chg-item { padding: 14px 16px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.chg-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.chg-item-id { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: #eaf1ff; color: #2563eb; font-size: 12px; font-weight: 900; }
.chg-item-date { margin-left: auto; color: #94a3b8; font-size: 12px; }
.chg-item-summary { color: #334155; font-size: 13px; line-height: 1.65; }

/* 菜单说明 */
.menu-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: #334155; font-size: 13px; }
.menu-row-label { flex: 1; min-width: 0; }
.menu-row-kind { padding: 1px 8px; border-radius: 999px; background: #f2f4f7; color: #667085; font-size: 11px; font-weight: 800; }

/* ============ 三列表格（PRD 功能点标准格式：页面元素 / 需求详情 / 交互规则） ============ */
.doc-content-inner .req-table5 { table-layout: fixed; border-collapse: collapse; width: 100%; }
.doc-content-inner .req-table5 th,
.doc-content-inner .req-table5 td { border: 1px solid var(--line); padding: 10px 12px; vertical-align: top; text-align: left; font-size: 13px; line-height: 1.6; }
.doc-content-inner .req-table5 th { background: #f1f5f9; color: #1f2937; font-weight: 800; }
.doc-content-inner .req-table5 .c-elem { width: 18%; }
.doc-content-inner .req-table5 .c-detail { width: 41%; }
.doc-content-inner .req-table5 .c-rule { width: 41%; }
.doc-content-inner .req-table5 .area-tag { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 4px; background: #eef2f7; color: #64748b; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.doc-content-inner .req-table5 td ul { margin: 0; padding-left: 16px; }
.doc-content-inner .req-table5 td ul li { margin: 2px 0; }
.doc-content-inner .req-table5 .d-k,
.doc-content-inner .req-table5 .i-k { font-weight: 800; color: #1e40af; }
.doc-content-inner .req-table5 .d-k { color: #0369a1; }
.doc-content-inner .req-table5 .todo { color: #b45309; font-weight: 700; }

/* ============ 新版需求格式：黑色标题块 + 模块/类型/处理 三列表 ============ */
.doc-content-inner h3.blk { display: block; background: #111827; color: #fff; border: none; border-radius: 4px; padding: 10px 16px; font-size: 15px; font-weight: 800; margin: 24px 0 12px; letter-spacing: 0.5px; }
.doc-content-inner h3.blk .mod-tag { margin-right: 8px; }
.doc-content-inner table.rq3 { table-layout: fixed; border-collapse: collapse; width: 100%; margin: 0 0 6px; }
.doc-content-inner table.rq3 th,
.doc-content-inner table.rq3 td { border: 1px solid var(--line); padding: 10px 12px; vertical-align: top; text-align: left; font-size: 13px; line-height: 1.7; }
.doc-content-inner table.rq3 th { background: #f1f5f9; color: #1f2937; font-weight: 800; }
.doc-content-inner table.rq3 .rq3-m { width: 16%; text-align: center; font-weight: 600; color: #1f2937; }
.doc-content-inner table.rq3 th.rq3-m { text-align: center; }
.doc-content-inner table.rq3 .rq3-t { width: 10%; text-align: center; color: #475569; }
.doc-content-inner table.rq3 .rq3-p { width: auto; }
.doc-content-inner table.rq3 td.rq3-p { color: #334155; }
.doc-content-inner table.rq3 .todo { color: #b45309; font-weight: 700; }
