/* 邮件中心 2026-11-27
 * 独立接管 /admin/email-marketing，类名统一 emx- 前缀，避免和 Element / 旧邮件增强层冲突。
 */

#emx-root,
#emx-root * { box-sizing: border-box; }

body.emx-active { overflow: hidden !important; }
body.emx-active .admin-layout main,
body.emx-active .admin-layout .el-main { overflow: hidden !important; }
body.emx-active .admin-layout main > *,
body.emx-active .admin-layout .el-main > * { visibility: hidden !important; }

#emx-root {
  --emx-ink: #14212b;
  --emx-ink-2: #43525f;
  --emx-muted: #7b8b98;
  --emx-line: #e1e8ef;
  --emx-line-strong: #cbd7e2;
  --emx-surface: #ffffff;
  --emx-surface-2: #f7fafc;
  --emx-bg: #eef3f8;
  --emx-navy: #092338;
  --emx-navy-2: #0d304b;
  --emx-primary: #0b6584;
  --emx-primary-2: #0e7c9d;
  --emx-primary-soft: #e7f3f7;
  --emx-gold: #c08b3e;
  --emx-green: #12805c;
  --emx-green-soft: #e6f5ef;
  --emx-red: #bf3d32;
  --emx-red-soft: #fbecea;
  --emx-amber: #a96a16;
  --emx-amber-soft: #fbf0dd;
  --emx-shadow: 0 8px 26px rgba(12, 42, 64, 0.07);
  --emx-shadow-lg: 0 24px 70px rgba(8, 30, 48, 0.22);
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--emx-bg);
  color: var(--emx-ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

#emx-root.emx-dark {
  --emx-ink: #edf3f8;
  --emx-ink-2: #c6d4df;
  --emx-muted: #91a3b3;
  --emx-line: #283848;
  --emx-line-strong: #385064;
  --emx-surface: #121d28;
  --emx-surface-2: #172531;
  --emx-bg: #0a141d;
  --emx-navy: #061522;
  --emx-navy-2: #0a2436;
  --emx-primary: #2b93b3;
  --emx-primary-2: #3aa6c6;
  --emx-primary-soft: #122d3a;
  --emx-gold: #d6ad68;
  --emx-green: #3bcb96;
  --emx-green-soft: #102d26;
  --emx-red: #ff7a6d;
  --emx-red-soft: #321b1b;
  --emx-amber: #e4b35c;
  --emx-amber-soft: #2f2515;
  --emx-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
  --emx-shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* ── 顶部栏 ── */
.emx-top {
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px 0 24px;
  background: var(--emx-surface);
  border-bottom: 1px solid var(--emx-line);
  position: relative;
  z-index: 5;
}

.emx-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.emx-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 80% 10%, rgba(255,255,255,.22), transparent 38%),
    linear-gradient(135deg, #0b6584, #092338);
  box-shadow: 0 8px 18px rgba(11, 101, 132, .24);
}

.emx-logo svg { width: 19px; height: 19px; stroke-width: 1.8; }

.emx-brand-text { line-height: 1.15; }
.emx-brand-text strong {
  display: block;
  font-size: 16px;
  letter-spacing: .02em;
}
.emx-brand-text span {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  letter-spacing: .19em;
  color: var(--emx-muted);
  font-weight: 600;
}

.emx-top-sep { width: 1px; height: 28px; background: var(--emx-line); }

.emx-top-context {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.emx-top-context strong { font-size: 12px; font-weight: 600; }
.emx-top-context span { font-size: 11px; color: var(--emx-muted); }

.emx-top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}

.emx-health-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--emx-green-soft);
  color: var(--emx-green);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.emx-health-pill.is-warn { background: var(--emx-amber-soft); color: var(--emx-amber); }
.emx-health-pill.is-bad { background: var(--emx-red-soft); color: var(--emx-red); }
.emx-health-pill i {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
}

.emx-icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--emx-line);
  border-radius: 9px;
  background: var(--emx-surface);
  color: var(--emx-ink-2);
  cursor: pointer;
  transition: .18s ease;
}
.emx-icon-btn:hover { border-color: var(--emx-line-strong); color: var(--emx-primary); background: var(--emx-surface-2); }
.emx-icon-btn svg { width: 16px; height: 16px; }

.emx-back {
  height: 34px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--emx-line);
  border-radius: 9px;
  color: var(--emx-ink-2);
  background: var(--emx-surface);
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
  transition: .18s ease;
}
.emx-back:hover { color: var(--emx-primary); border-color: var(--emx-line-strong); }
.emx-back svg { width: 14px; height: 14px; }

/* ── 主体布局 ── */
.emx-shell {
  flex: 1;
  min-height: 0;
  display: flex;
}

.emx-nav {
  flex: 0 0 218px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  color: #dbe8f1;
  background:
    radial-gradient(360px 200px at 10% 0%, rgba(30, 134, 160, .24), transparent 70%),
    linear-gradient(180deg, var(--emx-navy-2), var(--emx-navy));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.emx-nav::-webkit-scrollbar { width: 5px; }
.emx-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }

.emx-nav-label {
  padding: 0 8px 9px;
  font-size: 9.5px;
  letter-spacing: .16em;
  color: rgba(219, 232, 241, .48);
  font-weight: 700;
}

.emx-nav-item {
  width: 100%;
  height: 43px;
  margin-bottom: 5px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #c9dce9;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: .18s ease;
}
.emx-nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .88; }
.emx-nav-item span { flex: 1; }
.emx-nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.emx-nav-item.is-active {
  background: linear-gradient(90deg, rgba(40, 151, 178, .28), rgba(40, 151, 178, .08));
  color: #fff;
  box-shadow: inset 3px 0 0 #45b0cb;
}
.emx-nav-item.is-active svg { opacity: 1; color: #82d4e6; }
.emx-nav-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #eaf6fb;
  font-size: 10.5px;
  font-weight: 700;
}
.emx-nav-item.is-active .emx-nav-badge { background: rgba(255,255,255,.2); }
.emx-nav-badge.is-live {
  background: rgba(45, 190, 145, .25);
  color: #78e2bd;
}

.emx-nav-foot {
  margin-top: auto;
  padding: 14px 0 0;
}

.emx-nav-mailbox {
  padding: 13px 12px;
  border-radius: 11px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
}
.emx-nav-mailbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.emx-nav-mailbox-head strong { font-size: 11.5px; font-weight: 600; color: #e4f0f7; }
.emx-nav-mailbox-head i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #49ca9a;
}
.emx-nav-mailbox p {
  margin: 6px 0 9px;
  font-size: 10.5px;
  line-height: 1.55;
  color: rgba(219,232,241,.62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emx-nav-mini-bar {
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}
.emx-nav-mini-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2a9fbe, #6ed3df);
}
.emx-nav-mini-meta {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(219,232,241,.55);
}

.emx-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 25px 30px 42px;
  scrollbar-width: thin;
  scrollbar-color: var(--emx-line-strong) transparent;
}
.emx-main::-webkit-scrollbar { width: 8px; }
.emx-main::-webkit-scrollbar-thumb { background: var(--emx-line-strong); border-radius: 99px; }
.emx-main::-webkit-scrollbar-track { background: transparent; }

/* ── 页头 ── */
.emx-page-head {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 22px;
}
.emx-page-head-copy { flex: 1; min-width: 0; }
.emx-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--emx-primary);
  font-size: 10px;
  letter-spacing: .13em;
  font-weight: 700;
}
.emx-eyebrow::before {
  content: "";
  width: 18px; height: 2px;
  border-radius: 99px;
  background: currentColor;
  opacity: .7;
}
.emx-page-head h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.22;
  letter-spacing: -.025em;
  font-weight: 700;
  color: var(--emx-ink);
}
.emx-page-head p {
  margin: 7px 0 0;
  max-width: 760px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--emx-muted);
}
.emx-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
}

/* ── 通用按钮 ── */
.emx-btn {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--emx-line-strong);
  border-radius: 9px;
  background: var(--emx-surface);
  color: var(--emx-ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: .18s ease;
}
.emx-btn svg { width: 15px; height: 15px; }
.emx-btn:hover { border-color: var(--emx-primary); color: var(--emx-primary); background: var(--emx-surface-2); }
.emx-btn:active { transform: translateY(1px); }
.emx-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.emx-btn.primary {
  border-color: var(--emx-primary);
  background: linear-gradient(135deg, var(--emx-primary), var(--emx-primary-2));
  color: #fff;
  box-shadow: 0 7px 16px color-mix(in srgb, var(--emx-primary) 24%, transparent);
}
.emx-btn.primary:hover { color: #fff; filter: brightness(1.05); }
.emx-btn.danger { border-color: color-mix(in srgb, var(--emx-red) 35%, var(--emx-line)); color: var(--emx-red); }
.emx-btn.danger:hover { background: var(--emx-red-soft); border-color: var(--emx-red); color: var(--emx-red); }
.emx-btn.ghost { border-color: transparent; background: transparent; }
.emx-btn.ghost:hover { border-color: var(--emx-line); background: var(--emx-surface-2); }
.emx-btn.sm { height: 29px; padding: 0 10px; font-size: 11.5px; border-radius: 7px; }
.emx-btn.sm svg { width: 13px; height: 13px; }
.emx-btn.xs { height: 25px; padding: 0 8px; font-size: 11px; border-radius: 6px; gap: 5px; }
.emx-btn.xs svg { width: 11px; height: 11px; }
.emx-btn.icon { width: 30px; padding: 0; }
.emx-btn.is-loading { pointer-events: none; opacity: .65; }
.emx-btn.is-loading svg { animation: emx-spin 1s linear infinite; }

@keyframes emx-spin { to { transform: rotate(360deg); } }

/* ── 卡片 / 面板 ── */
.emx-card {
  background: var(--emx-surface);
  border: 1px solid var(--emx-line);
  border-radius: 14px;
  box-shadow: var(--emx-shadow);
}
.emx-card-pad { padding: 19px 20px; }
.emx-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.emx-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.emx-section-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.emx-section-title svg { width: 16px; height: 16px; color: var(--emx-primary); }
.emx-section-desc {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--emx-muted);
}
.emx-section-actions { margin-left: auto; display: flex; gap: 7px; }

/* ── KPI ── */
.emx-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 14px;
}
.emx-kpi {
  position: relative;
  overflow: hidden;
  padding: 17px 18px 15px;
  min-height: 126px;
  background: var(--emx-surface);
  border: 1px solid var(--emx-line);
  border-radius: 14px;
  box-shadow: var(--emx-shadow);
}
.emx-kpi::after {
  content: "";
  position: absolute;
  width: 110px; height: 110px;
  right: -38px; top: -52px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--emx-primary) 10%, transparent), transparent 68%);
}
.emx-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.emx-kpi-label {
  font-size: 11px;
  color: var(--emx-muted);
  letter-spacing: .03em;
  font-weight: 550;
}
.emx-kpi-icon {
  width: 29px; height: 29px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--emx-primary);
  background: var(--emx-primary-soft);
}
.emx-kpi-icon svg { width: 15px; height: 15px; }
.emx-kpi-value {
  margin-top: 13px;
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 35px;
  line-height: 1;
  letter-spacing: -.045em;
  font-weight: 700;
  color: var(--emx-ink);
  font-variant-numeric: tabular-nums;
}
.emx-kpi-value small { font-size: 13px; letter-spacing: 0; font-weight: 500; color: var(--emx-muted); }
.emx-kpi-meta {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--emx-muted);
}
.emx-kpi-meta b { color: var(--emx-ink-2); font-weight: 600; }
.emx-kpi-meta .good { color: var(--emx-green); }
.emx-kpi-meta .warn { color: var(--emx-amber); }

/* ── 今日条 ── */
.emx-today {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr)) auto;
  align-items: center;
  gap: 0;
  margin-bottom: 14px;
  overflow: hidden;
}
.emx-today-item {
  padding: 13px 18px;
  border-right: 1px solid var(--emx-line);
}
.emx-today-item:last-of-type { border-right: 0; }
.emx-today-item span {
  display: block;
  font-size: 10.5px;
  color: var(--emx-muted);
}
.emx-today-item strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.emx-today-note {
  padding: 0 17px;
  font-size: 11px;
  color: var(--emx-muted);
  white-space: nowrap;
}
.emx-today-note b { color: var(--emx-primary); font-weight: 600; }

/* ── 网格 ── */
.emx-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
  gap: 14px;
  align-items: start;
}
.emx-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}

/* ── 进度条 ── */
.emx-bar {
  height: 7px;
  border-radius: 99px;
  background: var(--emx-surface-2);
  border: 1px solid var(--emx-line);
  overflow: hidden;
}
.emx-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--emx-primary), var(--emx-primary-2));
  transition: width .3s ease;
}
.emx-bar.green > span { background: linear-gradient(90deg, var(--emx-green), #3bbd91); }
.emx-bar.red > span { background: linear-gradient(90deg, var(--emx-red), #e3685d); }
.emx-bar.amber > span { background: linear-gradient(90deg, var(--emx-amber), #ddb063); }
.emx-bar.lg { height: 10px; }
.emx-bar-meta {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: var(--emx-muted);
  font-variant-numeric: tabular-nums;
}

/* ── 表格 ── */
.emx-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--emx-line);
  border-radius: 12px;
  background: var(--emx-surface);
}
.emx-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.emx-table thead th {
  height: 36px;
  padding: 0 12px;
  background: var(--emx-surface-2);
  border-bottom: 1px solid var(--emx-line);
  color: var(--emx-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .03em;
  text-align: left;
  white-space: nowrap;
}
.emx-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--emx-line);
  font-size: 12px;
  color: var(--emx-ink-2);
  vertical-align: middle;
}
.emx-table tbody tr:last-child td { border-bottom: 0; }
.emx-table tbody tr { transition: background .16s ease; }
.emx-table tbody tr:hover { background: color-mix(in srgb, var(--emx-primary) 4%, var(--emx-surface)); }
.emx-table .is-primary { color: var(--emx-ink); font-weight: 600; }
.emx-table .is-mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 11.5px; }
.emx-table .is-muted { color: var(--emx-muted); font-size: 11px; }
/* 横向滚动时保留首列与操作列，避免窄屏看不到按钮 */
.emx-table thead th:first-child,
.emx-table tbody td:first-child { position: sticky; left: 0; z-index: 2; background: var(--emx-surface); }
.emx-table thead th:first-child { background: var(--emx-surface-2); }
.emx-table thead th:last-child,
.emx-table tbody td:last-child { position: sticky; right: 0; z-index: 2; background: var(--emx-surface); box-shadow: -9px 0 12px rgba(15, 30, 45, .05); }
.emx-table thead th:last-child { background: var(--emx-surface-2); }
.emx-table tbody tr:hover td:first-child,
.emx-table tbody tr:hover td:last-child { background: color-mix(in srgb, var(--emx-primary) 4%, var(--emx-surface)); }

.emx-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

/* ── 状态标签 ── */
.emx-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--emx-surface-2);
  border: 1px solid var(--emx-line);
  color: var(--emx-ink-2);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.emx-tag::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.emx-tag.green { background: var(--emx-green-soft); border-color: color-mix(in srgb, var(--emx-green) 22%, var(--emx-line)); color: var(--emx-green); }
.emx-tag.blue { background: var(--emx-primary-soft); border-color: color-mix(in srgb, var(--emx-primary) 22%, var(--emx-line)); color: var(--emx-primary); }
.emx-tag.amber { background: var(--emx-amber-soft); border-color: color-mix(in srgb, var(--emx-amber) 22%, var(--emx-line)); color: var(--emx-amber); }
.emx-tag.red { background: var(--emx-red-soft); border-color: color-mix(in srgb, var(--emx-red) 22%, var(--emx-line)); color: var(--emx-red); }
.emx-tag.gray { color: var(--emx-muted); }
.emx-tag.no-dot::before { display: none; }

/* ── 空状态 ── */
.emx-empty {
  padding: 44px 20px;
  text-align: center;
}
.emx-empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--emx-primary-soft);
  color: var(--emx-primary);
}
.emx-empty-icon svg { width: 24px; height: 24px; }
.emx-empty h3 { margin: 0; font-size: 14px; font-weight: 600; }
.emx-empty p { margin: 6px auto 15px; max-width: 430px; font-size: 11.5px; line-height: 1.65; color: var(--emx-muted); }

/* ── 工具条 / 过滤 ── */
.emx-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.emx-search {
  position: relative;
  flex: 0 1 290px;
  min-width: 190px;
}
.emx-search svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--emx-muted);
  pointer-events: none;
}
.emx-input, .emx-select, .emx-textarea {
  width: 100%;
  border: 1px solid var(--emx-line-strong);
  border-radius: 9px;
  background: var(--emx-surface);
  color: var(--emx-ink);
  font: inherit;
  font-size: 12.5px;
  outline: none;
  transition: .18s ease;
}
.emx-input, .emx-select { height: 36px; padding: 0 11px; }
.emx-search .emx-input { padding-left: 34px; }
.emx-textarea { padding: 10px 12px; resize: vertical; line-height: 1.65; }
.emx-input:focus, .emx-select:focus, .emx-textarea:focus {
  border-color: var(--emx-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emx-primary) 13%, transparent);
}
.emx-input::placeholder, .emx-textarea::placeholder { color: var(--emx-muted); opacity: .7; }
.emx-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--emx-muted) 50%), linear-gradient(135deg, var(--emx-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.emx-chip-group { display: flex; gap: 3px; padding: 3px; background: var(--emx-surface); border: 1px solid var(--emx-line); border-radius: 9px; }
.emx-chip {
  height: 29px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--emx-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.emx-chip:hover { color: var(--emx-ink); }
.emx-chip.is-active { background: var(--emx-primary-soft); color: var(--emx-primary); }
.emx-toolbar-right { margin-left: auto; display: flex; gap: 7px; }

/* ── 分页 ── */
.emx-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
  font-size: 11px;
  color: var(--emx-muted);
}
.emx-pager-btns { display: flex; gap: 6px; }

/* ── 列表行卡片 ── */
.emx-mailbox-card {
  padding: 15px 16px;
  border: 1px solid var(--emx-line);
  border-radius: 12px;
  background: var(--emx-surface);
}
.emx-mailbox-card + .emx-mailbox-card { margin-top: 10px; }
.emx-mailbox-top { display: flex; align-items: flex-start; gap: 10px; }
.emx-mailbox-avatar {
  width: 36px; height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #0b6584, #0d304b);
  font-size: 13px;
  font-weight: 700;
}
.emx-mailbox-name { flex: 1; min-width: 0; }
.emx-mailbox-name strong { display: block; font-size: 12.5px; }
.emx-mailbox-name span { display: block; font-size: 10.5px; color: var(--emx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emx-mailbox-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.emx-mailbox-progress { margin-top: 12px; }
.emx-mailbox-actions { display: flex; gap: 6px; margin-top: 11px; }

/* ── 模板卡片 ── */
.emx-tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.emx-tpl-card {
  overflow: hidden;
  background: var(--emx-surface);
  border: 1px solid var(--emx-line);
  border-radius: 14px;
  box-shadow: var(--emx-shadow);
  transition: .2s ease;
}
.emx-tpl-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(12,42,64,.12); border-color: var(--emx-line-strong); }
.emx-tpl-cover {
  position: relative;
  height: 132px;
  padding: 16px 17px;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(180px 110px at 90% 10%, rgba(255,255,255,.18), transparent 65%),
    linear-gradient(135deg, #0a334b, #0d6280);
}
.emx-tpl-cover::after {
  content: "";
  position: absolute;
  right: -18px; bottom: -46px;
  width: 150px; height: 150px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
}
.emx-tpl-cover.alt { background: linear-gradient(135deg, #4b3416, #a47432); }
.emx-tpl-cover.alt2 { background: linear-gradient(135deg, #233c2c, #28775c); }
.emx-tpl-cover.alt3 { background: linear-gradient(135deg, #39233f, #6d4774); }
.emx-tpl-kicker { font-size: 9px; letter-spacing: .17em; opacity: .7; font-weight: 700; }
.emx-tpl-name {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 650;
  max-height: 44px;
  overflow: hidden;
}
.emx-tpl-subject {
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.5;
  opacity: .72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emx-tpl-cover-tag {
  position: absolute;
  top: 14px; right: 14px;
  height: 20px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  font-size: 9.5px;
  font-weight: 600;
}
.emx-tpl-body { padding: 14px 16px 15px; }
.emx-tpl-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: var(--emx-muted);
}
.emx-tpl-actions { display: flex; gap: 6px; margin-top: 12px; }
.emx-tpl-actions .emx-btn { flex: 1; }

/* ── 设置 / 发件箱 ── */
.emx-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .9fr);
  gap: 14px;
  align-items: start;
}
.emx-config-form { display: grid; gap: 12px; }
.emx-form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.emx-field { display: grid; gap: 5px; }
.emx-field > label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--emx-muted);
  letter-spacing: .02em;
}
.emx-field .emx-hint { font-size: 10px; color: var(--emx-muted); line-height: 1.55; }
.emx-switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0;
}
.emx-switch { position: relative; width: 38px; height: 21px; flex: 0 0 auto; }
.emx-switch input { position: absolute; opacity: 0; }
.emx-switch span {
  position: absolute; inset: 0;
  border-radius: 99px;
  background: var(--emx-line-strong);
  cursor: pointer;
  transition: .2s;
}
.emx-switch span::after {
  content: "";
  position: absolute;
  width: 15px; height: 15px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: .2s;
}
.emx-switch input:checked + span { background: var(--emx-primary); }
.emx-switch input:checked + span::after { transform: translateX(17px); }

/* ── 弹层 ── */
.emx-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(4, 16, 26, .62);
  backdrop-filter: blur(4px);
  animation: emx-fade .16s ease;
}
@keyframes emx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes emx-pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.emx-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  background: var(--emx-surface);
  border: 1px solid var(--emx-line);
  border-radius: 16px;
  box-shadow: var(--emx-shadow-lg);
  overflow: hidden;
  animation: emx-pop .18s ease;
}
.emx-modal.wide { width: min(1040px, 100%); }
.emx-modal.xwide { width: min(1180px, 100%); }
.emx-modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 19px 22px 15px;
  border-bottom: 1px solid var(--emx-line);
}
.emx-modal-head h3 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.emx-modal-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--emx-muted); line-height: 1.6; }
.emx-modal-head .emx-icon-btn { margin-left: auto; flex: 0 0 auto; }
.emx-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 19px 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--emx-line-strong) transparent;
}
.emx-modal-body::-webkit-scrollbar { width: 7px; }
.emx-modal-body::-webkit-scrollbar-thumb { background: var(--emx-line-strong); border-radius: 99px; }
.emx-modal-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 22px;
  border-top: 1px solid var(--emx-line);
  background: var(--emx-surface-2);
}
.emx-modal-foot .emx-foot-note { margin-right: auto; font-size: 10.5px; color: var(--emx-muted); }

/* 分段编辑：左表单右预览 */
.emx-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .95fr);
  gap: 18px;
  min-height: 460px;
}
.emx-form-stack { display: grid; gap: 12px; align-content: start; }
.emx-code {
  width: 100%;
  min-height: 270px;
  padding: 12px 13px;
  border: 1px solid var(--emx-line-strong);
  border-radius: 10px;
  background: #0c1925;
  color: #d6e6f2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11.5px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  tab-size: 2;
}
.emx-code:focus { border-color: var(--emx-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emx-primary) 13%, transparent); }
.emx-preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--emx-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--emx-surface-2);
}
.emx-preview-bar {
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--emx-line);
  background: var(--emx-surface);
  font-size: 10.5px;
  color: var(--emx-muted);
}
.emx-preview-bar strong { color: var(--emx-ink-2); font-weight: 600; margin-right: auto; }
.emx-preview-frame { flex: 1; min-height: 420px; width: 100%; border: 0; background: #eef2f6; }
.emx-preview-frame.tall { min-height: 560px; }

/* 收件人类型选择 */
.emx-recipient-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.emx-recipient-opt {
  position: relative;
  padding: 10px 11px;
  border: 1px solid var(--emx-line);
  border-radius: 9px;
  background: var(--emx-surface);
  cursor: pointer;
  transition: .16s ease;
}
.emx-recipient-opt:hover { border-color: var(--emx-line-strong); background: var(--emx-surface-2); }
.emx-recipient-opt input { position: absolute; opacity: 0; }
.emx-recipient-opt.is-active { border-color: var(--emx-primary); background: var(--emx-primary-soft); }
.emx-recipient-opt strong { display: block; font-size: 12px; font-weight: 600; }
.emx-recipient-opt span { display: block; margin-top: 2px; font-size: 10px; color: var(--emx-muted); }
.emx-recipient-count {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--emx-surface-2);
  border: 1px dashed var(--emx-line-strong);
  font-size: 10.5px;
  color: var(--emx-muted);
}
.emx-recipient-count b { color: var(--emx-ink); font-size: 13px; }
.emx-recipient-count > svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--emx-primary); }

/* 详情 */
.emx-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.emx-detail-stat {
  padding: 12px 13px;
  border: 1px solid var(--emx-line);
  border-radius: 10px;
  background: var(--emx-surface-2);
}
.emx-detail-stat span { display: block; font-size: 10px; color: var(--emx-muted); }
.emx-detail-stat strong { display: block; margin-top: 3px; font-size: 21px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.emx-detail-stat.good strong { color: var(--emx-green); }
.emx-detail-stat.bad strong { color: var(--emx-red); }
.emx-log-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px 18px;
  margin-bottom: 14px;
  padding: 13px 15px;
  background: var(--emx-surface-2);
  border: 1px solid var(--emx-line);
  border-radius: 10px;
}
.emx-log-detail-meta div { display: flex; gap: 8px; font-size: 11px; }
.emx-log-detail-meta span { color: var(--emx-muted); min-width: 54px; }
.emx-log-detail-meta strong { color: var(--emx-ink-2); font-weight: 500; word-break: break-all; }
.emx-error-box {
  margin: 12px 0;
  padding: 11px 13px;
  background: var(--emx-red-soft);
  border: 1px solid color-mix(in srgb, var(--emx-red) 24%, var(--emx-line));
  border-radius: 9px;
  color: var(--emx-red);
  font-size: 11.5px;
  line-height: 1.65;
  word-break: break-all;
}

/* 分步说明 */
.emx-steps { display: grid; gap: 10px; }
.emx-step { display: flex; gap: 11px; }
.emx-step-num {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--emx-primary-soft);
  color: var(--emx-primary);
  font-size: 10.5px;
  font-weight: 700;
}
.emx-step-copy strong { display: block; font-size: 11.5px; }
.emx-step-copy span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--emx-muted); line-height: 1.6; }

/* Toast */
.emx-toasts {
  position: fixed;
  z-index: 2100;
  right: 24px;
  top: 86px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.emx-toast {
  min-width: 250px;
  max-width: 380px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--emx-line);
  border-radius: 11px;
  background: var(--emx-surface);
  box-shadow: var(--emx-shadow-lg);
  color: var(--emx-ink-2);
  font-size: 12px;
  line-height: 1.55;
  animation: emx-toast-in .22s ease;
  pointer-events: auto;
}
.emx-toast svg { width: 16px; height: 16px; margin-top: 1px; flex: 0 0 auto; }
.emx-toast.success { border-color: color-mix(in srgb, var(--emx-green) 35%, var(--emx-line)); }
.emx-toast.success svg { color: var(--emx-green); }
.emx-toast.error { border-color: color-mix(in srgb, var(--emx-red) 38%, var(--emx-line)); }
.emx-toast.error svg { color: var(--emx-red); }
.emx-toast.info svg { color: var(--emx-primary); }
@keyframes emx-toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* 迷你图表 */
.emx-trend { padding: 4px 2px 0; }
.emx-trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  height: 96px;
  padding-top: 6px;
}
.emx-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.emx-trend-stack { width: 100%; max-width: 34px; height: 72px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.emx-trend-send { width: 12px; border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--emx-primary) 78%, transparent); min-height: 2px; }
.emx-trend-open { width: 7px; border-radius: 3px 3px 2px 2px; background: var(--emx-gold); min-height: 0; }
.emx-trend-col span { font-size: 9px; color: var(--emx-muted); white-space: nowrap; }
.emx-trend-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 9.5px; color: var(--emx-muted); }
.emx-trend-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* 其他 */
.emx-tip {
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--emx-primary-soft);
  border: 1px solid color-mix(in srgb, var(--emx-primary) 16%, var(--emx-line));
  color: var(--emx-ink-2);
  font-size: 10.5px;
  line-height: 1.65;
}
.emx-tip b { color: var(--emx-primary); }
.emx-muted { color: var(--emx-muted); }
.emx-danger-text { color: var(--emx-red); }
.emx-nowrap { white-space: nowrap; }
.emx-flex { display: flex; align-items: center; gap: 8px; }
.emx-mt8 { margin-top: 8px; }
.emx-mt12 { margin-top: 12px; }
.emx-mt16 { margin-top: 16px; }
.emx-hidden { display: none !important; }
.emx-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emx-check {
  appearance: none;
  width: 15px; height: 15px;
  border: 1px solid var(--emx-line-strong);
  border-radius: 4px;
  background: var(--emx-surface);
  cursor: pointer;
  vertical-align: -3px;
  position: relative;
}
.emx-check:checked { background: var(--emx-primary); border-color: var(--emx-primary); }
.emx-check:checked::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* 空加载 */
.emx-skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--emx-surface-2), var(--emx-line), var(--emx-surface-2));
  background-size: 200% 100%;
  animation: emx-shimmer 1.3s linear infinite;
}
@keyframes emx-shimmer { to { background-position: -200% 0; } }

/* 响应式 */
@media (max-width: 1180px) {
  .emx-main { padding: 23px 22px 36px; }
  .emx-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .emx-grid-2, .emx-settings-grid { grid-template-columns: minmax(0,1fr); }
  .emx-tpl-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .emx-detail-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .emx-today { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .emx-today-note { display: none; }
  /* 窄屏收起次要列，保证状态和操作按钮同时可见 */
  .emx-campaign-table { min-width: 0 !important; }
  .emx-campaign-table th:nth-child(2), .emx-campaign-table td:nth-child(2),
  .emx-campaign-table th:nth-child(3), .emx-campaign-table td:nth-child(3),
  .emx-campaign-table th:nth-child(6), .emx-campaign-table td:nth-child(6) { display: none; }
  .emx-log-table { min-width: 0 !important; }
  .emx-log-table th:nth-child(2), .emx-log-table td:nth-child(2),
  .emx-log-table th:nth-child(3), .emx-log-table td:nth-child(3),
  .emx-log-table th:nth-child(6), .emx-log-table td:nth-child(6) { display: none; }
  .emx-sub-table { min-width: 0 !important; }
  .emx-sub-table th:nth-child(3), .emx-sub-table td:nth-child(3),
  .emx-sub-table th:nth-child(6), .emx-sub-table td:nth-child(6) { display: none; }
  .emx-open-table { min-width: 0 !important; }
  .emx-open-table th:nth-child(4), .emx-open-table td:nth-child(4) { display: none; }
}

@media (max-width: 980px) {
  .emx-top { padding: 0 14px; gap: 12px; }
  .emx-top-context, .emx-top-sep, .emx-health-pill { display: none; }
  .emx-shell { flex-direction: column; }
  .emx-nav {
    flex: 0 0 auto;
    width: 100%;
    padding: 9px 12px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .emx-nav::-webkit-scrollbar { display: none; }
  .emx-nav-label, .emx-nav-foot { display: none; }
  .emx-nav-item {
    width: auto;
    flex: 0 0 auto;
    height: 36px;
    margin: 0 2px 0 0;
    padding: 0 11px;
    font-size: 12px;
    border-radius: 7px;
  }
  .emx-nav-item.is-active { box-shadow: inset 0 -2px 0 #45b0cb; }
  .emx-nav-badge { display: none; }
  .emx-main { padding: 18px 14px 30px; }
  .emx-page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .emx-page-head h1 { font-size: 23px; }
  .emx-kpis { gap: 10px; }
  .emx-kpi { min-height: 112px; padding: 14px 15px; }
  .emx-kpi-value { font-size: 29px; }
  .emx-today { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .emx-today-item { padding: 11px 12px; }
  .emx-tpl-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .emx-split { grid-template-columns: 1fr; }
  .emx-preview-frame { min-height: 340px; }
  .emx-recipient-grid, .emx-form-row { grid-template-columns: 1fr; }
  .emx-toolbar-right { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .emx-modal-backdrop { padding: 12px; }
  .emx-modal { max-height: calc(100vh - 24px); }
}

@media (max-width: 640px) {
  .emx-top { height: auto; min-height: 61px; flex-wrap: wrap; padding: 9px 12px; }
  .emx-logo { width: 33px; height: 33px; }
  .emx-brand-text strong { font-size: 14px; }
  .emx-top-actions { gap: 5px; }
  .emx-back span { display: none; }
  .emx-back { width: 34px; padding: 0; justify-content: center; }
  .emx-kpis, .emx-tpl-grid { grid-template-columns: 1fr; }
  .emx-today { grid-template-columns: 1fr; }
  .emx-today-item { border-right: 0; border-bottom: 1px solid var(--emx-line); }
  .emx-today-item:last-of-type { border-bottom: 0; }
  .emx-page-head h1 { font-size: 21px; }
  .emx-head-actions { width: 100%; }
  .emx-head-actions .emx-btn { flex: 1; }
  .emx-modal-body { padding: 15px; }
  .emx-modal-head, .emx-modal-foot { padding-left: 15px; padding-right: 15px; }
  .emx-detail-grid { grid-template-columns: 1fr 1fr; }
  .emx-log-detail-meta { grid-template-columns: 1fr; }
  .emx-toasts { left: 12px; right: 12px; top: 76px; }
  .emx-toast { min-width: 0; max-width: none; }
}
