/* 后台「基础数据 › 菜单管理」拖拽编辑器（配合 js/admin-menu.js）。 */
#siteMenuHost {
  --mm-blue: #2b67ff;
  --mm-ink: #1e293b;
  --mm-muted: #64748b;
  --mm-line: #e3e9f3;
  --mm-ease: cubic-bezier(.22, 1.08, .36, 1);
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  color: var(--mm-ink);
}
#siteMenuHost svg { width: 16px; height: 16px; flex-shrink: 0; }
#siteMenuHost .mm-grip svg, #siteMenuHost .mm-btn svg, #siteMenuHost .mm-tb svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#siteMenuHost .mm-grip svg circle { fill: currentColor; stroke: none; }
#siteMenuHost .ad-glyph, .mm-pop .ad-glyph { fill: currentColor; }

/* ---------- 顶部工具条 ---------- */
#siteMenuHost .mm-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--mm-line); border-radius: 14px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(8px); box-shadow: 0 6px 18px -12px rgba(30, 41, 59, .35);
}
#siteMenuHost .mm-bar-r { display: flex; gap: 8px; flex-wrap: wrap; }
#siteMenuHost .mm-state {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: #ecfdf3; color: #15803d; transition: background .25s, color .25s;
}
#siteMenuHost .mm-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
#siteMenuHost .mm-state[data-st="saving"] { background: #eef3ff; color: var(--mm-blue); }
#siteMenuHost .mm-state[data-st="saving"]::before { animation: mm-pulse 1s ease-in-out infinite; }
#siteMenuHost .mm-state[data-st="err"] { background: #fff1f1; color: #dc2626; cursor: pointer; }
#siteMenuHost .mm-tb {
  display: inline-flex !important; align-items: center; gap: 6px; height: 32px; padding: 0 12px !important; border-radius: 9px !important;
  border: 1px solid var(--mm-line) !important; background: #fff !important; color: #334155 !important; font-size: 13px !important;
  cursor: pointer; transition: transform .2s var(--mm-ease), border-color .2s, color .2s, background .2s, box-shadow .2s;
}
#siteMenuHost .mm-tb:hover:not(:disabled) { transform: translateY(-1px); border-color: #b9c9f5 !important; color: var(--mm-blue) !important; box-shadow: 0 6px 14px -10px rgba(43, 103, 255, .7); }
#siteMenuHost .mm-tb:disabled { opacity: .45; cursor: default; }
#siteMenuHost .mm-tb--primary { background: linear-gradient(135deg, #2b67ff, #4f86ff) !important; border-color: transparent !important; color: #fff !important; }
#siteMenuHost .mm-tb--primary:hover:not(:disabled) { color: #fff !important; box-shadow: 0 8px 18px -10px rgba(43, 103, 255, .9); }
#siteMenuHost .mm-tb.is-armed { background: #fff1f1 !important; border-color: #fca5a5 !important; color: #dc2626 !important; animation: mm-shake .35s; }

/* ---------- 一级菜单卡片 ---------- */
#siteMenuHost .mm-groups { display: flex; flex-direction: column; gap: 12px; }
#siteMenuHost .mm-g {
  position: relative; border: 1px solid var(--mm-line); border-radius: 14px; background: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 8px 22px -18px rgba(30, 41, 59, .5);
  transition: transform .24s var(--mm-ease), box-shadow .2s, border-color .2s, opacity .22s;
}
#siteMenuHost .mm-g:hover { border-color: #cdd9f3; }
#siteMenuHost .mm-g.is-hidden { background: repeating-linear-gradient(135deg, #fafbfd 0 10px, #f5f7fb 10px 20px); }
#siteMenuHost .mm-g.is-hidden .mm-gh > .mm-ico, #siteMenuHost .mm-g.is-hidden .mm-name--g, #siteMenuHost .mm-g.is-hidden .mm-items { opacity: .5; }
#siteMenuHost .mm-gh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
#siteMenuHost .mm-ico {
  display: grid !important; place-items: center; width: 34px; height: 34px; padding: 0 !important; border-radius: 10px !important;
  border: 0 !important; cursor: pointer; color: var(--mm-blue) !important;
  background: linear-gradient(135deg, #e8efff, #dbe7ff) !important; transition: transform .25s var(--mm-ease), box-shadow .2s;
}
#siteMenuHost .mm-ico:hover { transform: scale(1.08) rotate(-5deg); box-shadow: 0 6px 14px -8px rgba(43, 103, 255, .8); }
#siteMenuHost .mm-ico svg { width: 18px; height: 18px; }
#siteMenuHost .mm-tag { padding: 2px 8px; border-radius: 999px; background: #f3e8ff; color: #7c3aed; font-size: 11.5px; white-space: nowrap; }
#siteMenuHost .mm-count {
  min-width: 42px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--mm-muted);
  font-size: 12px; text-align: center; font-variant-numeric: tabular-nums;
}

/* ---------- 名称输入：平时像文字，悬停/聚焦显出输入框 ---------- */
#siteMenuHost .mm-name {
  flex: 1 1 auto; min-width: 60px; height: 32px; padding: 0 8px !important; border: 1px solid transparent !important; border-radius: 8px !important;
  background: transparent !important; color: var(--mm-ink) !important; font-size: 14px !important; box-shadow: none !important;
  text-align: center !important; text-align-last: center !important; outline: none; transition: border-color .2s, background .2s, box-shadow .2s;
}
#siteMenuHost .mm-name--g { font-size: 15px !important; font-weight: 600; }
#siteMenuHost .mm-name:hover { border-color: var(--mm-line) !important; background: #f8fafc !important; }
#siteMenuHost .mm-name:focus { border-color: #9db8ff !important; background: #fff !important; box-shadow: 0 0 0 3px rgba(43, 103, 255, .14) !important; }

/* ---------- 子菜单 ---------- */
#siteMenuHost .mm-items {
  display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0 12px 12px 54px; list-style: none;
  transition: opacity .2s;
}
#siteMenuHost .mm-g.is-fold .mm-items { display: none; }
#siteMenuHost .mm-it {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 8px;
  border: 1px solid #edf1f7; border-radius: 10px; background: #fbfcfe;
  transition: transform .24s var(--mm-ease), border-color .2s, background .2s, box-shadow .2s, opacity .2s;
}
#siteMenuHost .mm-it::before {
  content: ""; position: absolute; left: -22px; top: 50%; width: 16px; height: 1px; background: #dbe3ef;
}
#siteMenuHost .mm-it:hover { border-color: #cfdcf5; background: #fff; box-shadow: 0 6px 14px -12px rgba(30, 41, 59, .6); }
#siteMenuHost .mm-it.is-hidden { opacity: .55; background: #f6f7fa; }
#siteMenuHost .mm-it.is-hidden .mm-name { text-decoration: line-through; text-decoration-color: #94a3b8; }
#siteMenuHost .mm-iico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #eef3ff; color: #4f7bf0; }
#siteMenuHost .mm-iico svg { width: 14px; height: 14px; }
#siteMenuHost .mm-empty {
  display: none; padding: 12px; border: 1.5px dashed #cfd9ea; border-radius: 10px; color: #94a3b8; font-size: 13px; text-align: center;
}
#siteMenuHost .mm-items:not(:has(.mm-it)) .mm-empty { display: block; }
body.mm-dragging #siteMenuHost .mm-empty { display: block; padding: 6px; font-size: 12px; opacity: .7; }
body.mm-dragging #siteMenuHost .mm-items:not(:has(.mm-it)) .mm-empty { padding: 14px; opacity: 1; border-color: #9db8ff; color: var(--mm-blue); background: #f5f8ff; }

/* ---------- 小按钮 ---------- */
#siteMenuHost .mm-grip {
  display: grid; place-items: center; width: 24px; height: 30px; border-radius: 7px; color: #a3afc2; cursor: grab;
  touch-action: none; transition: color .2s, background .2s; outline: none;
}
#siteMenuHost .mm-grip:hover, #siteMenuHost .mm-grip:focus-visible { color: var(--mm-blue); background: #eef3ff; }
#siteMenuHost .mm-grip:focus-visible { box-shadow: 0 0 0 2px rgba(43, 103, 255, .35); }
#siteMenuHost .mm-btn {
  display: grid !important; place-items: center; width: 30px; height: 30px; padding: 0 !important; border: 0 !important;
  border-radius: 8px !important; background: transparent !important; color: #8592a6 !important; cursor: pointer;
  transition: color .2s, background .2s, transform .2s var(--mm-ease);
}
#siteMenuHost .mm-btn:hover:not(:disabled) { background: #eef3ff !important; color: var(--mm-blue) !important; transform: scale(1.08); }
#siteMenuHost .mm-btn:disabled { opacity: .35; cursor: not-allowed; }
#siteMenuHost .mm-eye.is-off { color: #c2410c !important; }
#siteMenuHost .mm-del:hover:not(:disabled) { background: #fff1f1 !important; color: #dc2626 !important; }
#siteMenuHost .mm-del.is-armed { background: #dc2626 !important; color: #fff !important; animation: mm-shake .35s; }
#siteMenuHost .mm-it .mm-del { width: 26px; height: 26px; }
#siteMenuHost .mm-it .mm-del:disabled { visibility: hidden; }
#siteMenuHost .mm-trash { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding: 12px 14px; border: 1px dashed #d4dbe8; border-radius: 12px; background: #fafbfd; }
#siteMenuHost .mm-trash-t { margin-right: 4px; font-size: 13px; font-weight: 600; color: #8592a6; }
#siteMenuHost .mm-trash-it {
  display: inline-flex !important; align-items: center; gap: 6px; height: 28px; padding: 0 10px !important; border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important; background: #fff !important; color: #64748b !important; font-size: 13px; cursor: pointer; text-decoration: line-through;
  transition: color .2s, border-color .2s, background .2s;
}
#siteMenuHost .mm-trash-it em { font-style: normal; font-size: 11px; padding: 0 4px; border-radius: 4px; background: #eef2f7; text-decoration: none; }
#siteMenuHost .mm-trash-it i { display: grid; width: 14px; height: 14px; }
#siteMenuHost .mm-trash-it i svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
#siteMenuHost .mm-trash-it:hover { text-decoration: none; color: var(--mm-blue) !important; border-color: #bcd0ff !important; background: #eef3ff !important; }
#siteMenuHost .mm-fold svg { transition: transform .25s var(--mm-ease); }
#siteMenuHost .mm-g.is-fold .mm-fold svg { transform: rotate(-90deg); }

/* ---------- 拖拽 ---------- */
#siteMenuHost .mm-hole { border: 1.5px dashed #9db8ff !important; background: #f5f8ff !important; box-shadow: none !important; }
#siteMenuHost .mm-hole > * { visibility: hidden; }
body.mm-dragging, body.mm-dragging * { cursor: grabbing !important; user-select: none !important; }
.mm-ghost {
  position: fixed; z-index: 9999; margin: 0; pointer-events: none; list-style: none;
  border: 1px solid #9db8ff; border-radius: 12px; background: #fff; opacity: .96;
  box-shadow: 0 22px 40px -16px rgba(30, 64, 175, .45), 0 0 0 4px rgba(43, 103, 255, .08);
  display: flex; align-items: center; gap: 8px; padding: 4px 8px; min-height: 42px; color: #1e293b; font-size: 14px;
}
.mm-ghost.mm-g { display: block; padding: 0; }
.mm-ghost .mm-gh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.mm-ghost .mm-items { display: none !important; }
.mm-ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.mm-ghost .ad-glyph { fill: currentColor; stroke: none; }
#modalBackendAdmin .mm-ghost input {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
  font-size: 14px !important; color: inherit !important; text-align: center !important; text-align-last: center !important;
}
#modalBackendAdmin .mm-ghost .mm-name--g { font-size: 15px !important; font-weight: 600; }
.mm-ghost .mm-btn, .mm-ghost .mm-count, .mm-ghost .mm-tag { display: none; }
.mm-ghost .mm-ico, .mm-ghost .mm-iico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #e8efff; color: #2b67ff; border: 0; }

#siteMenuHost .mm-flash { animation: mm-flash .9s ease-out; }
#siteMenuHost .mm-out { opacity: 0; transform: translateX(24px) scale(.98); }
#siteMenuHost.is-enter .mm-g { animation: mm-in .35s var(--mm-ease) backwards; }
#siteMenuHost.is-enter .mm-g:nth-child(2) { animation-delay: .05s; }
#siteMenuHost.is-enter .mm-g:nth-child(3) { animation-delay: .1s; }
#siteMenuHost.is-enter .mm-g:nth-child(n+4) { animation-delay: .15s; }

/* ---------- 图标弹层 ---------- */
.mm-pop {
  position: fixed; z-index: 9999; display: grid; grid-template-columns: repeat(6, 34px); gap: 6px; padding: 10px;
  border: 1px solid #e3e9f3; border-radius: 12px; background: #fff; box-shadow: 0 20px 40px -18px rgba(30, 41, 59, .45);
  animation: mm-pop .18s var(--mm-ease);
}
.mm-pop button {
  display: grid !important; place-items: center; width: 34px; height: 34px; padding: 0 !important; border: 1px solid transparent !important;
  border-radius: 9px !important; background: #f6f8fc !important; color: #475569 !important; cursor: pointer; transition: transform .18s, background .18s, color .18s;
}
.mm-pop button:hover { transform: scale(1.1); background: #eef3ff !important; color: #2b67ff !important; }
.mm-pop button.is-on { border-color: #9db8ff !important; background: #eef3ff !important; color: #2b67ff !important; }
.mm-pop svg { width: 18px; height: 18px; }

@keyframes mm-pulse { 50% { opacity: .3; } }
@keyframes mm-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes mm-flash { 0% { box-shadow: 0 0 0 0 rgba(43, 103, 255, .45); border-color: #2b67ff; } 100% { box-shadow: 0 0 0 10px rgba(43, 103, 255, 0); } }
@keyframes mm-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes mm-pop { from { opacity: 0; transform: translateY(-4px) scale(.96); } }

@media (max-width: 720px) {
  #siteMenuHost .mm-bar { flex-direction: column; align-items: stretch; }
  #siteMenuHost .mm-items { padding-left: 20px; }
  #siteMenuHost .mm-it::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #siteMenuHost *, .mm-pop, .mm-ghost { animation: none !important; transition: none !important; }
}
