/* 全宽布局 */
html .md-grid,
:root .md-grid {
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

html .md-container,
:root .md-container {
  max-width: 100% !important;
}

html .md-main__inner,
:root .md-main__inner {
  max-width: 100% !important;
}

/* 侧边栏导航样式修复 */
/* 一级导航项（总体框架、业务模型等）- 明确标识为分组标题 */
html body .md-sidebar--primary li.md-nav__item--section > label.md-nav__link,
html body .md-sidebar--primary li.md-nav__item--section > .md-nav__link {
  color: #4051b5 !important;
  font-weight: 700 !important;
  cursor: default !important;
}

/* 子菜单链接 - 可点击跳转 */
html body .md-sidebar--primary li.md-nav__item--nested > .md-nav__link {
  color: rgba(0, 0, 0, 0.87) !important;
}

/* 悬浮效果 */
.md-sidebar--primary .md-nav__link:hover {
  background-color: var(--md-accent-faint);
}

/* 当前选中高亮 */
.md-sidebar--primary .md-nav__link--active {
  color: var(--md-accent-fg-color);
  background-color: var(--md-accent-faint);
}

/* 当前选中项的父级导航高亮 */
.md-sidebar--primary .md-nav__item--checked > .md-nav__link {
  color: var(--md-accent-fg-color);
  font-weight: bold;
}

/* ------------------------------------------------------------------
 * 文档建设缺口标记（面向建设/评审快速扫读；默认带 emoji 前缀）
 * 写法见 project-docs/00-需关注/缺口标记写法规范.md
 * ------------------------------------------------------------------ */

.md-typeset .doc-gap {
  display: inline;
  padding: 0.12em 0.45em;
  border-radius: 0.25em;
  font-weight: 700;
  font-size: 0.92em;
  white-space: nowrap;
  border-left: 3px solid transparent;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* 🔍 待核验：已有说法，缺环境/源码复核 */
.md-typeset .doc-gap--verify {
  color: #8a5a00;
  background-color: #fff3cd;
  border-left-color: #e6a700;
}

/* ❓ 待确认：缺产品/开发口径 */
.md-typeset .doc-gap--confirm {
  color: #9a3412;
  background-color: #ffedd5;
  border-left-color: #ea580c;
}

/* 📝 待补充：结构在、内容空 */
.md-typeset .doc-gap--fill {
  color: #1e3a8a;
  background-color: #dbeafe;
  border-left-color: #2563eb;
}

/* 📷/📐 媒体占位（句中少用，优先 admonition） */
.md-typeset .doc-gap--media {
  color: #713f12;
  background-color: #fef9c3;
  border-left-color: #ca8a04;
  border: 1px dashed #ca8a04;
  border-left-width: 3px;
}

/* ⛔ 高风险勿培训（少用） */
.md-typeset .doc-gap--danger {
  color: #7f1d1d;
  background-color: #fee2e2;
  border-left-color: #dc2626;
}

/* 暗色模式 */
[data-md-color-scheme="slate"] .md-typeset .doc-gap--verify {
  color: #fde68a;
  background-color: rgba(230, 167, 0, 0.22);
}
[data-md-color-scheme="slate"] .md-typeset .doc-gap--confirm {
  color: #fdba74;
  background-color: rgba(234, 88, 12, 0.22);
}
[data-md-color-scheme="slate"] .md-typeset .doc-gap--fill {
  color: #bfdbfe;
  background-color: rgba(37, 99, 235, 0.25);
}
[data-md-color-scheme="slate"] .md-typeset .doc-gap--media {
  color: #fde047;
  background-color: rgba(202, 138, 4, 0.2);
  border-color: #ca8a04;
}
[data-md-color-scheme="slate"] .md-typeset .doc-gap--danger {
  color: #fecaca;
  background-color: rgba(220, 38, 38, 0.25);
}

/* 媒体占位 admonition（!!! example）虚线强调 */
.md-typeset .admonition.example,
.md-typeset details.example {
  border-color: #ca8a04;
  border-style: dashed;
  background-color: #fffbeb;
}
.md-typeset .admonition.example > .admonition-title,
.md-typeset details.example > summary {
  background-color: #fef3c7;
  border-color: #ca8a04;
}
[data-md-color-scheme="slate"] .md-typeset .admonition.example,
[data-md-color-scheme="slate"] .md-typeset details.example {
  background-color: rgba(202, 138, 4, 0.12);
}
[data-md-color-scheme="slate"] .md-typeset .admonition.example > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset details.example > summary {
  background-color: rgba(202, 138, 4, 0.22);
}

/* Mermaid 图表容器 - 弹窗功能 */
.md-typeset .mermaid {
  position: relative;
  cursor: pointer;
}

/* 弹窗遮罩层 */
.mermaid-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* 弹窗打开状态 */
.mermaid-modal.active {
  display: flex;
}

/* 弹窗关闭按钮 */
.mermaid-modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: background 0.2s;
}

.mermaid-modal-close:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* 弹窗内容区 - 全屏显示 */
.mermaid-modal-content {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: white;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 弹窗内图表 - 全屏填充 */
.mermaid-modal-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  padding: 60px 20px 80px 20px;
}

.mermaid-modal svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* 缩放控制按钮 */
.mermaid-zoom-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mermaid-zoom-btn {
  width: 40px;
  height: 40px;
  background: var(--md-primary-fg-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-zoom-btn:hover {
  background: var(--md-primary-fg-color--dark);
}