/* Mermaid 图表 */
.markdown-section .mermaid {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  margin: 1.2em 0;
  padding: 8px 0;
}

.markdown-section .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* 右侧：本页目录 + 批注 */
#right-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  background: #fafbfc;
  border-left: 1px solid #eaecef;
  padding: 72px 14px 24px;
  box-sizing: border-box;
  font-size: 13px;
  line-height: 1.5;
}

.right-panel-section + .right-panel-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eaecef;
}

.right-panel-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.02em;
}

#ann-count {
  font-weight: 400;
  color: #909399;
}

/* 正文区域为右侧栏留出空间（docsify .content 为 absolute + right:0，margin 无效） */
section.content,
.content {
  right: 260px;
}

body.close section.content,
body.close .content {
  right: 260px;
}

.page-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-toc li {
  margin: 4px 0;
  line-height: 1.45;
}

.page-toc li.toc-h2 {
  padding-left: 0;
}

.page-toc li.toc-h3 {
  padding-left: 12px;
}

.page-toc li.toc-h4 {
  padding-left: 24px;
  font-size: 12px;
  color: #606266;
}

.page-toc a {
  color: #606266;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-toc a:hover,
.page-toc a.active {
  color: var(--theme-color, #2563eb);
}

.page-toc-empty {
  color: #909399;
  font-size: 12px;
}

/* 左侧栏不展开页内小标题（subMaxLevel=0 的兜底） */
.sidebar .app-sub-sidebar {
  display: none !important;
}

/* 批注列表 */
.page-annotations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ann-card {
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.ann-quote {
  color: #606266;
  border-left: 3px solid #fde68a;
  padding-left: 8px;
  margin-bottom: 6px;
  font-style: italic;
  word-break: break-word;
}

.ann-comment {
  color: #303133;
  margin-bottom: 6px;
  word-break: break-word;
}

.ann-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #909399;
  font-size: 11px;
}

.ann-delete {
  border: none;
  background: none;
  color: #f56c6c;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.ann-delete:hover {
  text-decoration: underline;
}

.ann-empty {
  color: #909399;
  font-size: 12px;
}

/* 正文内高亮 */
mark.apigc-ann {
  background: #fef3c7;
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
}

mark.apigc-ann.active {
  background: #fde047;
  outline: 1px solid #f59e0b;
}

/* 选取批注浮动按钮 */
#ann-toolbar {
  position: absolute;
  z-index: 100;
  display: none;
  background: #303133;
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#ann-toolbar.visible {
  display: block;
}

#ann-popover {
  position: absolute;
  z-index: 101;
  display: none;
  width: 280px;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

#ann-popover.visible {
  display: block;
}

#ann-popover textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 8px;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

#ann-popover .ann-pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

#ann-popover button {
  border: 1px solid #dcdfe6;
  background: #fff;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

#ann-popover button.primary {
  background: var(--theme-color, #2563eb);
  border-color: var(--theme-color, #2563eb);
  color: #fff;
}

/* PRD 在线编辑 */
.prd-edit-launch {
  width: 100%;
  border: 1px solid var(--theme-color, #2563eb);
  background: #eff6ff;
  color: var(--theme-color, #2563eb);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.prd-edit-launch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.prd-edit-hint {
  margin-top: 8px;
  color: #909399;
  font-size: 11px;
  line-height: 1.45;
}

/* 所见即所得编辑 */
body.prd-editing section.content,
body.prd-editing .content {
  padding-top: 0;
}

.prd-wysiwyg-toolbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.prd-inline-meta {
  min-width: 120px;
}

.prd-inline-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
}

.prd-inline-path {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
  word-break: break-all;
}

.prd-wysiwyg-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.prd-wysiwyg-tools button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #334155;
}

.prd-wysiwyg-tools button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.prd-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.prd-inline-status {
  font-size: 12px;
  color: #64748b;
}

.prd-inline-actions button {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.prd-inline-actions button.primary {
  background: var(--theme-color, #2563eb);
  border-color: var(--theme-color, #2563eb);
  color: #fff;
  font-weight: 600;
}

.markdown-section.prd-wysiwyg-editing {
  outline: 2px solid #93c5fd;
  outline-offset: 4px;
  border-radius: 6px;
  padding: 8px 12px;
  min-height: 200px;
  cursor: text;
  background: #fff;
}

.markdown-section.prd-wysiwyg-editing:focus {
  outline-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.prd-editable-fence {
  margin: 16px 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.prd-editable-fence-label {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}

.prd-editable-fence-input {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 0;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

.prd-editable-mermaid .prd-editable-fence-input {
  min-height: 160px;
}

.prd-editable-fence-input:focus {
  background: #fefefe;
  box-shadow: inset 0 0 0 2px #93c5fd;
}

.prd-edit-hidden {
  display: none !important;
}

#prd-inline-editor {
  margin: 0 0 24px;
}

.prd-inline-toolbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

#prd-inline-textarea {
  display: block;
  width: 100%;
  min-height: calc(100vh - 240px);
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

#prd-inline-textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#prd-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 24px;
  box-sizing: border-box;
}

#prd-edit-overlay.visible {
  display: flex;
}

.prd-edit-dialog {
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prd-edit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #eaecef;
}

.prd-edit-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.prd-edit-path {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  word-break: break-all;
}

#prd-edit-close {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0 4px;
}

#prd-edit-textarea {
  flex: 1;
  min-height: 420px;
  border: none;
  resize: vertical;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  outline: none;
  box-sizing: border-box;
}

.prd-edit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid #eaecef;
  background: #fafbfc;
}

.prd-edit-status {
  font-size: 12px;
  color: #6b7280;
}

.prd-edit-actions {
  display: flex;
  gap: 8px;
}

.prd-edit-actions button {
  border: 1px solid #dcdfe6;
  background: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.prd-edit-actions button.primary {
  background: var(--theme-color, #2563eb);
  border-color: var(--theme-color, #2563eb);
  color: #fff;
}

.prd-auth-user {
  font-size: 12px;
  color: #374151;
  margin-bottom: 8px;
  word-break: break-word;
}

.prd-auth-secondary {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #374151;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}

.prd-auth-secondary.hidden,
.hidden {
  display: none !important;
}

#prd-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 24px;
  box-sizing: border-box;
}

#prd-login-overlay.visible {
  display: flex;
}

.prd-login-dialog {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.prd-login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #eaecef;
}

.prd-login-title {
  font-size: 15px;
  font-weight: 700;
}

#prd-login-close {
  border: none;
  background: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
}

#prd-login-form,
#prd-login-mfa {
  padding: 16px;
}

.prd-login-label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
}

.prd-login-label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  box-sizing: border-box;
}

.prd-login-error {
  min-height: 18px;
  color: #dc2626;
  font-size: 12px;
  margin-bottom: 8px;
}

.prd-login-hint {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
}

.prd-login-submit {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--theme-color, #2563eb);
  color: #fff;
}

@media (max-width: 1100px) {
  #right-panel {
    display: none;
  }
  section.content,
  .content,
  body.close section.content,
  body.close .content {
    right: 0;
  }
}
