html.mail-root { height:100%; overflow:hidden; }
body.mail-page {
  height: 100%; overflow: hidden;
  background: radial-gradient(1000px 480px at 8% -10%, rgba(37,99,235,.13), transparent 62%), #f3f6fb;
}
.mail-shell {
  width: min(1440px, calc(100% - 20px));
  height: calc(100vh - 54px);
  margin: 0 auto; padding: 8px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.mail-forbidden { margin: 70px auto; max-width: 460px; padding: 34px; text-align: center; color: #475569; }
.mail-forbidden .icon { width: 42px; height: 42px; color: #93c5fd; }
.mail-forbidden h2 { margin: 12px 0 5px; font-size: 20px; }
.mail-forbidden p { color: #94a3b8; font-size: 13px; }

/* 顶部紧凑工具条：去掉大 banner，按钮靠左 */
/* 顶部不再放邮件内容；标题/统计都在左侧栏 */
.mail-toolbar {
  display: none;
  padding: 0 12px; border-radius: 12px; background: rgba(255,255,255,.78);
  border: 1px solid rgba(148,163,184,.18); box-shadow: 0 3px 12px rgba(15,23,42,.05);
}
.mail-toolbar-actions { display: flex; align-items: center; gap: 5px; flex: none; }
.mail-toolbar-actions .btn { height: 30px; padding: 0 9px; font-size: 12px; }
.mail-compose-main { width:100%; min-height:38px; justify-content:center; color:#fff !important; background:linear-gradient(135deg,#2f86f6,#1f6fe5) !important; border-radius:9px; font-weight:700; box-shadow:0 6px 14px rgba(37,99,235,.2); }
.mail-compose-main:hover { background:linear-gradient(135deg,#3b90fa,#2476ec) !important; }
.mail-compose-main .icon { width:16px; height:16px; color:#fff; }
.mail-side-tools { display:flex; flex-wrap:wrap; gap:4px; margin:7px 0 5px; }
.mail-side-tools .btn { height:27px; padding:0 7px; font-size:10.5px; }
.mail-side-tools .mail-sync-limit { width:92px; height:27px; padding:0 4px; font-size:10.5px; }
.mail-side-summary { margin:6px 2px 4px; padding:7px 6px 8px; border-bottom:1px solid #e6edf8; }
.mail-side-summary h1 { margin:0 0 2px; font-size:17px; color:#16324f; }
.mail-summary-line { font-size:10.5px; color:#52708f; }
.mail-summary-meta { margin-top:1px; font-size:9.5px; color:#94a9bd; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mail-side .mail-readall { color:#1d4ed8; background:#eff6ff; font-size:10.5px; min-height:27px; margin-top:1px; }
.mail-side .mail-readall .icon { width:13px; height:13px; }
.mail-batch-move { width:112px; height:25px; font-size:10px; }
.mail-sync-limit { width: 88px; height: 30px; padding: 0 6px; font-size: 11.5px; }
.mail-toolbar-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mail-toolbar-title h1 { font-size: 19px; line-height: 1; margin: 0; color: #0f172a; }
.mail-toolbar-title span { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-toolbar-meta { margin-left: auto; display: flex; gap: 10px; flex: none; font-size: 10.5px; color: #94a3b8; }

.mail-layout {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 184px minmax(300px, 380px) minmax(0, 1fr);
  gap: 8px;
}
.mail-side {
  min-height: 0; overflow: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 2px; border-radius: 12px;
}
/* 宽屏阅读：收起邮箱栏 + 邮件列表，详情占满整行 */
.mail-layout.wide-reading { grid-template-columns: minmax(0, 1fr); }
.mail-layout.wide-reading .mail-side,
.mail-layout.wide-reading .mail-list-pane { display: none; }
.mail-side button {
  display: flex; align-items: center; gap: 7px; min-height: 31px; padding: 5px 8px;
  border: 0; border-radius: 7px; background: transparent; color: #475569;
  font: inherit; font-size: 12px; cursor: pointer; text-align: left; white-space: nowrap;
}
.mail-side button:hover { background: #eef4ff; }
.mail-side button.active { background: #e5efff; color: #1d4ed8; font-weight: 700; }
.mail-side button .icon { width: 14px; height: 14px; flex: none; }
.mail-side button em { margin-left: auto; font-style: normal; font-size: 10px; color: #64748b; background: #e2e8f0; border-radius: 999px; padding: 0 5px; line-height: 15px; }
.mail-side-sep { height: 1px; background: #e6edf8; margin: 5px 1px; }
.mail-side-title { padding: 3px 8px 2px; font-size: 9.5px; letter-spacing: 1px; color: #94a3b8; }
.mail-filter-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #3b82f6; }
.mail-filter-dot.unread { background: #f59e0b; }
.mail-filter-dot.read { background: #10b981; }
.mail-filter-dot.starred { width: 10px; height: 10px; background: transparent; color: #f59e0b; font-size: 10px; line-height: 10px; text-align: center; }
.mailbox-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.13); }
.mailbox-dot.all { background: linear-gradient(135deg,#3b82f6,#8b5cf6); }
.mailbox-dot.c-green { background:#10b981; box-shadow:0 0 0 2px rgba(16,185,129,.13); }
.mailbox-dot.c-orange { background:#f59e0b; box-shadow:0 0 0 2px rgba(245,158,11,.14); }
.mailbox-dot.c-red { background:#ef4444; box-shadow:0 0 0 2px rgba(239,68,68,.12); }
.mailbox-dot.c-purple { background:#8b5cf6; box-shadow:0 0 0 2px rgba(139,92,246,.13); }
.mailbox-dot.c-pink { background:#ec4899; box-shadow:0 0 0 2px rgba(236,72,153,.12); }
.mailbox-dot.c-gray { background:#94a3b8; box-shadow:0 0 0 2px rgba(148,163,184,.14); }
.mailbox-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mail-side .mailbox-manage { margin-top:4px; color:#2563eb; border:1px dashed #bfdbfe; justify-content:center; }
.mail-side .mailbox-manage:hover { background:#eff6ff; }

.mail-list-pane { display:flex; flex-direction:column; min-height:0; overflow:hidden; border-radius:12px; }
.mail-list-toolbar { flex:none; display:flex; gap:5px; align-items:center; padding:8px; border-bottom:1px solid #e9eff8; }
.mail-check-all { display:flex; align-items:center; padding:0 2px; }
.mail-search { display:flex; align-items:center; gap:5px; flex:1; min-width:0; padding:5px 8px; border:1px solid #e2e8f0; border-radius:7px; background:#fff; }
.mail-search .icon { width:13px; height:13px; color:#94a3b8; }
.mail-search input { border:0; outline:0; background:transparent; width:100%; min-width:0; font:inherit; font-size:12px; }
.mail-batchbar { flex:none; padding:6px 9px; background:#eff6ff; border-bottom:1px solid #dbeafe; font-size:10.5px; color:#1e40af; }
.mail-batch-head { display:flex; align-items:center; justify-content:space-between; gap:6px; }
.mail-batch-count { white-space:nowrap; font-weight:700; }
.mail-batch-clear { flex:none; border:0; background:transparent; color:#64748b; cursor:pointer; font-size:12px; padding:1px 3px; }
.mail-batch-actions { display:flex; flex-wrap:wrap; gap:4px; margin-top:5px; }
.mail-batch-actions .btn { flex:none; height:25px; padding:0 7px; font-size:10.5px; }
.mail-batch-move-row { display:flex; align-items:center; gap:5px; margin-top:5px; }
.mail-batch-move-row .mail-batch-move { flex:1; min-width:0; width:auto; height:25px; font-size:10.5px; }
.mail-batch-move-row .btn { flex:none; height:25px; }
.mail-list { flex:1; min-height:0; overflow:auto; padding:4px 6px; }
.mail-item { position:relative; display:flex; align-items:flex-start; gap:6px; width:100%; padding:8px 9px 8px 5px; border-radius:8px; cursor:pointer; }
.mail-item:hover { background:#f4f8ff; }
.mail-item.selected { background:#eaf2ff; box-shadow:inset 3px 0 0 #3b82f6; }
.mail-item-check { flex:none; padding-top:4px; }
.mail-item-content { display:flex; flex-direction:column; gap:1px; min-width:0; flex:1; }
.mail-item-top { display:flex; align-items:center; gap:6px; min-width:0; }
.mail-item-from { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11.5px; color:#64748b; }
.mail-item.unread .mail-item-from { color:#1e3a8a; font-weight:700; }
.mail-item-time { flex:none; font-size:9.5px; color:#94a3b8; }
.mail-item-subject { font-size:12.5px; color:#334155; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mail-item.unread .mail-item-subject { font-weight:700; color:#0f172a; }
.mail-item-snippet { font-size:10.5px; color:#94a3b8; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mail-item.unread::before { content:""; position:absolute; left:1px; top:13px; width:4px; height:4px; border-radius:50%; background:#3b82f6; }
.mail-attach-mark { position:absolute; right:7px; bottom:5px; font-size:8.5px; color:#64748b; }
.mail-star-mark { position:absolute; right:7px; top:7px; color:#f59e0b; font-size:11px; }
.mail-empty { padding:32px 12px; text-align:center; color:#94a3b8; font-size:11.5px; }
.mail-pager { flex:none; display:flex; justify-content:center; align-items:center; gap:9px; padding:5px; border-top:1px solid #e9eff8; font-size:10.5px; color:#64748b; }

.mail-detail-pane { min-width:0; min-height:0; display:flex; flex-direction:column; overflow:hidden; border-radius:12px; }
.mail-detail-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#94a3b8; gap:9px; font-size:12px; }
.mail-detail-empty .icon { width:36px; height:36px; color:#cbd5e1; }
.mail-detail-head { flex:none; padding:12px 14px 9px; border-bottom:1px solid #e9eff8; }
.mail-detail-subject { font-size:17px; font-weight:750; color:#0f172a; line-height:1.35; word-break:break-word; }
.mail-detail-meta { display:flex; gap:5px; flex-wrap:wrap; margin-top:5px; font-size:10.5px; color:#64748b; }
.mail-detail-meta .spacer { flex:1; }
.mail-wide-btn {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border: 1px solid #dbeafe; background: #f8fbff; color: #2563eb;
  font: inherit; font-size: 10px; padding: 2px 8px; border-radius: 999px; cursor: pointer;
}
.mail-wide-btn:hover { background: #eff6ff; border-color: #bfdbfe; }
.mail-wide-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.mail-wide-btn .icon { width: 12px; height: 12px; }
.mail-detail-to { margin-top:2px; font-size:10px; color:#94a3b8; word-break:break-all; }
.mail-detail-actions { display:flex; gap:5px; flex-wrap:wrap; margin-top:8px; }
.mail-detail-actions .btn {
  height:28px; padding:0 8px; font-size:10.5px;
  display:inline-flex; align-items:center; gap:4px;
  border:1px solid transparent; border-radius:7px; font-weight:600;
  box-shadow:none;
}
.mail-detail-actions .btn .icon { width:12px; height:12px; }
.mail-detail-actions .mail-act-read { color:#0f766e; background:#ecfdf5; border-color:#c7f0e7; }
.mail-detail-actions .mail-act-read:hover { background:#d9f9ef; }
.mail-detail-actions .mail-act-star { color:#b45309; background:#fffbeb; border-color:#fde68a; }
.mail-detail-actions .mail-act-star:hover, .mail-detail-actions .mail-act-star.on { background:#fef3c7; color:#92400e; }
.mail-detail-actions .mail-act-reply { color:#1d4ed8; background:#eff6ff; border-color:#c7ddff; }
.mail-detail-actions .mail-act-reply:hover { background:#dbeafe; }
.mail-detail-actions .mail-act-reminder { color:#7c3aed; background:#f5f3ff; border-color:#ddd6fe; }
.mail-detail-actions .mail-act-reminder:hover { background:#ede9fe; }
.mail-detail-actions .mail-act-calendar { color:#047857; background:#ecfdf5; border-color:#bbf7d0; }
.mail-detail-actions .mail-act-calendar:hover { background:#d1fae5; }
.mail-detail-actions .mail-act-bookmark { color:#c2410c; background:#fff7ed; border-color:#fed7aa; }
.mail-detail-actions .mail-act-bookmark:hover { background:#ffedd5; }
.mail-detail-actions .mail-act-ai { color:#6d28d9; background:linear-gradient(135deg,#f5f3ff,#eef2ff); border-color:#d8ccff; }
.mail-detail-actions .mail-act-ai:hover { background:linear-gradient(135deg,#ede9fe,#e0e7ff); }
.mail-detail-actions .mail-danger { color:#dc2626 !important; background:#fef2f2; border-color:#fecaca; }
.mail-detail-actions .mail-danger:hover { background:#fee2e2; }
.mail-danger { color:#dc2626 !important; }
.mail-attachments { flex:none; display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding:7px 14px; background:#f8fbff; border-bottom:1px solid #e9eff8; font-size:10.5px; }
.mail-attach-label { color:#64748b; }
.mail-attach-item { display:inline-flex; align-items:center; gap:2px; }
.mail-attach-name { background:#e8f0ff; color:#1e40af; border-radius:4px; padding:1px 6px; border:0; font:inherit; font-size:10.5px; cursor:pointer; }
.mail-attach-name:hover { background:#dbeafe; }
.mail-attach-dl { border:0; background:transparent; color:#2563eb; cursor:pointer; font-size:11px; padding:0 2px; }
.mail-batch-move { width:96px; height:25px; font-size:10px; }
.mail-insight { flex:none; margin:8px 14px 0; padding:10px 12px; background:#f6faff; border:1px solid #dbeafe; border-radius:8px; font-size:11px; color:#486581; }
.mail-insight-head { display:flex; align-items:center; gap:6px; color:#1e4f83; }
.mail-insight-head span { font-size:9px; color:#93a8bd; font-weight:400; }
.mail-insight-close { margin-left:auto; border:0; background:transparent; color:#94a3b8; cursor:pointer; }
.mail-insight p { margin:6px 0 0; line-height:1.65; color:#526d86; }
.mail-insight-actions { margin-top:7px; padding-top:7px; border-top:1px dashed #dbe7f7; line-height:1.65; }
.mail-insight-actions b { color:#1e4f83; }
.mail-insight-meta { margin-top:5px; color:#7f96ad; font-size:10px; }
.mail-html { flex:1; min-height:0; background:#fff; }
.mail-html-frame { display:block; width:100%; height:100%; border:0; }
.mail-body { flex:1; min-height:0; overflow:auto; margin:0; padding:14px; font-family:var(--font); font-size:12.5px; line-height:1.7; color:#334155; white-space:pre-wrap; word-break:break-word; }

.mail-compose { max-width:620px; }
.mail-compose-body { min-height:190px; resize:vertical; font-family:var(--font); line-height:1.6; }
.mail-mailbox-modal { max-width:860px; width:calc(100vw - 28px); display:flex; flex-direction:column; max-height:90vh; overflow:hidden; }
.mail-mailbox-modal .modal-head { flex:none; padding:12px 16px; font-size:14px; }
.mailbox-manager { flex:1; min-height:0; display:grid; grid-template-columns:170px minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
.mailbox-tabs { border-right:1px solid #e9eff8; padding:8px; overflow:auto; display:flex; flex-direction:column; gap:2px; background:#fbfdff; }
.mailbox-tabs button { display:flex; align-items:center; gap:6px; min-height:31px; padding:5px 7px; border:0; border-radius:6px; background:transparent; color:#475569; text-align:left; font:inherit; font-size:11.5px; cursor:pointer; }
.mailbox-tabs button span:nth-child(2) { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mailbox-tabs button:hover { background:#eff6ff; }
.mailbox-tabs button.active { background:#e5efff; color:#1d4ed8; font-weight:700; }
.mailbox-add { color:#2563eb !important; border:1px dashed #bfdbfe !important; justify-content:center; margin-top:4px; }
.mailbox-main { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
.mailbox-form { flex:1; min-height:0; padding:10px 14px; overflow:auto; }
.mailbox-presets { display:flex; align-items:center; gap:4px; margin-bottom:7px; flex-wrap:wrap; }
.mailbox-presets .muted { font-size:10.5px; }
.mailbox-section-title { margin:11px 0 5px; padding-top:8px; border-top:1px dashed #dbe7f7; font-size:11px; font-weight:700; color:#1e40af; }
.mail-form-two { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.mailbox-form .field { margin-bottom:6px; min-width:0; }
.mailbox-form select option { white-space:normal; }
.mailbox-form .field label { font-size:11px; margin-bottom:2px; }
.mailbox-form .input, .mailbox-form .select { height:31px; width:100%; min-width:0; font-size:12px; }
.mailbox-test { font-size:11px; color:#b45309; background:#fffbeb; border:1px solid #fde68a; border-radius:6px; padding:6px 8px; margin:6px 0; word-break:break-word; }
.mailbox-test.ok { color:#047857; background:#ecfdf5; border-color:#a7f3d0; }
.mailbox-actions { flex:none; display:flex; align-items:center; gap:5px; margin:0; padding:9px 14px; border-top:1px solid #e9eff8; background:#fbfdff; }
.mailbox-actions .spacer { flex:1; }

@media (max-width: 1050px) {
  .mail-layout { grid-template-columns: 164px minmax(260px, 330px) minmax(0,1fr); }
  .mail-toolbar-meta { display:none; }
}
@media (max-width: 820px) {
  html.mail-root { height:auto; overflow:auto; }
  body.mail-page { height:auto; overflow:auto; }
  .mail-shell { height:auto; min-height:calc(100vh - 54px); }
  .mail-layout { display:flex; flex-direction:column; min-height:0; }
  .mail-side { flex-direction:row; overflow-x:auto; }
  .mail-side button { flex:none; }
  .mail-side-sep, .mail-side-title, .mailbox-manage { display:none; }
  .mail-list-pane { min-height:360px; }
  .mail-detail-pane { min-height:430px; }
  .mail-toolbar { height:auto; min-height:46px; flex-wrap:wrap; padding:6px 9px; }
  .mail-toolbar-title { width:100%; order:3; }
}

/* 统一邮件页下拉高度，避免原生 select 的默认 padding 把文字裁掉 */
.mail-page select.select {
  height: 31px; min-height: 31px;
  padding: 0 26px 0 8px;
  line-height: 29px;
  box-sizing: border-box;
}
.mail-side-tools .mail-sync-limit { height: 27px; min-height: 27px; line-height: 25px; padding: 0 20px 0 5px; }
.mail-batch-move-row .mail-batch-move { height: 26px; min-height: 26px; line-height: 24px; padding: 0 22px 0 6px; }
.mailbox-form .select { height: 31px; min-height: 31px; line-height: 29px; }
.mail-compose select.select { height: 34px; min-height: 34px; line-height: 32px; }
