/* ============================================================
   知识库控制台样式（H2 蓝色系，kb- 前缀）
   ============================================================ */

.kb-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.kb-title-block h2 { margin: 0; font-size: 20px; font-weight: 700; color: #0f172a; }
.kb-subtitle { margin: 4px 0 0; font-size: 13px; color: #64748b; }
.kb-head-ops { display: flex; gap: 8px; }

/* Tabs */
.kb-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e2e8f0; margin: 14px 0 18px; flex-wrap: wrap; }
.kb-tab {
  appearance: none; border: none; background: none; cursor: pointer;
  padding: 9px 16px; font-size: 14px; color: #64748b; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.kb-tab:hover { color: #2563eb; }
.kb-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

/* 面板 */
.kb-panel {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 18px 20px; margin-bottom: 16px;
}
.kb-panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: #0f172a; }
.kb-panel h4 { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; color: #334155; }
.kb-line { margin: 6px 0; font-size: 13px; color: #475569; line-height: 1.7; }
.kb-line.good { color: #059669; }
.kb-line.warn { color: #d97706; }
.kb-line.bad { color: #dc2626; }
.kb-note { font-size: 12.5px; color: #94a3b8; margin: 8px 0 0; }
.kb-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #64748b; }

/* 总览统计 */
.kb-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kb-stat-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 16px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kb-stat-v { font-size: 26px; font-weight: 700; color: #2563eb; line-height: 1.1; }
.kb-stat-t { margin-top: 4px; font-size: 13px; color: #64748b; }
@media (max-width: 1000px) { .kb-stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* 总览流程 */
.kb-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.kb-flow-node {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid #dbe6f6; background: #f4f8ff; color: #1e4fa8;
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600;
}
.kb-flow-n {
  width: 22px; height: 22px; border-radius: 50%; background: #2563eb; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.kb-flow-arrow { color: #94a3b8; font-size: 16px; }

/* 表格 */
.kb-table-wrap { overflow-x: auto; }
.kb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kb-table th {
  text-align: left; font-size: 12.5px; font-weight: 600; color: #64748b;
  background: #f8fafc; padding: 10px 12px; white-space: nowrap;
}
.kb-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.kb-table tr:last-child td { border-bottom: none; }
.kb-mod-sep td { background: #f1f5f9; font-weight: 600; color: #334155; font-size: 12.5px; padding: 7px 12px; }
.kb-dim-row { color: #94a3b8; }

/* 级别徽标 */
.kb-lvl {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  font-size: 12px; font-weight: 700;
}
.lvl-A { background: #fee2e2; color: #dc2626; }
.lvl-B { background: #fef3c7; color: #d97706; }
.lvl-C { background: #e0e7ff; color: #4f46e5; }
.lvl-D { background: #dcfce7; color: #059669; }

/* 八问 */
.kb-q-list { display: flex; flex-direction: column; gap: 10px; }
.kb-q-item { display: flex; gap: 12px; align-items: flex-start; }
.kb-q-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: #eff6ff; color: #2563eb; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 2px;
}
.kb-q-text { font-size: 13.5px; color: #1e293b; font-weight: 500; }
.kb-q-mod { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* 准入卡片 */
.kb-gate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kb-gate-card { border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; }
.kb-gate-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #0f172a; }
.kb-gate-code {
  width: 30px; height: 24px; border-radius: 6px; background: #2563eb; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.kb-veto {
  margin-left: auto; font-size: 11px; font-weight: 700; color: #dc2626;
  background: #fee2e2; border-radius: 6px; padding: 2px 8px;
}
.kb-gate-std { margin-top: 8px; font-size: 12.5px; color: #64748b; line-height: 1.6; }
.kb-gate-cfg { margin-top: 8px; font-size: 12.5px; color: #475569; }
@media (max-width: 900px) { .kb-gate-grid { grid-template-columns: 1fr; } }

/* 分档表 */
.kb-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.kb-tier-table { font-size: 12.5px; }
@media (max-width: 900px) { .kb-tiers { grid-template-columns: 1fr; } }

.kb-inline { margin-top: 14px; font-size: 13px; color: #475569; display: flex; align-items: center; gap: 8px; }

/* 小输入框 */
.kb-min-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid #cbd5e1; border-radius: 6px; padding: 5px 8px;
  font-size: 13px; color: #0f172a; background: #fff;
}
.kb-min-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }

/* 试算 */
.kb-lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .kb-lab-grid { grid-template-columns: 1fr; } }
.kb-check-list { display: flex; flex-direction: column; gap: 7px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.kb-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; cursor: pointer; }
.kb-check input { margin: 0; }
.kb-result { margin-top: 14px; }
.kb-comp-score { font-size: 34px; font-weight: 800; color: #0f172a; line-height: 1; }
.kb-comp-score span { font-size: 15px; font-weight: 600; margin-left: 10px; }
.kb-comp-score.good { color: #059669; }
.kb-comp-score.warn { color: #d97706; }
.kb-comp-score.bad { color: #dc2626; }
.kb-manual { font-size: 11px; font-weight: 600; color: #b45309; background: #fef3c7; border-radius: 5px; padding: 1px 6px; margin-left: 6px; }

/* 文章 */
.kb-art-head { display: flex; align-items: center; justify-content: space-between; }
.kb-mini-tag {
  display: inline-block; font-size: 11.5px; color: #4f46e5;
  background: #eef2ff; border-radius: 5px; padding: 1px 7px; margin-right: 4px;
}
.kb-badge { font-size: 12px; border-radius: 6px; padding: 2px 9px; font-weight: 600; }
.kb-badge.good { color: #059669; background: #d1fae5; }
.kb-badge.warn { color: #d97706; background: #fef3c7; }

/* 编辑弹窗 */
.kb-editor-card { max-width: 620px; }
.kb-form-group { margin-bottom: 14px; }
.kb-form-group label { display: block; font-size: 13px; color: #475569; margin-bottom: 6px; font-weight: 500; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: #fff; border-radius: 14px; width: 560px; max-width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(15, 23, 42, .2);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; font-weight: 700; font-size: 16px; border-bottom: 1px solid #e2e8f0;
}
.modal-head h3 { margin: 0; font-size: 16px; color: #0f172a; }
.modal-close { cursor: pointer; font-size: 22px; color: #94a3b8; line-height: 1; }
.modal-close:hover { color: #475569; }
.modal-body { padding: 20px 22px; overflow: auto; flex: 1; }
.modal-foot {
  padding: 16px 22px; border-top: 1px solid #e2e8f0;
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal-foot .btn-primary { background: #2563eb; color: #fff; border: none; border-radius: 8px; padding: 9px 20px; font-size: 14px; font-weight: 600; cursor: pointer; }
.modal-foot .btn-primary:hover { background: #1d4ed8; }
.modal-foot .btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.modal-foot .btn-secondary { background: #fff; color: #475569; border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 20px; font-size: 14px; font-weight: 500; cursor: pointer; }
.modal-foot .btn-secondary:hover { background: #f9fafb; }
