/* ===== 知识库（法规库 / 模板库） ===== */
#p_kb { box-sizing: border-box; }
#kbRoot { display: flex; flex-direction: column; height: calc(100vh - 118px); min-height: 420px; }

.kb-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 6px 0 12px; }
.kb-tabs { display: flex; gap: 6px; background: #eef1f6; padding: 4px; border-radius: 8px; }
.kb-tab {
  padding: 7px 20px; border-radius: 6px; cursor: pointer; font-size:14.5px;
  color: #4b5563; user-select: none; transition: all .15s;
}
.kb-tab:hover { color: #111827; }
.kb-tab.active { background: #fff; color: #1d4ed8; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.kb-search { display: flex; gap: 8px; flex: 1; min-width: 280px; max-width: 560px; }
.kb-search input {
  flex: 1; padding: 8px 12px; border: 1px solid #d5dbe5; border-radius: 6px;
  font-size:14.5px; outline: none; background: #fff;
}
.kb-search input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.kb-body { display: flex; gap: 0; flex: 1; min-height: 0; border-top: 1px solid #e5e9f0; }
.kb-side {
  width: 200px; flex-shrink: 0; border-right: 1px solid #e5e9f0;
  padding: 12px 10px 24px 0; overflow: auto; box-sizing: border-box;
}
.kb-side-t { font-size:12px; color: #8b95a5; padding: 4px 8px; letter-spacing: .5px; }
.kb-cat {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; border-radius: 6px; font-size:13.5px; color: #374151;
  cursor: pointer; margin-bottom: 2px;
}
.kb-cat:hover { background: #f1f5fb; }
.kb-cat.active { background: #e8f0fe; color: #1d4ed8; font-weight: 600; }
.kb-cat span { font-size:12px; color: #9aa4b2; font-weight: 400; }
.kb-cat.active span { color: #5b7cd8; }

.kb-main { flex: 1; min-width: 0; overflow: auto; padding: 14px 4px 24px 16px; }
.kb-count { font-size:12px; color: #6b7280; margin-bottom: 10px; }
.kb-count b { color: #1d4ed8; }
.kb-empty { text-align: center; color: #9aa4b2; padding: 60px 0; font-size:14.5px; }

.kb-card {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: all .15s;
}
.kb-card:hover { border-color: #b8cdf5; box-shadow: 0 2px 10px rgba(37,99,235,.08); }
.kb-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kb-card-t { font-size:15.5px; font-weight: 600; color: #1f2937; line-height: 1.5; }
.kb-card-m { display: flex; flex-wrap: wrap; gap: 10px; font-size:12px; color: #7b8698; margin-top: 6px; }
.kb-card-d { font-size:13.5px; color: #5b6675; line-height: 1.65; margin-top: 8px; }
.kb-tag { background: #f0f4fa; color: #4b6b9e; padding: 1px 8px; border-radius: 10px; }
.kb-bd { font-size:11px; padding: 2px 9px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.kb-bd.ok { background: #e7f6ec; color: #17803d; }
.kb-bd.warn { background: #fef3e2; color: #b45309; }
.kb-sk { height: 74px; background: linear-gradient(90deg,#f4f6fa 25%,#eaeef5 37%,#f4f6fa 63%); background-size: 400% 100%; animation: kbShine 1.3s infinite; }
@keyframes kbShine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.kb-tcard {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 8px; padding: 14px;
  cursor: pointer; transition: all .15s; display: flex; flex-direction: column;
}
.kb-tcard:hover { border-color: #b8cdf5; box-shadow: 0 2px 10px rgba(37,99,235,.08); transform: translateY(-1px); }
.kb-tcard-t { font-size:15.5px; font-weight: 600; color: #1f2937; line-height: 1.5; }
.kb-tcard-f { font-size:12px; color: #8b95a5; margin-top: auto; padding-top: 10px; border-top: 1px dashed #eef1f6; }

/* 抽屉 */
.kb-drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 300; }
.kb-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 88vw);
  background: #fff; z-index: 301; box-shadow: -6px 0 28px rgba(15,23,42,.16);
  display: flex; flex-direction: column; animation: kbSlide .2s ease-out;
}
@keyframes kbSlide { from { transform: translateX(28px); opacity: .6; } to { transform: none; opacity: 1; } }
.kb-dw-h { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #eef1f6; }
.kb-dw-t { flex: 1; font-size:17.5px; font-weight: 700; color: #111827; line-height: 1.5; }
.kb-dw-x { font-size:25.5px; line-height: 1; color: #9aa4b2; cursor: pointer; padding: 0 4px; }
.kb-dw-x:hover { color: #ef4444; }
.kb-dw-b { flex: 1; overflow: auto; padding: 18px 20px 40px; }

.kb-meta { width: 100%; border-collapse: collapse; font-size:13.5px; margin-bottom: 6px; }
.kb-meta th { text-align: left; color: #7b8698; font-weight: 400; width: 74px; padding: 5px 8px 5px 0; }
.kb-meta td { color: #1f2937; padding: 5px 14px 5px 0; }

.kb-sec { margin-top: 18px; }
.kb-sec-t { font-size:13.5px; font-weight: 700; color: #1d4ed8; margin-bottom: 8px; padding-left: 8px; border-left: 3px solid #2563eb; line-height: 1.2; }
.kb-sec p { font-size:14px; line-height: 1.85; color: #374151; margin: 0 0 8px; }
.kb-pts { margin: 0; padding-left: 20px; }
.kb-pts li { font-size:14px; line-height: 1.85; color: #374151; margin-bottom: 8px; }
.kb-tags span {
  display: inline-block; background: #f0f4fa; color: #4b6b9e; font-size:12px;
  padding: 2px 10px; border-radius: 10px; margin: 0 6px 6px 0;
}
.kb-link { color: #2563eb; font-size:13.5px; text-decoration: none; }
.kb-link:hover { text-decoration: underline; }
.kb-note { margin-top: 24px; padding: 10px 12px; background: #fafbfd; border: 1px dashed #e5e9f0; border-radius: 6px; font-size:12px; color: #8b95a5; line-height: 1.7; }
.kb-desc { font-size:14px; color: #4b5563; line-height: 1.8; margin: 0 0 4px; }

.kb-vars { width: 100%; border-collapse: collapse; font-size:13px; }
.kb-vars th { background: #f7f9fc; color: #6b7280; font-weight: 500; text-align: left; padding: 6px 8px; border: 1px solid #eef1f6; }
.kb-vars td { padding: 6px 8px; border: 1px solid #eef1f6; color: #374151; }
.kb-vars code { background: #eef4ff; color: #1d4ed8; padding: 1px 5px; border-radius: 3px; font-size:12px; }
.kb-vars .kb-var-in {
  width: 100%; box-sizing: border-box; padding: 4px 7px; font-size:13px;
  border: 1px solid #d5dbe5; border-radius: 4px; outline: none; background: #fff; color: #1f2937;
  font-family: inherit;
}
.kb-vars .kb-var-in:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.kb-vars .kb-var-in::placeholder { color: #b3bcc9; }
.kb-hint { font-size:12px; color: #8b95a5; line-height: 1.7; margin: 0 0 8px; }
.kb-hint code { background: #eef4ff; color: #1d4ed8; padding: 1px 5px; border-radius: 3px; }

.kb-fillbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.kb-prog { font-size:12px; color: #8b95a5; }
.kb-prog.done { color: #17803d; }
.kb-ph { background: #fff3cd; color: #9a6700; border-radius: 3px; padding: 0 3px; white-space: nowrap; }
.kb-auto { margin-left: 6px; font-size:11px; color: #b45309; background: #fef3e2; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.kb-ft-badge { color: #17803d; background: #e7f6ec; padding: 1px 8px; border-radius: 10px; }
.kb-ft summary { cursor: pointer; font-size:13.5px; color: #1d4ed8; user-select: none; padding: 6px 0; }
.kb-ft summary:hover { text-decoration: underline; }
.kb-ft[open] summary { margin-bottom: 6px; }
.kb-ft-text {
  white-space: pre-wrap; word-break: break-word; font-family: inherit;
  font-size:14px; line-height: 1.9; color: #374151;
  background: #fafbfd; border: 1px solid #eef1f6; border-radius: 6px;
  padding: 14px 16px; max-height: 60vh; overflow: auto; margin: 0;
}

.kb-preview {
  border: 1px solid #e5e9f0; border-radius: 6px; padding: 22px 26px; background: #fff;
  font-family: "仿宋_GB2312", "仿宋", FangSong, serif; font-size:15.5px; line-height: 1.9;
  color: #1f2937; max-height: 46vh; overflow: auto;
}
.kb-preview h2 { font-family: "方正小标宋简体", "宋体", SimSun, serif; font-size:21px; text-align: center; margin: 0 0 16px; }
.kb-preview h3 { font-size:15.5px; font-weight: 700; margin: 16px 0 8px; }
.kb-preview p { margin: 0 0 6px; text-indent: 0; }
.kb-preview table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size:13.5px; }
.kb-preview th, .kb-preview td { border: 1px solid #999; padding: 5px 7px; }

.kb-actions { display: flex; gap: 10px; margin-top: 18px; }
.kb-toast {
  position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%) translateY(16px);
  background: rgba(17,24,39,.92); color: #fff; font-size:13.5px; padding: 9px 18px;
  border-radius: 20px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 400;
}
.kb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 双栏阅读：左边文件名 / 右边阅读栏 =====
   2026-10-20 改版：一级维度改为「政府采购 / 公开招标」，
   原「法规库 / 模板库」tab + 卡片网格 + 抽屉改为常驻双栏。
   2026-10-20 二次改版：一级维度扩为
   项目建议书 / 可行性研究报告 / 政采 / 公开招标 / 通用。 */
.kbr { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.kbr-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 4px 0 12px; }
.kbr-ways { display: flex; flex-wrap: wrap; gap: 4px; background: #eef1f6; padding: 4px; border-radius: 8px; flex-shrink: 0; }
.kbr-way {
  display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 6px;
  cursor: pointer; font-size:14.5px; color: #4b5563; user-select: none; transition: all .15s;
  white-space: nowrap;
}
.kbr-way:hover { color: #111827; }
.kbr-way.active { background: #fff; color: #1d4ed8; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.kbr-way span { font-size:12px; color: #9aa4b2; font-weight: 400; }
.kbr-way.active span { color: #5b7cd8; }

.kbr-q { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 260px; }
.kbr-q input {
  flex: 1; max-width: 420px; padding: 8px 12px; border: 1px solid #d5dbe5; border-radius: 6px;
  font-size:14.5px; outline: none; background: #fff; font-family: inherit;
}
.kbr-q input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.kbr-cnt { font-size:12px; color: #8b95a5; white-space: nowrap; }
.kbr-cnt b { color: #1d4ed8; }

.kbr-body {
  display: flex; flex: 1; min-height: 0; border: 1px solid #e5e9f0; border-radius: 10px;
  background: #fff; overflow: hidden;
}

/* 左栏：文件名列表 */
.kbr-list {
  width: 322px; flex-shrink: 0; border-right: 1px solid #eef1f6; background: #fbfcfe;
  overflow: auto; padding: 6px 6px 30px; box-sizing: border-box;
}
.kbr-g + .kbr-g { margin-top: 2px; }
.kbr-g-t {
  display: flex; justify-content: space-between; align-items: center;
  font-size:12px; color: #8b95a5; padding: 12px 10px 6px; letter-spacing: .3px;
}
.kbr-g-t span { font-size:11px; color: #b3bcc9; }
/* 跨分类搜索时的一级分类大标题 */
.kbr-way-h {
  display: flex; justify-content: space-between; align-items: center;
  margin: 14px 10px 4px; padding: 6px 10px; border-radius: 6px;
  background: #e8f0fe; font-size:13px; font-weight: 600; color: #1d4ed8;
}
.kbr-way-h:first-child { margin-top: 6px; }
.kbr-way-h span { font-size:11px; font-weight: 400; color: #6b8fd8; }
.kbr-i { padding: 7px 10px; border-radius: 6px; cursor: pointer; transition: background .12s; }
.kbr-i:hover { background: #f1f5fb; }
.kbr-i.on { background: #e8f0fe; }
.kbr-i.on .kbr-i-t { color: #1d4ed8; font-weight: 600; }
.kbr-i-t { display: block; font-size:14px; color: #252b37; line-height: 1.5; }
.kbr-i-s { display: block; font-size:11.5px; color: #98a1b0; margin-top: 2px; }
.kbr-sk {
  height: 46px; margin: 6px 4px; border-radius: 6px;
  background: linear-gradient(90deg,#f4f6fa 25%,#eaeef5 37%,#f4f6fa 63%);
  background-size: 400% 100%; animation: kbShine 1.3s infinite;
}

/* 右栏：阅读区 */
.kbr-read { flex: 1; min-width: 0; overflow: auto; background: #fff; }
.kbr-rd { max-width: 860px; margin: 0 auto; padding: 26px 36px 64px; box-sizing: border-box; }
.kbr-rd-h h1 {
  font-size:21px; line-height: 1.55; margin: 0 0 12px; color: #111827; font-weight: 600;
  letter-spacing: .2px;
}
.kbr-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid #eef1f6; }
.kbr-c { font-size:12px; color: #4b5563; background: #f4f6fa; border-radius: 4px; padding: 4px 9px; }
.kbr-c i { font-style: normal; color: #98a1b0; margin-right: 6px; }

.kbr-sum {
  margin: 18px 0 0; padding: 12px 14px; background: #f7f9fc; border-left: 3px solid #93b4f0;
  border-radius: 0 6px 6px 0; font-size:14px; line-height: 1.85; color: #374151;
}
.kbr-sum b { color: #1d4ed8; margin-right: 8px; font-weight: 600; }

.kbr-blk { margin-top: 22px; }
.kbr-blk-t {
  display: flex; align-items: center; gap: 10px; font-size:13.5px; font-weight: 600; color: #1d4ed8;
  padding-left: 8px; border-left: 3px solid #2563eb; line-height: 1.2; margin-bottom: 12px;
}
.kbr-blk-t > span { font-weight: 400; color: #98a1b0; font-size:12px; }

.kbr-pts { margin: 0; padding-left: 20px; }
.kbr-pts li { font-size:14px; line-height: 1.9; color: #374151; margin-bottom: 6px; }

.kbr-text { padding-top: 2px; }
.kbr-text p {
  font-size:15px; line-height: 1.95; color: #252b37; margin: 0; text-indent: 2em;
  word-break: break-word;
}
.kbr-text p.kbr-ch {
  text-indent: 0; text-align: center; font-weight: 600; font-size:16px;
  margin: 22px 0 10px; color: #111827;
}
.kbr-text p.kbr-ch:first-child { margin-top: 4px; }
.kbr-text p.kbr-sec { text-indent: 0; font-weight: 600; margin: 14px 0 6px; }

.kbr-none { font-size:14px; color: #8b95a5; line-height: 1.9; padding: 18px 0; }
.kbr-none-big { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 320px; }
.kbr-none-t { font-size:16.5px; color: #4b5563; font-weight: 600; margin-bottom: 8px; }
.kbr-none-s { font-size:13.5px; color: #9aa4b2; }

/* 左栏：当前分类还没有资料 */
.kbr-empty-way { padding: 46px 16px; text-align: center; }
.kbr-ew-t { font-size:14.5px; color: #4b5563; font-weight: 600; margin-bottom: 8px; }
.kbr-ew-s { font-size:12.5px; color: #9aa4b2; line-height: 1.8; }

.kbr-varbar { display: flex; gap: 8px; margin-bottom: 10px; }
.btn.sm { padding: 5px 12px; font-size:13px; }
.kbr-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 4px; }

.kbr-tags { margin-top: 18px; }
.kbr-tags span {
  display: inline-block; background: #f0f4fa; color: #4b6b9e; font-size:12px;
  padding: 2px 10px; border-radius: 10px; margin: 0 6px 6px 0;
}
.kbr-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between;
  margin-top: 26px; padding-top: 14px; border-top: 1px dashed #e5e9f0;
  font-size:12px; color: #98a1b0;
}

@media (max-width: 1100px) {
  .kbr-list { width: 264px; }
  .kbr-rd { padding: 22px 22px 52px; }
  .kbr-way { padding: 7px 11px; font-size:13.5px; }
  .kbr-ways { gap: 2px; }
}

/* 阅读栏里的模板预览不设高度上限，整篇铺开读 */
.kbr-read .kb-preview { max-height: none; border: none; padding: 4px 0 0; border-radius: 0; }
.kbr-read .kb-vars { margin-bottom: 4px; }

/* ===== AI 知识库问答（试水版） ===== */
.kbr-ai-btn {
  flex-shrink: 0; padding: 9px 20px; border: none; border-radius: 8px; cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
  font-size:14.5px; font-weight: 600; transition: opacity .15s;
}
.kbr-ai-btn:hover { opacity: .88; }

.kbai { display: flex; flex-direction: column; height: 100%; box-sizing: border-box; }
.kbai-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid #eef1f6; font-size:15px; color: #252b37;
}
.kbai-close { cursor: pointer; font-size:21px; color: #9aa4b2; line-height: 1; padding: 0 4px; }
.kbai-close:hover { color: #4b5563; }
.kbai-msgs { flex: 1; overflow: auto; padding: 14px 18px; background: #fbfcfe; }
.kbai-m {
  max-width: 86%; margin-bottom: 12px; padding: 10px 14px; border-radius: 10px;
  font-size:13.5px; line-height: 1.7; word-break: break-word;
}
.kbai-m p { margin: 0 0 6px; } .kbai-m p:last-child { margin-bottom: 0; }
.kbai-u { margin-left: auto; background: #2563eb; color: #fff; border-bottom-right-radius: 2px; }
.kbai-a { background: #fff; border: 1px solid #e8edf4; color: #252b37; border-bottom-left-radius: 2px; }
.kbai-src { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e8edf4; font-size:12px; color: #8b95a5; }
.kbai-src span {
  display: inline-block; margin: 2px 6px 2px 0; padding: 2px 8px; border-radius: 4px;
  background: #e8f0fe; color: #1d4ed8; cursor: pointer; font-size:11.5px;
}
.kbai-src span:hover { background: #d6e4fd; }
.kbai-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 4px; }
.kbai-sug span {
  padding: 4px 10px; border-radius: 12px; background: #f1f5fb; color: #4b5563;
  font-size:12px; cursor: pointer; transition: background .15s;
}
.kbai-sug span:hover { background: #e8f0fe; color: #1d4ed8; }
.kbai-in { display: flex; gap: 8px; padding: 10px 18px 16px; }
.kbai-in input {
  flex: 1; padding: 10px 14px; border: 1px solid #dde4ee; border-radius: 8px;
  font-size:14px; outline: none;
}
.kbai-in input:focus { border-color: #2563eb; }
.kbai-in button {
  padding: 0 22px; border: none; border-radius: 8px; cursor: pointer;
  background: #2563eb; color: #fff; font-size:14px; font-weight: 600;
}
.kbai-in button:hover { background: #1d4ed8; }
