[hidden] { display: none !important; }

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e4e7ec;
  --text: #1f2329;
  --muted: #8a919c;
  --primary: #2f6fed;
  --primary-dark: #2458c4;
  --danger: #d9435f;
  --warn: #e8a13c;
  --ok: #2fa96b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
}
.tab.active { background: #eef3ff; color: var(--primary); font-weight: 600; }
.actions { display: flex; gap: 8px; }

/* 布局 */
.layout { display: flex; min-height: calc(100vh - 57px); }
.sidebar {
  width: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  flex-shrink: 0;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0 6px;
}
.dept-list { list-style: none; margin: 0; padding: 0; }
.dept-add { margin-bottom: 8px; }
.dept-add input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  font-size: 14px;
}
.dept-list li {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.dept-list li:hover { background: #f2f4f7; }
.dept-list li.active { background: #eef3ff; color: var(--primary); font-weight: 600; }
.dept-list .dept-ops { display: none; gap: 4px; }
.dept-list li:hover .dept-ops { display: flex; }

.content { flex: 1; padding: 20px 24px; max-width: 980px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input { flex: 1; }

/* 列表 */
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.doc-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
}
.doc-item:hover { border-color: var(--primary); }
.doc-item .title { font-weight: 600; margin-bottom: 4px; }
.doc-item .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item .meta { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; gap: 12px; }
.doc-item .ops { margin-top: 8px; display: flex; gap: 8px; }

/* 详情 */
.doc-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
}
.doc-detail h2 { margin-top: 0; }
.doc-detail .body {
  white-space: pre-wrap;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
}
.doc-detail .detail-actions { display: flex; gap: 8px; }

.empty { color: var(--muted); text-align: center; padding: 60px 0; }

/* 按钮 */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  background: transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--card); }
.btn-ghost:hover { background: #f2f4f7; }
.btn-danger { color: var(--danger); border-color: #f3c1cb; }
.btn-danger:hover { background: #fdf0f3; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-icon { border: none; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); }

/* 输入 */
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-box {
  background: var(--card);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-wide { max-width: 720px; }
.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.req { color: var(--danger); }
.muted { color: var(--muted); font-size: 13px; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* 审核结果 */
.audit-loading { margin-top: 16px; color: var(--primary); font-weight: 600; }
.audit-result { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 18px; }
.score-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.score {
  width: 74px; height: 74px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.score.high { background: var(--danger); }
.score.mid { background: var(--warn); }
.score.low { background: var(--ok); }
.summary { flex: 1; }

.risk-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.risk-card.sev-高 { border-left-color: var(--danger); }
.risk-card.sev-中 { border-left-color: var(--warn); }
.risk-card.sev-低 { border-left-color: var(--ok); }
.risk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.badge.sev-高 { background: #fde8ec; color: var(--danger); }
.badge.sev-中 { background: #fdf3e0; color: var(--warn); }
.badge.sev-低 { background: #e6f6ee; color: var(--ok); }
.badge.cat { background: #eef3ff; color: var(--primary); }
.risk-loc { color: var(--muted); font-size: 13px; font-style: italic; }
.risk-field { margin-top: 6px; font-size: 14px; }
.risk-field b { color: var(--muted); font-weight: 600; }
.missing-list { margin: 6px 0 0; padding-left: 20px; }
.sec-title { font-weight: 700; margin: 16px 0 8px; }

/* toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2329;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
}

@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .content { padding: 14px; }
}
