.wm {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--surface);
  overflow: hidden;
}

/* ---------------- 顶栏 ---------------- */
.wm-top {
  height: 54px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.wm-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15.5px; letter-spacing: .2px; color: var(--text); min-width: 186px; }

.wm-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  transition: border-color .15s, background .15s;
}
.wm-search:focus-within { border-color: var(--primary); background: #fff; }
.wm-search input { flex: 1; border: none; background: transparent; outline: none; font-size: 13.5px; color: var(--text); }

.wm-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.wm-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 4px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.wm-user:hover { background: var(--surface-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wm-email { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-drop {
  position: absolute;
  top: 40px;
  right: 0;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 50;
}
.wm-user.open .user-drop { display: flex; }
.user-drop a, .user-drop button {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}
.user-drop a:hover, .user-drop button:hover { background: var(--surface-2); }
.user-drop button { color: var(--danger); }

/* ---------------- 主体三栏 ---------------- */
.wm-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 210px 348px minmax(0, 1fr);
}

.wm-side {
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .28);
  margin: 0 4px 16px;
  transition: transform .12s, box-shadow .15s;
}
.compose-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(37, 99, 235, .34); }
.compose-btn:active { transform: translateY(0); }

.folders { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.folder {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
  user-select: none;
}
.folder:hover { background: #eaeef7; color: var(--text); }
.folder.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.folder.active svg { color: var(--primary); }
.folder svg { color: var(--text-3); flex: none; }
.folder .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.folder.active .count { color: var(--primary); }
.folder .count.unseen { color: var(--primary); font-weight: 700; }

.quota { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid var(--border); }
.quota-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; }
.quota-bar { height: 6px; border-radius: 4px; background: #dde3ed; overflow: hidden; }
.quota-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #2563eb, #60a5fa); transition: width .3s; }

/* ---------------- 列表 ---------------- */
.wm-list {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}
.list-head {
  flex: none;
  height: 50px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.list-title { display: flex; align-items: baseline; gap: 8px; }
.list-title h2 { margin: 0; font-size: 15px; font-weight: 600; }
.list-tools { display: flex; gap: 4px; }

.list-scroll { flex: 1; overflow-y: auto; min-height: 0; }

.msg {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 0 10px;
  padding: 11px 14px 11px 10px;
  border-bottom: 1px solid #eef1f6;
  cursor: pointer;
  position: relative;
}
.msg:hover { background: #f8fafd; }
.msg.unread { background: #fbfcff; }
.msg.unread::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary);
}
/* active 必须放在 unread 之后，否则会被未读底色覆盖 */
.msg.active { background: #dce9ff; }
.msg.active::before { background: var(--primary-dark); }

.msg-star {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #cbd3e0; cursor: pointer; border: none; background: none; padding: 0;
}
.msg-star:hover { background: rgba(37, 99, 235, .1); }
.msg-star.on { color: #f59e0b; }

.msg-main { min-width: 0; }
.msg-row1 { display: flex; align-items: baseline; gap: 8px; }
.msg-from {
  font-size: 13px; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%;
}
.msg.unread .msg-from { font-weight: 700; }
.msg-date { margin-left: auto; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.msg-subject {
  margin-top: 3px; font-size: 13px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg.unread .msg-subject { color: var(--text); font-weight: 600; }
.msg-snippet {
  margin-top: 3px; font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-badges { display: flex; align-items: center; gap: 4px; color: var(--text-3); }
.msg-badges svg { color: #94a3b8; }

.list-more {
  flex: none;
  height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--primary); cursor: pointer; background: var(--surface-2);
}
.list-more:hover { background: #eef2f9; }

/* ---------------- 阅读区 ---------------- */
.wm-read { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.read-toolbar {
  flex: none;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.read-toolbar .spacer { flex: 1; }

.read-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.read-head { padding: 20px 24px 14px; border-bottom: 1px solid #eef1f6; }
.read-subject { font-size: 19px; font-weight: 600; line-height: 1.4; margin: 0 0 14px; letter-spacing: -.2px; }
.read-meta { display: flex; align-items: flex-start; gap: 12px; }
.read-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: #e8f0fe; color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
}
.read-who { min-width: 0; flex: 1; }
.read-from { font-size: 13.5px; font-weight: 600; color: var(--text); }
.read-to { font-size: 12px; color: var(--text-3); margin-top: 2px; word-break: break-all; }
.read-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 24px; border-bottom: 1px solid #eef1f6; background: var(--surface-2); }
.attach {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 12.5px;
  max-width: 260px;
  text-decoration: none;
  color: var(--text);
}
.attach:hover { border-color: var(--primary); text-decoration: none; }
.attach .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .as { color: var(--text-3); font-size: 11.5px; flex: none; }

.read-content { padding: 20px 24px 40px; }
.read-content iframe { width: 100%; border: none; min-height: 420px; }
.read-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

/* ---------------- 写信 ---------------- */
.compose-grid { display: flex; flex-direction: column; gap: 10px; }
.compose-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.compose-row label { width: 52px; font-size: 13px; color: var(--text-2); flex: none; }
.compose-row input {
  flex: 1; border: none; outline: none; height: 30px; font-size: 13.5px; background: transparent;
}
.compose-row .cc-toggle { font-size: 12px; color: var(--primary); cursor: pointer; flex: none; }
.compose-body { min-height: 240px; border: none; outline: none; resize: vertical; font-size: 14px; line-height: 1.7; padding: 6px 2px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 6px; background: var(--primary-soft);
  font-size: 12px; color: var(--primary-dark);
}
.attach-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }

@media (max-width: 1180px) {
  .wm-body { grid-template-columns: 196px 320px minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .wm-body { grid-template-columns: 176px minmax(0, 1fr); }
  .wm-read { display: none; }
  .wm-body.reading .wm-read { display: flex; position: absolute; inset: 54px 0 0 0; z-index: 15; }
  .wm-body.reading .wm-list { display: none; }
  .wm-brand span { display: none; }
  .wm-brand { min-width: auto; }
}

/* ---------------- 入站认证徽章 ---------------- */
.auth-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.auth-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.auth-badge.pass { background: #dcfce7; color: #15803d; }
.auth-badge.fail { background: #fee2e2; color: #b91c1c; }
.auth-badge.none { background: #eef1f6; color: #5b6675; }
.auth-badge.warn { background: #fef3c7; color: #b45309; }

/* ---------------- 外部图片提示条 ---------------- */
.img-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 24px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 12.5px;
  color: #92400e;
}
.img-banner .btn { margin-left: auto; }
