/* ==========================================================================
   /messages —— 独立站内消息页（方案 A：收件箱列表）
   作用域限定 .msg-page，令牌全部取自 theme-xiaoyi.css 的黑白体系
   ========================================================================== */

.msg-page {
  --msg-card: #FFFFFF;
  --msg-soft: #F5F5F5;
  --msg-gap: var(--page-gap);
  display: flex;
  flex-direction: column;
  gap: var(--msg-gap);
  min-width: 0;
}

:root[data-theme="dark"] .msg-page {
  --msg-card: #161616;
  --msg-soft: #1E1E1E;
}

/* ---------- 页头 ---------- */
.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border: 0;
  border-radius: var(--r-card);
  background: var(--msg-card);
}
.msg-head__kicker {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.msg-head h1 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.msg-head__sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}
.msg-head__sub b {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 按钮（压过 .shell button { color: inherit }） ---------- */
.msg-page .msg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--msg-soft);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.msg-page .msg-btn:hover { background: var(--select-wash); }
.msg-page .msg-btn:disabled { opacity: .45; cursor: default; }
.msg-page .msg-btn--primary {
  background: var(--select-solid);
  color: var(--select-solid-ink);
}
.msg-page .msg-btn--primary:hover { background: var(--select-solid-hover); }
.msg-page .msg-btn .icon { width: 14px; height: 14px; }

/* ---------- 筛选工具条 ---------- */
.msg-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.msg-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: calc(var(--r-ctl) + 2px);
  background: var(--seg-bg);
}
.msg-page .msg-seg button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.msg-page .msg-seg button:hover { background: var(--seg-hover); color: var(--ink); }
.msg-page .msg-seg button[aria-pressed="true"] {
  background: var(--select-solid);
  color: var(--select-solid-ink);
  font-weight: 600;
}
.msg-page .msg-seg button[aria-pressed="true"]:hover {
  background: var(--select-solid);
  color: var(--select-solid-ink);
}

/* ---------- 列表 ---------- */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  border-radius: var(--r-card);
  background: var(--msg-card);
}
.msg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--r-card);
  cursor: pointer;
  transition: background-color .16s ease;
}
.msg-row:hover { background: var(--msg-soft); }
.msg-row__mark {
  flex: none;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--ink);
}
.msg-row.is-read .msg-row__mark { visibility: hidden; }
.msg-row__ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--r-micro, 6px);
  background: var(--msg-soft);
  color: var(--ink-2);
}
.msg-row__ico .icon { width: 16px; height: 16px; }
.msg-row__main { min-width: 0; flex: 1; }
.msg-row__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.msg-row__title b {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-row.is-read .msg-row__title b {
  color: var(--ink-2);
  font-weight: 500;
}
.msg-row__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.msg-row__sub {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-row.is-read .msg-row__sub { color: var(--ink-3); }
.msg-row__time {
  flex: none;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.msg-page .msg-row__del {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--r-micro, 6px);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease;
}
.msg-row:hover .msg-row__del,
.msg-page .msg-row__del:focus-visible { opacity: 1; }
.msg-page .msg-row__del:hover { background: var(--select-wash); color: var(--ink); }
.msg-row__del .icon { width: 14px; height: 14px; }

/* ---------- 分页 ---------- */
.msg-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--msg-card);
}
.msg-pager__info {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
}
.msg-pager__btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg-page .msg-pager__btns button {
  height: 28px;
  min-width: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-micro, 6px);
  background: var(--msg-soft);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
}
.msg-page .msg-pager__btns button:hover { background: var(--select-wash); color: var(--ink); }
.msg-page .msg-pager__btns button[aria-current="page"] {
  background: var(--select-solid);
  color: var(--select-solid-ink);
  font-weight: 600;
}
.msg-page .msg-pager__btns button:disabled { opacity: .45; cursor: default; }

/* ---------- 空态 / 加载 ---------- */
.msg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  text-align: center;
}
.msg-empty__ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-ctl);
  background: var(--msg-soft);
  color: var(--ink-2);
}
.msg-empty__ico .icon { width: 20px; height: 20px; }
.msg-empty h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}
.msg-empty p {
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.6;
}
.msg-empty .msg-btn { margin-top: 8px; }

.msg-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--ink-2);
  font-size: 12.5px;
}
.msg-loading__bar {
  width: 120px;
  height: 3px;
  border-radius: 999px;
  background: var(--msg-soft);
  overflow: hidden;
}
.msg-loading__bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--ink);
  animation: msgbar 1.1s infinite ease-in-out;
}
@keyframes msgbar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .msg-row { gap: 10px; padding: 12px; }
  .msg-row__ico { display: none; }
  .msg-page .msg-row__del { opacity: 1; }
  .msg-head h1 { font-size: 20px; }
  .msg-page .msg-seg button { padding: 0 10px; }
}

@media (max-width: 520px) {
  .msg-head { align-items: flex-start; }
  .msg-head .msg-btn { width: 100%; }
  .msg-tools { align-items: stretch; }
  .msg-seg { width: 100%; }
  .msg-page .msg-seg button { flex: 1; padding: 0 8px; }
  .msg-pager { flex-wrap: wrap; }
  .msg-row__time { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .msg-loading__bar::after { animation: none; }
  .msg-page .msg-row__del { transition: none; }
}