/* ===================================================================
 * 消息中心 / 公告弹窗
 * 与 console.html 的浅色控制台主题配套
 * =================================================================== */

/* 菜单里的未读角标 */
.ctx-item#umMessage { position: relative; }
.msg-dot {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  border-radius: 999px;
  background: #f2506b;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(242, 80, 107, 0.4);
}
.msg-dot[hidden] { display: none; }
.ctx-item.has-new span:not(.msg-dot) { font-weight: 600; }

/* ---------------- 消息中心面板 ---------------- */
.msg-mask {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 84px 20px 24px;
  background: rgba(15, 20, 38, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.msg-mask.show { display: flex; animation: msgFade 0.18s var(--ease, ease); }
body.msg-open { overflow: hidden; }

@keyframes msgFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes msgPop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.msg-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e8f2);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(15, 20, 38, 0.26);
  overflow: hidden;
  animation: msgPop 0.2s var(--ease, ease);
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e4e8f2);
  background: linear-gradient(180deg, var(--surface-2, #f7f8fc), var(--surface, #fff));
  flex: none;
}
.msg-title { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.msg-title b { font-size: 15px; color: var(--text, #171b2e); letter-spacing: 0.2px; }
.msg-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  flex: none;
}
.msg-ic svg { width: 17px; height: 17px; }
.msg-count {
  font-size: 11.5px;
  color: var(--text-3, #939bb2);
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3, #eef1f8);
}
.msg-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2, #545c75);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.msg-close:hover { background: var(--surface-3, #eef1f8); color: var(--text, #171b2e); }

.msg-list {
  padding: 14px 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-item {
  border: 1px solid var(--border, #e4e8f2);
  border-radius: 14px;
  padding: 13px 14px;
  background: var(--surface, #fff);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.msg-item.is-new {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.07);
}
.msg-item-top { display: flex; align-items: baseline; gap: 10px; }
.msg-item-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text, #171b2e);
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 7px;
  word-break: break-word;
}
.msg-new-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f2506b;
  flex: none;
  box-shadow: 0 0 0 3px rgba(242, 80, 107, 0.16);
}
.msg-time {
  flex: none;
  font-size: 11px;
  color: var(--text-3, #939bb2);
  font-variant-numeric: tabular-nums;
}

.msg-author {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-3, #939bb2);
}
.msg-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
  overflow: hidden;
}
.msg-avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-force {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  flex: none;
}

.msg-body {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2, #545c75);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg-body.collapsed {
  max-height: 76px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(180deg, #000 55%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.msg-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 8px 0;
  display: block;
  cursor: zoom-in;
  border: 1px solid var(--border, #e4e8f2);
}
.msg-body p { margin: 6px 0; }
.msg-body blockquote {
  margin: 8px 0;
  padding: 7px 12px;
  border-left: 3px solid rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.07);
  border-radius: 0 8px 8px 0;
  color: var(--text-2, #545c75);
}
.msg-body ul, .msg-body ol { margin: 6px 0; padding-left: 22px; }
.msg-body a { color: #4f46e5; text-decoration: underline; }

.msg-more {
  margin-top: 8px;
  border: none;
  background: transparent;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}
.msg-more:hover { text-decoration: underline; }

.msg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 54px 20px;
  color: var(--text-3, #939bb2);
  text-align: center;
}
.msg-empty svg { width: 42px; height: 42px; opacity: 0.5; margin-bottom: 4px; }
.msg-empty p { font-size: 14px; font-weight: 600; color: var(--text-2, #545c75); }
.msg-empty span { font-size: 12px; }

/* ---------------- 强制公告弹窗 ---------------- */
.msg-force-mask {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 20, 38, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: msgFade 0.2s var(--ease, ease);
}
.msg-force-box {
  width: min(500px, 100%);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(15, 20, 38, 0.36);
  overflow: hidden;
  animation: msgPop 0.24s var(--ease, ease);
}
.msg-force-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 20px 12px;
  flex: none;
}
.msg-force-tag {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  margin-top: 1px;
}
.msg-force-head b {
  font-size: 16.5px;
  line-height: 1.45;
  color: var(--text, #171b2e);
  word-break: break-word;
}
.msg-force-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 20px 12px;
  font-size: 11.5px;
  color: var(--text-3, #939bb2);
  border-bottom: 1px solid var(--border, #e4e8f2);
  flex: none;
}
.msg-force-body {
  padding: 16px 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-2, #545c75);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg-force-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 10px 0;
  display: block;
  border: 1px solid var(--border, #e4e8f2);
}
.msg-force-body p { margin: 8px 0; }
.msg-force-body blockquote {
  margin: 10px 0;
  padding: 8px 13px;
  border-left: 3px solid rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.07);
  border-radius: 0 8px 8px 0;
}
.msg-force-body a { color: #4f46e5; text-decoration: underline; }
.msg-force-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border, #e4e8f2);
  background: var(--surface-2, #f7f8fc);
  flex: none;
}
.msg-mute {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-2, #545c75);
  cursor: pointer;
  margin-right: auto;
}
.msg-mute input { width: 15px; height: 15px; accent-color: #6366f1; cursor: pointer; }
.msg-ok {
  flex: none;
  padding: 9px 22px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #7c5cf6);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.32);
}
.msg-ok:hover { filter: brightness(1.06); }

/* ---------------- 移动端 ---------------- */
@media (max-width: 640px) {
  .msg-mask {
    padding: 0;
    align-items: stretch;
  }
  .msg-panel {
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .msg-head { padding: 12px 14px; }
  .msg-list { padding: 12px 12px 28px; }
  .msg-force-box { max-height: 86vh; border-radius: 16px; }
  .msg-force-head { padding: 16px 16px 10px; }
  .msg-force-meta { padding: 0 16px 10px; }
  .msg-force-body { padding: 14px 16px; }
  .msg-force-foot { padding: 12px 16px 16px; flex-wrap: wrap; }
  .msg-ok { width: 100%; padding: 11px 18px; }
  .msg-mute { width: 100%; margin-right: 0; }
}
