/* 原型注释 · 红点序号 + 右侧抽屉（Axure 标注风格） */

.proto-note-marker {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ff4d4f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.proto-note-marker:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(255, 77, 79, 0.45);
}

.proto-note-host {
  position: relative !important;
}

.proto-notes-legend {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.proto-notes-legend .proto-note-marker {
  position: static;
  width: 18px;
  height: 18px;
  font-size: 10px;
  box-shadow: none;
}

.proto-drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.proto-drawer-mask.is-open {
  opacity: 1;
  visibility: visible;
}

.proto-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2001;
  width: min(420px, 92vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.proto-drawer-mask.is-open .proto-drawer {
  transform: translateX(0);
}

.proto-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.proto-drawer__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #262626;
}

.proto-drawer__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ff4d4f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.proto-drawer__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #8c8c8c;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.proto-drawer__close:hover {
  background: #f5f5f5;
  color: #262626;
}

.proto-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
  font-size: 13px;
  line-height: 1.65;
  color: #434343;
}

.proto-drawer__body p {
  margin: 0 0 10px;
}

.proto-drawer__body ul,
.proto-drawer__body ol {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

.proto-drawer__body li {
  margin-bottom: 6px;
}

.proto-drawer__body strong {
  color: #262626;
}

.proto-drawer__body .proto-sec {
  margin: 0 0 4px;
  padding-left: 8px;
  border-left: 3px solid #ff4d4f;
  font-size: 12px;
  font-weight: 600;
  color: #262626;
  text-transform: none;
  letter-spacing: 0;
}

.proto-drawer__body .proto-sec:not(:first-child) {
  margin-top: 14px;
}

.proto-drawer__body .proto-flow {
  margin: 6px 0 10px;
  padding: 8px 10px;
  background: #fafafa;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.55;
  color: #595959;
}

.proto-drawer__body .proto-kv {
  margin: 4px 0 8px;
  font-size: 12px;
}

.proto-drawer__body .proto-kv dt {
  font-weight: 600;
  color: #434343;
  margin-top: 6px;
}

.proto-drawer__body .proto-kv dd {
  margin: 2px 0 0;
  color: #595959;
}

/* 注释内 · 纵向流程图 */
.proto-flowchart {
  margin: 8px 0 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.proto-fc-node {
  position: relative;
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  line-height: 1.45;
  color: #434343;
}
.proto-fc-node strong {
  display: block;
  font-size: 12px;
  color: #262626;
  margin-bottom: 2px;
}
.proto-fc-node--start {
  background: #e6f7ff;
  border-color: #91d5ff;
  text-align: center;
  font-weight: 600;
  color: #0958d9;
}
.proto-fc-node--end {
  background: #f6ffed;
  border-color: #b7eb8f;
  text-align: center;
  font-weight: 600;
  color: #389e0d;
}
.proto-fc-node--decision {
  background: #fffbe6;
  border-color: #ffe58f;
  text-align: center;
  font-weight: 600;
  color: #ad6800;
}
.proto-fc-node--warn {
  background: #fff2f0;
  border-color: #ffccc7;
}
.proto-fc-desc {
  font-size: 11px;
  color: #8c8c8c;
  margin-top: 2px;
}
.proto-fc-badge {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--primary, #1890ff);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.proto-fc-arrow {
  text-align: center;
  color: #bfbfbf;
  font-size: 14px;
  line-height: 1;
  padding: 2px 0;
}
.proto-fc-branch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0;
}
.proto-fc-branch-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.proto-fc-label {
  display: block;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #595959;
  margin-bottom: 4px;
}
.proto-fc-group {
  margin: 6px 0;
  padding: 8px;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  background: #fafafa;
}
.proto-fc-group-title {
  font-size: 11px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 6px;
}

.proto-drawer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.proto-drawer__nav-btn {
  padding: 4px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.proto-drawer__nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.proto-drawer__index {
  font-size: 12px;
  color: #8c8c8c;
}

/* 版本差异注释 · v1.3 */
.proto-ver { margin: 0 0 8px; padding: 6px 8px; border-radius: 4px; font-size: 12px; line-height: 1.55; }
.proto-ver--old { color: #8c8c8c; text-decoration: line-through; background: #fafafa; border-left: 3px solid #d9d9d9; }
.proto-ver--new { color: #389e0d; background: #f6ffed; border-left: 3px solid #95de64; text-decoration: none; }
.proto-ver-tag { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; font-size: 10px; font-weight: 700; vertical-align: middle; }
.proto-ver--old .proto-ver-tag { background: #f0f0f0; color: #595959; text-decoration: none; }
.proto-ver--new .proto-ver-tag { background: #389e0d; color: #fff; }

/* 右下角序号收纳坞（SPA 友好） */
.proto-notes-dock {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 110;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.proto-notes-dock > * {
  pointer-events: auto;
}

.proto-notes-legend--dock {
  position: static;
}

.proto-note-marker--dock {
  position: static;
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.proto-note-marker.is-active {
  outline: 2px solid #ff7875;
  outline-offset: 2px;
}

.proto-mermaid {
  margin: 8px 0 12px;
  padding: 10px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  overflow-x: auto;
}

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

.proto-mermaid-fallback {
  margin: 0;
  font-size: 11px;
  white-space: pre-wrap;
  color: #595959;
}

/* 后台宽屏时坞略上移避免挡操作 */
body.ew-admin .proto-notes-dock {
  bottom: 24px;
}

/* ── 顶部流程序号（仅红点，详情进抽屉） ── */
.proto-flow-banner {
  position: relative;
  z-index: 130;
  margin: 0 0 8px;
  padding: 6px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: transparent;
  border: none;
  box-shadow: none;
}

#ew-root > .proto-flow-banner,
#admin-root > .proto-flow-banner {
  margin: 0 0 10px;
}

.proto-flow-banner .proto-note-marker {
  position: static;
}

/* 按钮旁：控件 + 序号（无 tip 文案） */
.proto-note-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  max-width: 100%;
}

.proto-note-wrap > .proto-note-marker {
  position: static;
  flex-shrink: 0;
}

.proto-note-wrap:has(> .ew-task__cta),
.proto-note-wrap:has(> .ew-btn--primary),
.proto-note-wrap:has(> .ew-btn--wechat) {
  display: flex;
  width: 100%;
}

.proto-note-wrap:has(> .ew-task__cta) > .ew-task__cta,
.proto-note-wrap:has(> .ew-btn--primary) > .ew-btn--primary,
.proto-note-wrap:has(> .ew-btn--wechat) > .ew-btn--wechat {
  flex: 1;
}

.proto-note-corner {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.proto-note-corner .proto-note-marker {
  position: static;
}

/* 抽屉内「数据来源」块 */
.proto-drawer__body .proto-src {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #F5F7FA;
  border: 1px solid #EBEEF5;
  font-size: 12px;
  line-height: 1.55;
  color: #606266;
}

.proto-drawer__body .proto-src code {
  font-size: 11px;
  background: #EEF2F7;
  padding: 1px 5px;
  border-radius: 3px;
}

@media (max-width: 480px) {
  .proto-drawer {
    width: 100%;
  }

  .proto-notes-legend {
    bottom: 10px;
    right: 10px;
    font-size: 11px;
  }

  .proto-notes-dock {
    bottom: 72px;
    right: 10px;
  }
}
