/* 站内消息：顶部铃铛、消息面板与即时提醒卡片 */
.header-notice { position: relative; flex: 0 0 auto; }

.notice-bell {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}
.notice-bell:hover { border-color: #c9d6f4; color: var(--green); background: var(--green-mist); }
.notice-bell:focus-visible { outline: 3px solid rgba(47, 91, 215, .22); outline-offset: 2px; }
.notice-bell svg { width: 18px; height: 18px; }
.notice-bell.has-unread { color: var(--green); border-color: rgba(47, 91, 215, .3); background: var(--green-wash); }
.notice-bell.has-unread svg { animation: notice-swing 900ms var(--ease) both; }
@keyframes notice-swing {
  0%, 100% { transform: rotate(0); }
  22% { transform: rotate(-11deg); }
  46% { transform: rotate(9deg); }
  68% { transform: rotate(-5deg); }
  86% { transform: rotate(3deg); }
}

.notice-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--surface);
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  font-family: var(--sans);
}

.notice-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: min(390px, calc(100vw - 24px));
  max-height: min(570px, calc(100vh - 106px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 26px 64px -26px rgba(22, 32, 51, .42);
  z-index: 60;
}

.notice-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fbfdff, #fff);
}
.notice-panel-title { min-width: 0; line-height: 1.35; }
.notice-panel-title strong { display: block; font-size: 14px; font-weight: 700; color: var(--ink); }
.notice-panel-title span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--faint); }
.notice-readall {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  color: var(--green);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.notice-readall:hover { text-decoration: underline; }
.notice-readall:disabled { color: #b9c2d4; cursor: default; text-decoration: none; }

.notice-list { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.notice-item {
  position: relative;
  display: block;
  padding: 12px 15px 12px 27px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.notice-item:last-child { border-bottom: 0; }
.notice-item:hover { background: var(--surface-2); color: var(--ink); }
.notice-item.is-unread { background: #f6f9ff; }
.notice-item.is-unread:hover { background: #eef4ff; }
.notice-item.is-unread::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 91, 215, .12);
}
.notice-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.notice-item-title { font-size: 12.5px; font-weight: 650; line-height: 1.45; color: var(--ink); }
.notice-item.is-unread .notice-item-title { color: var(--green-2); }
.notice-item time { flex: 0 0 auto; font-size: 9.5px; color: var(--faint); font-family: var(--mono); }
.notice-item-body {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.62;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notice-item-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 9.5px;
  color: var(--faint);
}
.notice-item-tone { width: 3px; height: 12px; border-radius: 2px; background: var(--green); }
.notice-item-tone--red { background: var(--red); }
.notice-item-tone--amber { background: var(--amber); }
.notice-item-tone--blue { background: var(--green); }

.notice-empty { padding: 42px 20px; text-align: center; font-size: 12px; color: var(--faint); }
.notice-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 15px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: 9.5px;
  color: var(--faint);
}
.notice-live { display: inline-flex; align-items: center; gap: 6px; color: var(--success); }
.notice-live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(15, 138, 106, .12); }
.notice-live.is-down { color: var(--amber); }

/* 右下角即时卡片，保证任何页面提交后对方马上看到 */
#notice-toast-root {
  position: fixed;
  top: 86px;
  right: 20px;
  z-index: 110;
  width: min(365px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.notice-toast {
  pointer-events: auto;
  display: flex;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 22px 52px -24px rgba(22, 32, 51, .45);
  cursor: pointer;
  animation: notice-toast-in 240ms var(--ease) both;
  transition: transform 140ms var(--ease), box-shadow 140ms var(--ease);
}
.notice-toast:hover { transform: translateY(-1px); box-shadow: 0 26px 58px -24px rgba(22, 32, 51, .5); }
.notice-toast.is-out { animation: notice-toast-out 180ms var(--ease) both; }
.notice-toast--red { border-left-color: var(--red); }
.notice-toast--amber { border-left-color: var(--amber); }
.notice-toast-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--green-wash);
  color: var(--green);
}
.notice-toast--red .notice-toast-icon { background: var(--red-wash); color: var(--red); }
.notice-toast--amber .notice-toast-icon { background: var(--amber-wash); color: var(--amber); }
.notice-toast-icon svg { width: 16px; height: 16px; }
.notice-toast-copy { min-width: 0; flex: 1; }
.notice-toast-copy strong { display: block; font-size: 12.5px; font-weight: 700; line-height: 1.45; }
.notice-toast-copy p {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notice-toast-go {
  align-self: center;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
}
@keyframes notice-toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes notice-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(10px); } }

@media (max-width: 1420px) {
  .header-notice { order: 1; margin-left: auto; }
  .header-notice .notice-bell { width: 36px; height: 36px; }
  .mobile-toggle { order: 2; margin-left: 0; }
}
@media (max-width: 620px) {
  .notice-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 64px;
    width: auto;
    max-height: calc(100vh - 78px);
  }
  #notice-toast-root { top: 76px; right: 14px; width: calc(100vw - 28px); }
  .notice-item { padding-right: 12px; }
}
