tables.css 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. /* 表格样式组件 */
  2. /* 通用表格样式 */
  3. .message-content table,
  4. .markdown-content table,
  5. .bot .message-content table {
  6. width: 100% !important;
  7. table-layout: fixed !important;
  8. border-collapse: collapse !important;
  9. margin: 1em 0 !important;
  10. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
  11. border-radius: 4px !important;
  12. overflow: hidden !important; /* 确保圆角边框生效 */
  13. display: table !important; /* 强制表格显示为表格,而不是块 */
  14. height: auto !important; /* 高度自适应内容 */
  15. max-height: none !important; /* 不限制最大高度 */
  16. }
  17. /* 表格单元格通用样式 */
  18. .message-content table th,
  19. .message-content table td,
  20. .markdown-content table th,
  21. .markdown-content table td,
  22. .bot .message-content table th,
  23. .bot .message-content table td {
  24. padding: 6px 8px !important; /* 减小内边距,使表格更紧凑 */
  25. border: 1px solid #e2e8f0 !important;
  26. vertical-align: middle !important; /* 使用middle对齐,减少额外高度 */
  27. word-wrap: break-word !important;
  28. word-break: break-word !important;
  29. white-space: normal !important;
  30. height: auto !important;
  31. min-height: auto !important; /* 确保最小高度自适应 */
  32. max-height: none !important; /* 不限制最大高度 */
  33. overflow: visible !important;
  34. line-height: 1.4 !important; /* 减小行高,使文字更紧凑 */
  35. text-align: center !important; /* 确保所有单元格文字居中 */
  36. }
  37. /* 表头样式 - 确保居中显示 */
  38. .message-content table th,
  39. .markdown-content table th,
  40. .bot .message-content table th {
  41. background-color: #eef2ff !important; /* 轻微的紫色背景 */
  42. color: #4F46E5 !important; /* 与网站主题色匹配 */
  43. font-weight: 600 !important;
  44. text-align: center !important; /* 强制表头文字居中显示 */
  45. padding: 8px 8px !important; /* 减小表头内边距,使其更紧凑 */
  46. line-height: 1.4 !important; /* 保持与单元格一致的行高 */
  47. height: auto !important; /* 高度自适应 */
  48. min-height: auto !important;
  49. }
  50. /* 序号列(第一列)宽度和居中 */
  51. .message-content table th:first-child,
  52. .message-content table td:first-child,
  53. .markdown-content table th:first-child,
  54. .markdown-content table td:first-child,
  55. .bot .message-content table th:first-child,
  56. .bot .message-content table td:first-child {
  57. width: 5% !important;
  58. min-width: 40px !important;
  59. text-align: center !important;
  60. vertical-align: middle !important;
  61. font-weight: 500 !important;
  62. height: auto !important; /* 确保高度自适应 */
  63. min-height: auto !important;
  64. }
  65. /* 违规原文列(第二列)宽度 */
  66. .message-content table th:nth-child(2),
  67. .message-content table td:nth-child(2),
  68. .markdown-content table th:nth-child(2),
  69. .markdown-content table td:nth-child(2),
  70. .bot .message-content table th:nth-child(2),
  71. .bot .message-content table td:nth-child(2) {
  72. width: 30% !important;
  73. }
  74. /* 违规原因列(第三列)宽度 */
  75. .message-content table th:nth-child(3),
  76. .message-content table td:nth-child(3),
  77. .markdown-content table th:nth-child(3),
  78. .markdown-content table td:nth-child(3),
  79. .bot .message-content table th:nth-child(3),
  80. .bot .message-content table td:nth-child(3) {
  81. width: 30% !important;
  82. }
  83. /* 修改建议列(第四列)宽度 */
  84. .message-content table th:nth-child(4),
  85. .message-content table td:nth-child(4),
  86. .markdown-content table th:nth-child(4),
  87. .markdown-content table td:nth-child(4),
  88. .bot .message-content table th:nth-child(4),
  89. .bot .message-content table td:nth-child(4) {
  90. width: 35% !important;
  91. }
  92. /* 普通 markdown 表格增强样式(排除审核结果等业务表) */
  93. .message-content table:not(.audit-result):not(.risk-table),
  94. .markdown-content table:not(.audit-result):not(.risk-table),
  95. .bot .message-content table:not(.audit-result):not(.risk-table) {
  96. table-layout: auto !important; /* 让列宽根据内容自适应 */
  97. }
  98. .message-content table:not(.audit-result):not(.risk-table) th,
  99. .message-content table:not(.audit-result):not(.risk-table) td,
  100. .markdown-content table:not(.audit-result):not(.risk-table) th,
  101. .markdown-content table:not(.audit-result):not(.risk-table) td,
  102. .bot .message-content table:not(.audit-result):not(.risk-table) th,
  103. .bot .message-content table:not(.audit-result):not(.risk-table) td {
  104. width: auto !important;
  105. min-width: 0 !important;
  106. }
  107. .message-content table:not(.audit-result):not(.risk-table) td,
  108. .markdown-content table:not(.audit-result):not(.risk-table) td,
  109. .bot .message-content table:not(.audit-result):not(.risk-table) td {
  110. text-align: left !important; /* 内容默认左对齐更易阅读 */
  111. vertical-align: top !important; /* 从上方开始排版,减少空白 */
  112. }
  113. .message-content table:not(.audit-result):not(.risk-table) th,
  114. .markdown-content table:not(.audit-result):not(.risk-table) th,
  115. .bot .message-content table:not(.audit-result):not(.risk-table) th {
  116. text-align: left !important; /* 表头同样左对齐,保持风格一致 */
  117. white-space: nowrap !important;
  118. }
  119. /* 第一行文字居中 - 针对性强化 */
  120. .message-content table tbody tr:first-child td,
  121. .markdown-content table tbody tr:first-child td,
  122. .bot .message-content table tbody tr:first-child td {
  123. text-align: center !important;
  124. vertical-align: middle !important;
  125. background-color: #f9fafb !important; /* 轻微的灰色背景 */
  126. height: auto !important; /* 确保高度自适应 */
  127. min-height: auto !important;
  128. }
  129. /* 让表格行有更好的视觉区分 */
  130. .message-content table tbody tr:nth-child(even),
  131. .markdown-content table tbody tr:nth-child(even),
  132. .bot .message-content table tbody tr:nth-child(even) {
  133. background-color: #f9fafb !important;
  134. }
  135. .message-content table tbody tr:hover,
  136. .markdown-content table tbody tr:hover,
  137. .bot .message-content table tbody tr:hover {
  138. background-color: #f3f4f7 !important;
  139. }
  140. /* 专门针对审核结果表格的增强样式 */
  141. table.audit-result,
  142. table[data-type="audit-result"],
  143. .message-content table.audit-result,
  144. .message-content table[data-type="audit-result"],
  145. .markdown-content table.audit-result,
  146. .markdown-content table[data-type="audit-result"],
  147. .bot .message-content table.audit-result,
  148. .bot .message-content table[data-type="audit-result"] {
  149. width: 100% !important;
  150. border: 1px solid #e2e8f0 !important;
  151. display: table !important;
  152. }
  153. /* 审核结果表格的单元格增强 */
  154. table.audit-result th,
  155. table.audit-result td,
  156. table[data-type="audit-result"] th,
  157. table[data-type="audit-result"] td,
  158. .message-content table.audit-result th,
  159. .message-content table.audit-result td,
  160. .message-content table[data-type="audit-result"] th,
  161. .message-content table[data-type="audit-result"] td,
  162. .markdown-content table.audit-result th,
  163. .markdown-content table.audit-result td,
  164. .markdown-content table[data-type="audit-result"] th,
  165. .markdown-content table[data-type="audit-result"] td,
  166. .bot .message-content table.audit-result th,
  167. .bot .message-content table.audit-result td,
  168. .bot .message-content table[data-type="audit-result"] th,
  169. .bot .message-content table[data-type="audit-result"] td {
  170. padding: 6px 8px !important; /* 减小内边距,使表格更紧凑 */
  171. vertical-align: middle !important; /* 使用middle对齐,减少高度 */
  172. text-align: center !important; /* 确保所有单元格文字居中 */
  173. height: auto !important; /* 确保高度自适应 */
  174. min-height: auto !important;
  175. line-height: 1.4 !important; /* 保持紧凑的行高 */
  176. }
  177. /* 审核结果表格的表头增强 - 强制居中 */
  178. table.audit-result th,
  179. table[data-type="audit-result"] th,
  180. .message-content table.audit-result th,
  181. .message-content table[data-type="audit-result"] th,
  182. .markdown-content table.audit-result th,
  183. .markdown-content table[data-type="audit-result"] th,
  184. .bot .message-content table.audit-result th,
  185. .bot .message-content table[data-type="audit-result"] th {
  186. text-align: center !important;
  187. background-color: #eef2ff !important; /* 轻微的紫色背景 */
  188. color: #4F46E5 !important; /* 与网站主题色匹配 */
  189. }
  190. /* 审核结果表格第一行增强 - 强制居中 */
  191. table.audit-result tbody tr:first-child td,
  192. table[data-type="audit-result"] tbody tr:first-child td,
  193. .message-content table.audit-result tbody tr:first-child td,
  194. .message-content table[data-type="audit-result"] tbody tr:first-child td,
  195. .markdown-content table.audit-result tbody tr:first-child td,
  196. .markdown-content table[data-type="audit-result"] tbody tr:first-child td,
  197. .bot .message-content table.audit-result tbody tr:first-child td,
  198. .bot .message-content table[data-type="audit-result"] tbody tr:first-child td {
  199. text-align: center !important;
  200. vertical-align: middle !important;
  201. background-color: #f9fafb !important; /* 轻微的灰色背景 */
  202. height: auto !important; /* 确保高度自适应 */
  203. min-height: auto !important;
  204. }
  205. /* 表格单元格文字黑色和居中显示(不包括表头) */
  206. .message-content table td,
  207. .markdown-content table td,
  208. .bot .message-content table td,
  209. table td {
  210. color: #000000 !important; /* 确保所有普通单元格文字为黑色 */
  211. text-align: center !important; /* 确保所有单元格文字居中 */
  212. }
  213. /* 保持表头样式不变,但依然居中 */
  214. .message-content table th,
  215. .markdown-content table th,
  216. .bot .message-content table th,
  217. table th {
  218. text-align: center !important; /* 确保表头文字居中 */
  219. }
  220. /* 审核结果状态样式 */
  221. .message-content table tr.safe-row td,
  222. .markdown-content table tr.safe-row td,
  223. .bot .message-content table tr.safe-row td,
  224. .message-content table.risk-table tr.safe-row td,
  225. .markdown-content table.risk-table tr.safe-row td,
  226. .bot .message-content table.risk-table tr.safe-row td,
  227. .safe-row td {
  228. color: #000000 !important; /* 正常黑色文本 */
  229. }
  230. .message-content table tr.violation-row,
  231. .markdown-content table tr.violation-row,
  232. .bot .message-content table tr.violation-row,
  233. .message-content table.risk-table tr.violation-row,
  234. .markdown-content table.risk-table tr.violation-row,
  235. .bot .message-content table.risk-table tr.violation-row,
  236. .violation-row {
  237. background-color: rgba(239, 68, 68, 0.05) !important; /* 轻微红色背景 */
  238. }
  239. .message-content table tr.warning-row,
  240. .markdown-content table tr.warning-row,
  241. .bot .message-content table tr.warning-row,
  242. .message-content table.risk-table tr.warning-row,
  243. .markdown-content table.risk-table tr.warning-row,
  244. .bot .message-content table.risk-table tr.warning-row,
  245. .warning-row {
  246. background-color: rgba(245, 158, 11, 0.05) !important; /* 轻微黄色背景 */
  247. }
  248. /* 响应式样式 */
  249. @media (max-width: 768px) {
  250. .message-content table,
  251. .markdown-content table,
  252. .bot .message-content table {
  253. display: block !important;
  254. overflow-x: auto !important;
  255. -webkit-overflow-scrolling: touch !important;
  256. width: 100% !important; /* 确保在移动设备上也是100%宽度 */
  257. }
  258. .message-content table th,
  259. .message-content table td,
  260. .markdown-content table th,
  261. .markdown-content table td,
  262. .bot .message-content table th,
  263. .bot .message-content table td {
  264. min-width: 120px !important;
  265. text-align: center !important; /* 确保在移动设备上也居中 */
  266. }
  267. /* 即使在移动设备上也保持表格的宽度一致,只在需要时允许水平滚动 */
  268. table.audit-result,
  269. table[data-type="audit-result"],
  270. .message-content table.audit-result,
  271. .message-content table[data-type="audit-result"],
  272. .markdown-content table.audit-result,
  273. .markdown-content table[data-type="audit-result"],
  274. .bot .message-content table.audit-result,
  275. .bot .message-content table[data-type="audit-result"] {
  276. display: block !important;
  277. overflow-x: auto !important;
  278. white-space: nowrap !important;
  279. width: 100% !important;
  280. }
  281. table.audit-result td,
  282. table[data-type="audit-result"] td,
  283. .message-content table.audit-result td,
  284. .message-content table[data-type="audit-result"] td,
  285. .markdown-content table.audit-result td,
  286. .markdown-content table[data-type="audit-result"] td,
  287. .bot .message-content table.audit-result td,
  288. .bot .message-content table[data-type="audit-result"] td {
  289. white-space: normal !important;
  290. min-width: 150px !important;
  291. text-align: center !important; /* 确保在移动设备上也居中 */
  292. }
  293. }
  294. /* 暗黑模式表格样式优化 */
  295. @media (prefers-color-scheme: dark) {
  296. /* 通用表格样式 - 暗黑模式 */
  297. .message-content table,
  298. .markdown-content table,
  299. .bot .message-content table {
  300. background-color: rgba(30, 41, 59, 0.6) !important;
  301. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  302. border: 1px solid rgba(255, 255, 255, 0.1) !important;
  303. }
  304. /* 表格单元格通用样式 - 暗黑模式 */
  305. .message-content table th,
  306. .message-content table td,
  307. .markdown-content table th,
  308. .markdown-content table td,
  309. .bot .message-content table th,
  310. .bot .message-content table td {
  311. border-color: rgba(255, 255, 255, 0.15) !important;
  312. color: #e2e8f0 !important; /* 浅色文字 */
  313. padding: 6px 8px !important; /* 与亮色模式保持一致的紧凑内边距 */
  314. line-height: 1.4 !important; /* 紧凑的行高 */
  315. height: auto !important; /* 高度自适应 */
  316. min-height: auto !important;
  317. vertical-align: middle !important; /* 使用middle对齐 */
  318. }
  319. /* 表头样式 - 暗黑模式 */
  320. .message-content table th,
  321. .markdown-content table th,
  322. .bot .message-content table th {
  323. background-color: rgba(51, 65, 85, 0.8) !important; /* 深色背景 */
  324. color: #cbd5e1 !important; /* 浅色文字 */
  325. font-weight: 600 !important;
  326. border-color: rgba(99, 102, 241, 0.3) !important; /* 主题色边框 */
  327. padding: 8px 8px !important; /* 与亮色模式保持一致 */
  328. line-height: 1.4 !important; /* 紧凑的行高 */
  329. height: auto !important; /* 高度自适应 */
  330. min-height: auto !important;
  331. }
  332. /* 第一行文字居中 - 暗黑模式 */
  333. .message-content table tbody tr:first-child td,
  334. .markdown-content table tbody tr:first-child td,
  335. .bot .message-content table tbody tr:first-child td {
  336. background-color: rgba(51, 65, 85, 0.4) !important; /* 深色背景 */
  337. color: #e2e8f0 !important;
  338. height: auto !important; /* 确保高度自适应 */
  339. min-height: auto !important;
  340. }
  341. /* 偶数行背景 - 暗黑模式 */
  342. .message-content table tbody tr:nth-child(even),
  343. .markdown-content table tbody tr:nth-child(even),
  344. .bot .message-content table tbody tr:nth-child(even) {
  345. background-color: rgba(30, 41, 59, 0.4) !important; /* 深色背景 */
  346. }
  347. /* 悬停效果 - 暗黑模式 */
  348. .message-content table tbody tr:hover,
  349. .markdown-content table tbody tr:hover,
  350. .bot .message-content table tbody tr:hover {
  351. background-color: rgba(51, 65, 85, 0.6) !important; /* 深色悬停背景 */
  352. }
  353. /* 审核结果表格 - 暗黑模式 */
  354. table.audit-result,
  355. table[data-type="audit-result"],
  356. .message-content table.audit-result,
  357. .message-content table[data-type="audit-result"],
  358. .markdown-content table.audit-result,
  359. .markdown-content table[data-type="audit-result"],
  360. .bot .message-content table.audit-result,
  361. .bot .message-content table[data-type="audit-result"] {
  362. border-color: rgba(255, 255, 255, 0.15) !important;
  363. background-color: rgba(30, 41, 59, 0.6) !important;
  364. }
  365. /* 审核结果表格的表头 - 暗黑模式 */
  366. table.audit-result th,
  367. table[data-type="audit-result"] th,
  368. .message-content table.audit-result th,
  369. .message-content table[data-type="audit-result"] th,
  370. .markdown-content table.audit-result th,
  371. .markdown-content table[data-type="audit-result"] th,
  372. .bot .message-content table.audit-result th,
  373. .bot .message-content table[data-type="audit-result"] th {
  374. background-color: rgba(99, 102, 241, 0.2) !important; /* 主题色背景 */
  375. color: #e2e8f0 !important; /* 浅色文字 */
  376. border-color: rgba(99, 102, 241, 0.4) !important;
  377. padding: 8px 8px !important; /* 保持紧凑的内边距 */
  378. line-height: 1.4 !important; /* 紧凑的行高 */
  379. height: auto !important; /* 高度自适应 */
  380. min-height: auto !important;
  381. }
  382. /* 审核结果表格单元格 - 暗黑模式 */
  383. table.audit-result td,
  384. table[data-type="audit-result"] td,
  385. .message-content table.audit-result td,
  386. .message-content table[data-type="audit-result"] td,
  387. .markdown-content table.audit-result td,
  388. .markdown-content table[data-type="audit-result"] td,
  389. .bot .message-content table.audit-result td,
  390. .bot .message-content table[data-type="audit-result"] td {
  391. padding: 6px 8px !important; /* 保持紧凑的内边距 */
  392. line-height: 1.4 !important; /* 紧凑的行高 */
  393. height: auto !important; /* 高度自适应 */
  394. min-height: auto !important;
  395. vertical-align: middle !important; /* 使用middle对齐 */
  396. }
  397. /* 审核结果表格第一行 - 暗黑模式 */
  398. table.audit-result tbody tr:first-child td,
  399. table[data-type="audit-result"] tbody tr:first-child td,
  400. .message-content table.audit-result tbody tr:first-child td,
  401. .message-content table[data-type="audit-result"] tbody tr:first-child td,
  402. .markdown-content table.audit-result tbody tr:first-child td,
  403. .markdown-content table[data-type="audit-result"] tbody tr:first-child td,
  404. .bot .message-content table.audit-result tbody tr:first-child td,
  405. .bot .message-content table[data-type="audit-result"] tbody tr:first-child td {
  406. background-color: rgba(51, 65, 85, 0.4) !important;
  407. color: #e2e8f0 !important;
  408. height: auto !important; /* 确保高度自适应 */
  409. min-height: auto !important;
  410. }
  411. /* 表格单元格文字颜色 - 暗黑模式(覆盖黑色文字) */
  412. .message-content table td,
  413. .markdown-content table td,
  414. .bot .message-content table td,
  415. table td {
  416. color: #cbd5e1 !important; /* 浅色文字替代黑色 */
  417. background-color: rgba(30, 41, 59, 0.3) !important;
  418. height: auto !important; /* 确保高度自适应 */
  419. min-height: auto !important;
  420. padding: 6px 8px !important; /* 保持紧凑的内边距 */
  421. line-height: 1.4 !important; /* 紧凑的行高 */
  422. vertical-align: middle !important; /* 使用middle对齐 */
  423. }
  424. /* 审核结果状态样式 - 暗黑模式 */
  425. .message-content table tr.safe-row td,
  426. .markdown-content table tr.safe-row td,
  427. .bot .message-content table tr.safe-row td,
  428. .message-content table.risk-table tr.safe-row td,
  429. .markdown-content table.risk-table tr.safe-row td,
  430. .bot .message-content table.risk-table tr.safe-row td,
  431. .safe-row td {
  432. color: #86efac !important; /* 绿色文字 */
  433. background-color: rgba(16, 185, 129, 0.15) !important;
  434. }
  435. .message-content table tr.violation-row,
  436. .markdown-content table tr.violation-row,
  437. .bot .message-content table tr.violation-row,
  438. .message-content table.risk-table tr.violation-row,
  439. .markdown-content table.risk-table tr.violation-row,
  440. .bot .message-content table.risk-table tr.violation-row,
  441. .violation-row {
  442. background-color: rgba(239, 68, 68, 0.2) !important; /* 红色背景增强 */
  443. }
  444. .message-content table tr.violation-row td,
  445. .markdown-content table tr.violation-row td,
  446. .bot .message-content table tr.violation-row td,
  447. .violation-row td {
  448. color: #fca5a5 !important; /* 浅红色文字 */
  449. }
  450. .message-content table tr.warning-row,
  451. .markdown-content table tr.warning-row,
  452. .bot .message-content table tr.warning-row,
  453. .message-content table.risk-table tr.warning-row,
  454. .markdown-content table.risk-table tr.warning-row,
  455. .bot .message-content table.risk-table tr.warning-row,
  456. .warning-row {
  457. background-color: rgba(245, 158, 11, 0.2) !important; /* 黄色背景增强 */
  458. }
  459. .message-content table tr.warning-row td,
  460. .markdown-content table tr.warning-row td,
  461. .bot .message-content table tr.warning-row td,
  462. .warning-row td {
  463. color: #fcd34d !important; /* 浅黄色文字 */
  464. }
  465. }