/* ============================================================
 * prd-card.css · 产品需求文档（PRD）卡片样式（全局共享）
 * v1.7.13 · 2026-05-29 · 从 reports.html 抽取，供全部页面统一引用
 * 设计原则：
 *   · 仅承载视觉，不耦合任何业务字段；通过 .rep-spec* 类名复用
 *   · 默认放在每个页面的底部，details/summary 折叠
 * ============================================================ */

.rep-spec {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-top: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04);
  overflow: hidden;
}
.rep-spec-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: linear-gradient(135deg, rgba(124,58,237,.05), rgba(124,58,237,.01));
  border-bottom: 1px solid transparent;
  transition: background .15s;
}
.rep-spec[open] .rep-spec-hd { border-bottom-color: var(--border); }
.rep-spec-hd:hover { background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(124,58,237,.02)); }
.rep-spec-hd::-webkit-details-marker { display: none; }
.rep-spec-ic {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(124,58,237,.22);
}
.rep-spec-ic .ic { width: 17px; height: 17px; }
.rep-spec-hd-txt { display: flex; flex-direction: column; min-width: 0; }
.rep-spec-title { font-weight: 800; font-size: 14px; color: var(--text); }
.rep-spec-sub { font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.rep-spec-toggle {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: var(--accent-dark);
  flex-shrink: 0;
}
.rep-spec-toggle .t-open { display: none; }
.rep-spec[open] .rep-spec-toggle .t-open { display: inline; }
.rep-spec[open] .rep-spec-toggle .t-closed { display: none; }
.rep-spec-chevron { width: 15px; height: 15px; transition: transform .2s; }
.rep-spec[open] .rep-spec-chevron { transform: rotate(180deg); }

.rep-spec-body { padding: 16px 18px 18px; }

/* 流程 banner */
.rep-spec-flow {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--bg2, #F8FAFC);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
}
.rep-spec-flow-lbl {
  font-size: 11px; font-weight: 800; color: var(--text3);
  text-transform: uppercase; letter-spacing: .4px;
  flex-shrink: 0;
}
.rep-spec-flow-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rep-spec-flow-steps .ic { width: 13px; height: 13px; color: var(--text3); flex-shrink: 0; }
.rep-flow-step {
  font-size: 12px; font-weight: 600; color: var(--text2);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 9px;
  white-space: nowrap;
}

/* sections grid */
.rep-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1180px) { .rep-spec-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px)  { .rep-spec-grid { grid-template-columns: 1fr; } }
.rep-spec-sec {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 14px;
  background: #fff;
}
.rep-spec-sec-hd {
  display: flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 13px; color: var(--text);
  margin-bottom: 9px;
}
.rep-spec-sec-hd .ic { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.rep-spec-sec ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.rep-spec-sec li {
  font-size: 12px; line-height: 1.55; color: var(--text2);
  padding-left: 14px; position: relative;
}
.rep-spec-sec li::before {
  content: ''; position: absolute; left: 2px; top: 7px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}
.rep-spec-sec li b { color: var(--text); font-weight: 700; }
.rep-spec-sec li code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--accent-bg, #F5F3FF);
  color: var(--accent-dark);
  padding: 1px 5px; border-radius: 4px;
}

/* 状态机 chips */
.rep-spec-states li { padding-left: 0; }
.rep-spec-states li::before { display: none; }
.rep-spec-st {
  display: inline-block;
  padding: 2px 8px; border-radius: 9px;
  font-size: 11px; font-weight: 700;
  margin-right: 6px;
}
.rep-spec-st.st-queue   { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.rep-spec-st.st-gen     { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.rep-spec-st.st-retry   { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.rep-spec-st.st-ok      { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.rep-spec-st.st-partial { background: #FEFCE8; color: #A16207; border: 1px solid #FDE68A; }
.rep-spec-st.st-fail    { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }

/* 异常处理矩阵 */
.rep-spec-matrix-hd {
  display: flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 13.5px; color: var(--text);
  margin: 20px 0 10px;
}
.rep-spec-matrix-hd .ic { width: 16px; height: 16px; color: #B91C1C; flex-shrink: 0; }
.rep-spec-matrix-sub {
  font-weight: 500; font-size: 11.5px; color: var(--text3);
  margin-left: 2px;
}
.rep-spec-matrix-wrap {
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}
.rep-spec-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rep-spec-matrix thead th {
  text-align: left;
  padding: 9px 14px;
  background: var(--bg2, #F8FAFC);
  color: var(--text3);
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
}
.rep-spec-matrix td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  line-height: 1.5;
  vertical-align: top;
}
.rep-spec-matrix tbody tr:last-child td { border-bottom: 0; }
.rep-spec-matrix td:nth-child(2) { color: var(--text); font-weight: 600; }
.rep-spec-matrix td[rowspan] {
  border-right: 1px solid var(--border);
  background: #FCFCFD;
  white-space: nowrap;
}
.rep-spec-tag {
  display: inline-block;
  padding: 3px 9px; border-radius: 7px;
  font-size: 11px; font-weight: 700;
}
.rep-spec-tag.tg-data  { background: #EFF6FF; color: #1D4ED8; }
.rep-spec-tag.tg-task  { background: #F5F3FF; color: #6D28D9; }
.rep-spec-tag.tg-conc  { background: #ECFEFF; color: #0E7490; }
.rep-spec-tag.tg-store { background: #ECFDF5; color: #047857; }
.rep-spec-tag.tg-biz   { background: #FFF7ED; color: #C2410C; }
.rep-spec-tag.tg-fe    { background: #FDF2F8; color: #BE185D; }

/* 元信息条 + 目录 + 章节 + 代码块 */
.rep-spec-meta {
  display: flex; flex-wrap: wrap; gap: 14px 22px;
  padding: 10px 14px;
  background: var(--bg2, #F8FAFC);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}
.rep-spec-meta-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.rep-spec-meta-item .k {
  font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .35px;
  font-size: 10.5px;
}
.rep-spec-meta-item .v { color: var(--text); font-weight: 600; }

.rep-spec-toc {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
}
.rep-spec-toc a {
  font-size: 12px; font-weight: 600;
  color: var(--text2);
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--bg2, #F8FAFC);
  transition: all .12s;
}
.rep-spec-toc a:hover {
  background: var(--accent-bg, #F5F3FF);
  color: var(--accent-dark);
}

.rep-spec-chap { margin-top: 22px; scroll-margin-top: 80px; }
.rep-spec-chap:first-of-type { margin-top: 0; }
.rep-spec-chap-hd {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 800;
  color: var(--text);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.rep-spec-chap-hd .no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 22px; padding: 0 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  font-size: 11px; font-weight: 800;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.rep-spec-h5 {
  font-size: 12.5px; font-weight: 800; color: var(--text);
  margin: 14px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.rep-spec-h5::before {
  content: ''; width: 3px; height: 12px;
  background: var(--accent);
  border-radius: 2px;
}

.rep-spec-kv {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12px; line-height: 1.55; color: var(--text2);
}
.rep-spec-kv b { color: var(--text); font-weight: 700; }

.rep-spec-note {
  background: var(--accent-bg, #F5F3FF);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 9px 12px;
  margin: 10px 0 0;
  font-size: 12px; line-height: 1.55;
  color: var(--text2);
}
.rep-spec-note b { color: var(--text); font-weight: 700; }
.rep-spec-note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: #fff; padding: 1px 5px; border-radius: 4px; color: var(--accent-dark); }

.rep-spec-code {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: #0F172A;
  color: #E2E8F0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
}

.rep-spec-matrix td code,
.rep-spec-chap code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--accent-bg, #F5F3FF);
  color: var(--accent-dark);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.rep-spec-chap ul {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.rep-spec-chap > ul > li {
  font-size: 12px; line-height: 1.55; color: var(--text2);
  padding-left: 14px; position: relative;
}
.rep-spec-chap > ul > li::before {
  content: ''; position: absolute; left: 2px; top: 7px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}
.rep-spec-chap > ul > li b { color: var(--text); font-weight: 700; }
