/* mermaid 图表样式 —— 文章页与后台预览共用（两边的主 CSS 不同，故单独一份）
   脚本是异步加载的，加载期间用 min-height 占位，避免画完时页面往下跳。 */
.mermaid-box { margin: 22px 0; text-align: center; overflow-x: auto; }
.mermaid-box svg { max-width: 100%; height: auto; }

.mermaid-box.is-loading {
  min-height: 120px;
  border: 1px dashed #e0e0e0;
  border-radius: 6px;
  position: relative;
}
.mermaid-box.is-loading::after {
  content: "图表加载中…";
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  color: #bbb; font-size: 13px;
}

/* 渲染或加载失败时退回显示源码，别把内容吞掉 */
.mermaid-box.is-error {
  white-space: pre-wrap; text-align: left;
  font-family: Menlo, Consolas, monospace; font-size: 13px;
  background: #f7f7f8; color: #666;
  padding: 14px 16px; border-radius: 6px; border: 1px solid #ececec;
}

body.dark .mermaid-box.is-loading { border-color: #33333a; }
body.dark .mermaid-box.is-loading::after { color: #666; }
body.dark .mermaid-box.is-error {
  background: #24242a; color: #999; border-color: #33333a;
}
