/* ===================== 企业邮箱统一监控看板 ===================== */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cdd5df;
  --text: #1c2434;
  --text-2: #5a6a85;
  --text-3: #8b98ad;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }

/* ===================== 侧边栏 ===================== */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 30;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 24px; }
.brand-text strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand-text small { color: var(--text-3); font-size: 11px; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer;
  text-align: left; font-size: 14px; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 11px; text-align: center; font-weight: 600;
}
.nav-badge.danger { background: var(--danger); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.conn-state { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); }
.conn-state .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none;
}
.conn-state.online .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(5,150,105,.15); }
.conn-state.offline .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.btn-notify {
  width: 100%; padding: 7px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2); font-size: 12px; cursor: pointer;
}
.btn-notify:hover { border-color: var(--primary); color: var(--primary); }
.btn-notify.granted { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }

/* ===================== 主区域 ===================== */
.main { margin-left: var(--sidebar-w); min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.stats { display: flex; gap: 22px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: var(--text-3); letter-spacing: .3px; }
.stat-value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-value.muted { color: var(--text-3); }
.stat-value.danger { color: var(--danger); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.user-menu { display: flex; align-items: center; gap: 8px; padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--border); }
.user-menu .user-name { font-weight: 500; color: var(--text); font-size: 13px; }
.user-menu .user-role { font-size: 11px; color: var(--text-2); background: rgba(0,0,0,.06); padding: 2px 8px; border-radius: 999px; }
.last-update { font-size: 12px; color: var(--text-3); }
.last-update b { color: var(--text-2); font-variant-numeric: tabular-nums; }

.view { display: none; padding: 20px 24px 60px; flex: 1; }
.view.active { display: block; }

/* ===================== 通用控件 ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  font-size: 13px; transition: all .15s;
}
.btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: var(--danger); border-color: #f3c9c9; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.input {
  padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
  max-width: 100%;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input-sm { padding: 4px 8px; font-size: 12px; }
textarea.input { width: 100%; resize: vertical; min-height: 140px; line-height: 1.5; }
select.input { cursor: pointer; }

/* 输入控件后置按钮（密码显隐 / 自动推导） */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { width: 100%; padding-right: 38px; }
.affix-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 28px; border: none; background: transparent; cursor: pointer;
  font-size: 15px; line-height: 1; color: var(--text-3); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.affix-btn:hover { background: rgba(0,0,0,.06); color: var(--text-1); }
.affix-btn.ghost { font-size: 17px; }

.flex-spacer { flex: 1; }
.hint { font-size: 12px; color: var(--text-3); }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }

.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.panel-head h2 { margin: 0; font-size: 18px; font-weight: 650; }
.panel-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-sub {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 26px 0 12px;
}
.panel-sub h3 { margin: 0; font-size: 15px; font-weight: 620; }
.panel-sub .panel-actions { margin-left: auto; }

.board-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.board-toolbar .input { min-width: 180px; }

/* ===================== 告警卡片 ===================== */
.alert-zone { display: grid; gap: 10px; margin-bottom: 16px; }
.alert-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius); border-left: 4px solid;
  box-shadow: var(--shadow); animation: slideDown .3s ease;
}
.alert-card.smtp { background: var(--danger-soft); border-color: var(--danger); }
.alert-card.imap { background: var(--warn-soft); border-color: var(--warn); }
.alert-icon { font-size: 18px; line-height: 1.3; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 620; font-size: 14px; }
.alert-card.smtp .alert-title { color: #991b1b; }
.alert-card.imap .alert-title { color: #92400e; }
.alert-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; word-break: break-word; }
.alert-time { font-size: 11.5px; color: var(--text-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.alert-close {
  border: 0; background: transparent; color: var(--text-3); font-size: 20px;
  cursor: pointer; line-height: 1; padding: 0 2px;
}
.alert-close:hover { color: var(--text); }
.alert-summary {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-2);
}

/* ===================== 瀑布流 ===================== */
.new-pill {
  position: sticky; top: 66px; z-index: 15; margin: 0 auto 12px; width: fit-content;
  padding: 6px 16px; border-radius: 20px; background: var(--primary); color: #fff;
  font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow-lg);
  animation: slideDown .3s ease;
}
.new-pill:hover { background: var(--primary-dark); }

.timeline { display: grid; gap: 12px; max-width: 1000px; }

.mail-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.mail-card:hover { border-color: var(--border-strong); }
.mail-card.is-new { animation: flashIn .6s ease; border-color: var(--primary); }
.mail-card.expanded { border-color: var(--primary); box-shadow: 0 4px 16px rgba(37,99,235,.10); }
.mail-card.health { opacity: .72; }

.mail-head { padding: 13px 16px; cursor: pointer; }
.mail-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-3); margin-bottom: 6px;
}
.mail-time { font-variant-numeric: tabular-nums; }
.mail-box {
  padding: 1px 8px; border-radius: 4px; background: var(--primary-soft);
  color: var(--primary); font-weight: 500; max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-tag {
  padding: 1px 7px; border-radius: 4px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-3); font-size: 11px;
}
.mail-subject {
  font-weight: 650; font-size: 15px; color: var(--text);
  word-break: break-word; margin-bottom: 4px;
}
.mail-from { font-size: 12.5px; color: var(--text-2); word-break: break-all; }
.mail-from b { color: var(--text); font-weight: 550; }
.mail-snippet {
  font-size: 13px; color: var(--text-2); margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.mail-attach-flag { color: var(--warn); font-size: 12px; }

.mail-body { border-top: 1px solid var(--border); padding: 16px; background: var(--surface-2); }
.mail-body-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; max-height: 620px; overflow: auto; word-break: break-word;
}
.mail-body-inner img { max-width: 100%; height: auto; }
.mail-body-inner table { max-width: 100%; border-collapse: collapse; }
.mail-body-inner pre { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; }
.mail-body-plain { white-space: pre-wrap; font-size: 13.5px; color: var(--text); }

/* 操作链接区块（验证/退订等）：提取后清晰展示，方便在对应 VPS 上手动验证 */
.mail-links {
  margin-top: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-2) 60%, #fff);
}
.mail-links-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.link-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 0; border-top: 1px solid var(--border);
}
.link-row:first-of-type { border-top: none; }
.link-badge {
  font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 650; flex: none;
}
.link-badge.verify { background: #dafbe1; color: #1a7f37; border: 1px solid #aae9b9; }
.link-badge.unsub { background: #fff1e6; color: #bc4c00; border: 1px solid #ffd8a8; }
.link-text {
  font-weight: 600; color: var(--text);
  flex: 1 1 200px; min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12px;
}
.link-row.is-verify {
  background: #f0fdf4; border: 1px solid #aae9b9; border-radius: var(--radius-sm);
  padding: 9px 10px; margin: 6px 0; font-weight: 600;
}
.link-row.is-verify .link-text { color: #1a7f37; font-size: 12.5px; }
.mail-links-empty { font-size: 12px; color: var(--text-3); padding: 4px 0; }
.mail-links-secondary { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; }
.mail-links-secondary summary {
  cursor: pointer; font-size: 12px; color: var(--text-2); font-weight: 600; user-select: none;
}
.mail-links-secondary .link-row { opacity: 0.92; }
.btn-xs { font-size: 12px; padding: 2px 9px; line-height: 1.6; flex: none; }

.attach-list { margin-top: 12px; display: grid; gap: 6px; }
.attach-title { font-size: 12px; color: var(--text-3); }
.attach-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.loader { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--text-3); font-size: 13px; }
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--border-strong);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
}
.end-hint { text-align: center; padding: 22px; color: var(--text-3); font-size: 12.5px; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-icon { font-size: 44px; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ===================== 表格 ===================== */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px;
  color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .col-check { width: 38px; }
.table .col-num { text-align: right; }
.table td.col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-ops { width: 190px; }
.cell-mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.cell-sub { font-size: 11.5px; color: var(--text-3); }
.row-ops { display: flex; gap: 5px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
}
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-paused { background: #f1f5f9; color: var(--text-3); }
.badge-probe { background: #f5f3ff; color: #7c3aed; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.dot-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-healthy { background: var(--ok); }
.dot-smtp_error { background: var(--danger); }
.dot-imap_error { background: var(--warn); }
.dot-unknown, .dot-pending { background: var(--border-strong); }

/* ===================== 健康面板 ===================== */
.health-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.hs-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.hs-card .hs-label { font-size: 12px; color: var(--text-3); }
.hs-card .hs-value { font-size: 26px; font-weight: 680; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hs-card.ok .hs-value { color: var(--ok); }
.hs-card.danger .hs-value { color: var(--danger); }
.hs-card.warn .hs-value { color: var(--warn); }

.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 10px; }
.hg-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.hg-item .hg-text { flex: 1; min-width: 0; }
.hg-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hg-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================== 设置 ===================== */
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-width: 900px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field.required > span::after { content: " *"; color: var(--danger); }
.field small { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.field-row { display: flex; gap: 12px; align-items: flex-end; }
.field-row .field { flex: 1; }
.check-box {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text-2); cursor: pointer; padding-bottom: 7px;
}
.check-box span small { display: block; font-size: 11px; color: var(--text-3); }
.probe-box {
  margin-top: 14px; padding: 11px 13px; background: #f5f3ff;
  border: 1px solid #e9e2ff; border-radius: var(--radius-sm); align-items: flex-start;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===================== 弹窗 ===================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(16,24,40,.42);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .18s ease;
}
/* 关键：hidden 必须真正隐藏，否则遮罩会一直拦截点击并覆盖其它弹窗（截图 bug 根因） */
[hidden] { display: none !important; }
.modal-mask[hidden] { display: none !important; }
.modal {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 680px; max-height: 90vh; display: flex; flex-direction: column;
  animation: popIn .2s ease;
}
.modal-sm { max-width: 460px; }
.modal-head {
  display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 620; }
.modal-close {
  margin-left: auto; border: 0; background: transparent; font-size: 24px;
  line-height: 1; color: var(--text-3); cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.import-stat { display: flex; gap: 18px; margin-bottom: 12px; }
.import-stat div { text-align: center; }
.import-stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.import-errors {
  max-height: 220px; overflow: auto; background: var(--danger-soft);
  border: 1px solid #f6d5d5; border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; color: #991b1b;
}
.import-errors div { padding: 2px 0; }

/* ===================== Toast & Sticky ===================== */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 10px; max-width: 380px;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 14px;
  animation: slideInRight .25s ease; cursor: pointer;
}
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast-title { font-weight: 620; font-size: 13px; margin-bottom: 3px; }
.toast-msg { font-size: 12.5px; color: var(--text-2); word-break: break-word; }
.toast-msg b { color: var(--text); }
.toast.leaving { animation: slideOutRight .2s ease forwards; }

.sticky-alert {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; z-index: 90;
  background: var(--danger); color: #fff; padding: 9px 20px;
  display: flex; align-items: center; gap: 12px; font-size: 13px;
  box-shadow: 0 2px 10px rgba(220,38,38,.3); animation: slideDown .25s ease;
}
.sticky-alert b { font-weight: 650; }
.sticky-alert button {
  margin-left: auto; border: 1px solid rgba(255,255,255,.5); background: transparent;
  color: #fff; padding: 3px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.sticky-alert button:hover { background: rgba(255,255,255,.15); }

/* ===================== 动画 ===================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slideOutRight { to { opacity: 0; transform: translateX(28px); } }
@keyframes flashIn {
  0% { opacity: 0; transform: translateY(-12px); background: var(--primary-soft); }
  60% { background: var(--primary-soft); }
  100% { opacity: 1; transform: none; background: var(--surface); }
}

/* ===================== 响应式 ===================== */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: static; width: 100%; flex-direction: row; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 8px;
  }
  .brand { border: 0; padding: 12px; flex: none; }
  .brand-text { display: none; }
  .nav { flex-direction: row; padding: 8px 4px; flex: none; }
  .nav-item { white-space: nowrap; padding: 7px 10px; }
  .nav-item span:not(.nav-icon):not(.nav-badge) { display: none; }
  .sidebar-foot { border: 0; padding: 8px; margin-left: auto; flex: none; }
  .btn-notify { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 10px 14px; }
  .stats { gap: 14px; }
  .stat-value { font-size: 16px; }
  .view { padding: 14px; }
  .sticky-alert { left: 0; }
  .table .col-ops { width: auto; }
}


/* ---- Phase 2: 已读/未读 ---- */
.mail-card.unread { border-left: 3px solid var(--primary); }

/* 未读徽标（2026-08-15 增强） */
.mail-unread-badge {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: 1px;
}
.mail-card.unread .mail-subject { font-weight: 700; }
.mail-card:not(.unread) .mail-subject { color: #8a8f98; font-weight: 400; }
.mail-card:not(.unread) .mail-from,
.mail-card:not(.unread) .mail-snippet { color: #a6abb3; }


/* ---- Phase 2: 链接安全隔离 ---- */
.mail-link-disabled {
  color: var(--text-3); text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
  cursor: default; pointer-events: none;
}

/* ---- Phase 2: 状态 Badge ---- */
.badge-sent { background: var(--ok-soft); color: var(--ok); border: 1px solid #b7eb8f; }
.badge-failed { background: var(--danger-soft); color: var(--danger); border: 1px solid #ffccc7; }
.badge-pending { background: var(--warn-soft); color: var(--warn); border: 1px solid #ffe58f; }


/* ---- 2026-08-15: 邮件翻译 ---- */
.mail-translate { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-strong); }
.btn-translate { cursor: pointer; }
.mail-translate-result { margin-top: 10px; }
.mail-translate-title {
  font-size: 12px; font-weight: 600; color: var(--primary);
  margin-bottom: 6px; letter-spacing: 0.5px;
}
.mail-translate-body {
  background: var(--bg-soft, #f6f8fa);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px; line-height: 1.7;
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-word;
}
