/* Webmail 独立布局，复用 app.css 的主题变量与基础控件。 */
.wm-login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px;
  background: radial-gradient(900px 480px at 15% 0%, var(--accent-soft), transparent 65%), var(--bg);
}
.wm-login-card {
  width: 100%; max-width: 420px; padding: 36px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.wm-login-brand { text-align: center; margin-bottom: 28px; }
.wm-login-logo, .wm-brand-icon {
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #2b7dff, #0b52d6);
}
.wm-login-logo { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 19px; box-shadow: 0 10px 26px rgba(22,104,255,.22); }
.wm-login-logo .icon { width: 30px; height: 30px; }
.wm-login h1 { margin: 0 0 8px; font-size: 25px; letter-spacing: -.02em; }
.wm-login-brand p, .wm-login-foot { margin: 0; color: var(--muted); font-size: 13px; }
.wm-login .input { min-height: 48px; font-size: 15px; }
.wm-login-btn { min-height: 48px; margin-top: 6px; font-size: 15px; }
.wm-login-foot { margin-top: 24px; text-align: center; }

.wm-shell {
  height: 100vh; height: 100dvh; display: grid;
  grid-template-columns: 220px 360px minmax(0, 1fr); overflow: hidden; background: var(--surface);
}
.wm-sidebar, .wm-list-pane, .wm-reader, .wm-reader-content { min-width: 0; min-height: 0; }
.wm-sidebar {
  display: flex; flex-direction: column; gap: 14px; padding: 18px 14px;
  background: var(--surface-2); border-right: 1px solid var(--line);
}
.wm-brand { display: flex; align-items: center; gap: 11px; padding: 0 5px; }
.wm-brand-icon { display: grid; width: 38px; height: 38px; border-radius: 12px; flex: none; }
.wm-brand-icon .icon { width: 21px; height: 21px; }
.wm-brand strong, .wm-brand > div > span { display: block; }
.wm-brand strong { font-size: 15px; }
.wm-brand div > span { color: var(--faint); font-size: 11px; margin-top: 1px; }
.wm-account { padding: 0 5px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-folders { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.wm-folder {
  width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; text-align: left;
}
.wm-folder:hover { background: var(--accent-soft); color: var(--text); }
.wm-folder.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.wm-folder span:not(.wm-unread) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-unread { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 10px; text-align: center; }
.wm-sidebar-foot { padding-top: 10px; border-top: 1px solid var(--line); }

.wm-list-pane { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); }
.wm-list-head { min-height: 79px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line); background: var(--surface); }
.wm-list-head h2 { margin: 0; font-size: 17px; }
.wm-list-head div > span { display: block; margin-top: 2px; color: var(--faint); font-size: 11px; }
.wm-messages { flex: 1; min-height: 0; overflow-y: auto; }
.wm-message {
  position: relative; width: 100%; display: block; padding: 15px 17px 15px 20px; border: 0;
  border-bottom: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; text-align: left;
}
.wm-message:hover { background: var(--surface-2); }
.wm-message.active { background: var(--accent-soft); }
.wm-message.unread::before { content: ""; position: absolute; left: 8px; top: 22px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.wm-message-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wm-message-sender { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.wm-message.unread .wm-message-sender, .wm-message.unread .wm-message-subject { font-weight: 700; }
.wm-message-date { flex: none; color: var(--faint); font-size: 10.5px; }
.wm-message-subject { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.wm-message-meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; color: var(--faint); font-size: 11px; }
.wm-message-meta .icon { width: 13px; height: 13px; }
.wm-list-state { min-height: 100%; display: grid; place-content: center; justify-items: center; padding: 32px 20px; color: var(--muted); text-align: center; }
.wm-list-state .icon { width: 30px; height: 30px; margin-bottom: 10px; color: var(--faint); }
.wm-list-state p { margin: 0; font-size: 13px; }
.wm-list-state .btn { margin-top: 14px; }
.wm-pager { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 13px; border-top: 1px solid var(--line); background: var(--surface); }
.wm-pager > span { color: var(--faint); font-size: 11px; }

.wm-reader { display: flex; flex-direction: column; background: var(--surface); }
.wm-reader-empty { flex: 1; display: grid; place-content: center; justify-items: center; padding: 30px; color: var(--muted); text-align: center; }
.wm-reader-empty > span { display: grid; place-items: center; width: 82px; height: 82px; margin-bottom: 20px; border-radius: 26px; background: var(--accent-soft); color: var(--accent); }
.wm-reader-empty .icon { width: 38px; height: 38px; }
.wm-reader-empty h2 { margin: 0 0 7px; color: var(--text); font-size: 20px; }
.wm-reader-empty p { margin: 0; font-size: 13px; }
.wm-reader-content { flex: 1; display: flex; flex-direction: column; }
.wm-reader-head { flex: none; padding: 22px 25px; border-bottom: 1px solid var(--line); }
.wm-subject-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.wm-subject-wrap { min-width: 0; }
.wm-subject-wrap h2 { margin: 0 0 14px; font-size: 21px; line-height: 1.35; overflow-wrap: anywhere; }
.wm-reader-actions { display: flex; flex: none; gap: 6px; }
.wm-meta { display: grid; gap: 5px; font-size: 12px; }
.wm-meta > div { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; }
.wm-meta > div > span:first-child { color: var(--faint); }
.wm-meta strong { font-weight: 600; }
.wm-meta > div > :last-child { min-width: 0; overflow-wrap: anywhere; }
.wm-mail-loading, .wm-mail-error, .wm-no-body { flex: 1; display: grid; place-content: center; justify-items: center; padding: 32px; color: var(--muted); text-align: center; }
.wm-mail-loading .icon { animation: spin 1s linear infinite; }
.wm-mail-loading p { margin: 10px 0 0; }
.wm-mail-error { color: var(--red); white-space: pre-line; }
.wm-mail-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.wm-html-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.wm-text-body { flex: 1; margin: 0; padding: 25px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font: 14px/1.75 inherit; color: var(--text); }
.wm-attachments { flex: none; max-height: 180px; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.wm-attachment { max-width: 100%; display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface-2); font-size: 12px; }
.wm-attachment:hover { border-color: var(--accent); color: var(--accent); }
.wm-attachment-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-attachment small { color: var(--faint); }
.wm-compose .modal-foot { align-items: center; }
.wm-compose-status { flex: 1; min-width: 0; color: var(--red); font-size: 12px; text-align: left; }
.wm-compose-body .textarea { min-height: 240px; }

@media (max-width: 1100px) {
  .wm-shell { grid-template-columns: 195px 320px minmax(0, 1fr); }
  .wm-reader-head { padding: 18px; }
  .wm-subject-row { flex-direction: column; gap: 14px; }
}
@media (max-width: 760px) {
  .wm-shell { display: block; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .wm-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .wm-folders { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .wm-folder { width: auto; flex: 0 0 auto; }
  .wm-sidebar-foot { padding-top: 0; border-top: 0; }
  .wm-list-pane { height: 450px; border-right: 0; border-bottom: 1px solid var(--line); }
  .wm-reader { min-height: 620px; }
  .wm-reader-content { min-height: 620px; }
  .wm-html-frame { min-height: 480px; }
  .wm-login-card { padding: 28px 22px; }
}
@media (max-width: 480px) {
  .wm-list-pane { height: 410px; }
  .wm-pager { align-items: flex-start; flex-direction: column; }
  .wm-pager .row { width: 100%; }
  .wm-pager .btn { flex: 1; }
  .wm-subject-wrap h2 { font-size: 18px; }
  .wm-reader-actions { flex-wrap: wrap; }
  .wm-text-body { padding: 18px; }
  .wm-attachments { padding: 12px 16px; }
  .wm-attachment-name { max-width: 190px; }
  .wm-compose-status { flex-basis: 100%; }
}
