:root {
  --bg: #f3efe6;
  --paper: #fffcf7;
  --ink: #1c2430;
  --muted: #5c6674;
  --line: #ddd4c6;
  --teal: #0f6e6b;
  --teal-2: #14918c;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
  --badge: #e23d2b;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 500px at 10% -10%, #e7f3f1 0%, transparent 50%), var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--teal); text-decoration: none; }
.acct-link { color: #3b5bff; cursor: pointer; }
.acct-link:hover { text-decoration: underline; }
/* 导航切换加载反馈 */
.page-loader {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200;
  background: linear-gradient(90deg, #3b5bff, #7c9bff);
  transform: scaleX(0); transform-origin: 0 50%; opacity: 0; pointer-events: none;
}
body.nav-loading .page-loader { opacity: 1; animation: pageload 8s ease-out forwards; }
@keyframes pageload {
  0% { transform: scaleX(0); }
  30% { transform: scaleX(.55); }
  60% { transform: scaleX(.75); }
  100% { transform: scaleX(.9); }
}
.admin-item.nav-pending { background: #eef1fb; color: #3b5bff; }
/* 取信列表：列宽拖拽手柄 + 列拖动指示 */
.mbox-hcols { position: relative; }
.mbox-hcols > span { position: relative; }
.col-handle {
  position: absolute; top: 0; right: -4px; width: 8px; height: 100%;
  cursor: col-resize; z-index: 3;
}
.col-handle:after {
  content: ""; position: absolute; top: 15%; bottom: 15%; left: 3px; width: 2px;
  border-radius: 2px; background: transparent;
}
.mbox-hcols > span:hover .col-handle:after { background: #c9d6ff; }
.mbox-hcols.col-resizing .col-handle:after { background: #3b5bff; }
body.col-resizing-active { cursor: col-resize; user-select: none; }
.mbox-hcols [draggable="true"] { -webkit-user-drag: element; user-select: none; }
.mbox-hcols > span.col-dragging { opacity: .45; }
.mbox-hcols > span.col-dragover { box-shadow: inset 2px 0 0 #3b5bff; background: #f0f4ff; }
.mbox-hcols > span { cursor: grab; }
.mbox-hcols > span:active { cursor: grabbing; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1680px; margin: 0 auto; padding: 24px 28px 48px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--teal); color: #fff; display: grid; place-items: center;
  font-size: 16px;
}
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; cursor: pointer;
  text-decoration: none; font-family: inherit;
}
.nav a.active, .btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { background: #fff1f0; border-color: #f5c2c0; color: var(--danger); }
.btn.ghost { background: transparent; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 20px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.card-head .sub { margin-bottom: 0; }
.codes-search { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.codes-search input { width: 240px; min-width: 180px; }
.codes-search input[type="number"] { width: 72px; min-width: 72px; }
.sync-bar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 13px; color: var(--muted);
}
.sync-switch {
  width: 44px; height: 24px; border: none; border-radius: 999px;
  background: #d9d3c8; position: relative; cursor: pointer; padding: 0;
  vertical-align: middle; flex-shrink: 0;
}
.sync-switch .sync-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(28,36,48,.2);
  transition: left .15s ease;
}
.sync-switch.on { background: var(--teal); }
.sync-switch.on .sync-knob { left: 22px; }
.sync-secs {
  min-width: 28px; padding: 2px 6px; border-radius: 6px 6px 0 0;
  color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums;
  cursor: text;
  border-bottom: 2px dashed #c3cbdd;
}
.sync-secs:hover { color: #3b5bff; border-bottom-color: #3b5bff; background: #f4f7ff; }
.sync-secs input {
  width: 56px; padding: 4px 6px; font: inherit; font-weight: 700;
}
.pager {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px;
}
/* 分页「每页 N 个」：双击可改 */
.pp-edit {
  display: inline-block; min-width: 20px; padding: 1px 4px; border-radius: 6px;
  border-bottom: 1px dashed var(--muted); cursor: default; user-select: none;
}
.pp-edit .pp-input {
  width: 64px; padding: 2px 6px; font: inherit; border: 1px solid var(--line); border-radius: 8px;
}
/* 后台列表表格列宽拖拽 */
table[data-colkey] thead th { position: relative; }
table[data-colkey] thead th:hover .col-handle:after { background: #c9d6ff; }
table[data-colkey] td { word-break: break-all; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.2fr .8fr; }
.grid.stats { grid-template-columns: repeat(3, 1fr); }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  font: inherit; background: #fff;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.row .grow { flex: 2; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 1100px; }
/* 三方邮箱列表：固定列宽，角色名列不被子内容撑宽 */
.imap-table { table-layout: fixed; }
.imap-table th:nth-child(1), .imap-table td:nth-child(1) { width: 230px; }
.imap-table th:nth-child(3), .imap-table td:nth-child(3) { width: 92px; }
.imap-table th:nth-child(4), .imap-table td:nth-child(4) { width: 200px; }
.imap-table th:nth-child(5), .imap-table td:nth-child(5) { width: 96px; }
.imap-table th:nth-child(6), .imap-table td:nth-child(6) { width: 140px; }
.imap-table th:nth-child(7), .imap-table td:nth-child(7) { width: 175px; }
.imap-table td { word-break: break-all; }
.imap-table .role-cell { white-space: normal; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.badge {
  display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--teal); color: #fff;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.badge.zero { background: #d9d3c8; color: #4a5563; }
.badge.unread { background: var(--badge); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eaf6f4; color: var(--teal); }
.pill.off { background: #f3efe6; color: var(--muted); }
.pill.ok { background: #eaf8f0; color: var(--ok); }
.pill.bad { background: #fff1f0; color: var(--danger); }
.pill.warn { background: #fff6e5; color: #b86a00; }
.pill.skip-pill { background: #e8eeff; color: #3b5bff; }
.skip-text { color: #3b5bff; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.flash.ok { background: #eaf8f0; color: var(--ok); }
.flash.err { background: #fff1f0; color: var(--danger); }
.otp {
  font-size: 28px; letter-spacing: .18em; font-weight: 800; color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.login-box { max-width: 420px; margin: 8vh auto; }
.hint { font-size: 12px; color: var(--muted); }
.col-no { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.sel-count {
  position: fixed; right: 24px; bottom: 24px; z-index: 70;
  background: var(--teal); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow);
}
.sel-count[hidden] { display: none !important; }
.role-cell, .note-cell {
  display: inline-block; min-width: 72px; padding: 4px 6px; border-radius: 8px;
  cursor: default; user-select: none;
}
.role-cell.role-empty, .note-cell.role-empty { color: var(--muted); }
.note-cell { min-width: 56px; }
.role-cell .role-input, .note-cell .role-input {
  width: 110px; padding: 4px 8px; font: inherit; border-radius: 8px;
}
.actions { display: flex; gap: 6px; flex-wrap: nowrap !important; white-space: nowrap; align-items: center; }
td.actions {
  white-space: nowrap !important;
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 6px;
}
td.actions form { display: inline-flex; margin: 0; flex-shrink: 0; }
td.actions .btn, td.actions button.btn {
  padding: 4px 7px; font-size: 12px; flex-shrink: 0; white-space: nowrap;
}
.btn-source {
  margin-top: 8px;
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
}
.btn-source:hover { filter: brightness(1.08); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(28, 36, 48, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 80; padding: 24px;
}
.modal-mask[hidden] { display: none !important; }
.modal-box {
  background: var(--paper); border-radius: 16px; max-width: 760px; width: 100%;
  max-height: 80vh; overflow: auto; padding: 20px 44px 20px 20px; position: relative;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 10px; right: 12px; border: none; background: #eee;
  width: 32px; height: 32px; border-radius: 8px; font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { background: #ddd; }
.mail { white-space: pre-wrap; line-height: 1.6; background: #f7f3eb; padding: 12px; border-radius: 10px; }
.code { font-family: Consolas, monospace; font-size: 12px; background: #1c2430; color: #e8e4da; padding: 12px; border-radius: 10px; overflow: auto; }
@media (max-width: 860px) {
  .grid.two, .grid.stats { grid-template-columns: 1fr; }
}
body.guest-login {
  min-height: 100vh;
  background: #f3f5fb;
  color: #1a2340;
  display: flex;
  align-items: center;
  justify-content: center;
}
.xyh-flash {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 30; min-width: 280px; margin: 0;
}
.xyh-page {
  display: flex; align-items: center; justify-content: center;
  gap: 56px; width: 100%; max-width: 1080px; padding: 32px 28px 48px;
}
.xyh-left { flex: 1.15; min-width: 0; }
.xyh-slogan { margin-bottom: 12px; }
.xyh-art-title {
  font-family: "ZCOOL KuaiLe", "Microsoft YaHei", sans-serif;
  font-size: 48px; font-weight: 400; line-height: 1.35;
  letter-spacing: .14em;
  color: #3b6cff;
  -webkit-text-stroke: 5px #fff;
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 #2f54d0,
    2px 4px 0 rgba(255,255,255,.9),
    0 8px 16px rgba(40, 80, 200, .18);
  transform: rotate(-2deg);
  transform-origin: left center;
  display: inline-block;
  margin: 0 0 18px;
}
.xyh-art-title.long { font-size: 34px; letter-spacing: .06em; }
.xyh-art {
  display: block; width: 100%; max-width: 420px; height: auto;
  object-fit: contain;
}
.xyh-right { flex: 0 0 400px; max-width: 100%; }
.xyh-card {
  background: #fff; border-radius: 18px; padding: 36px 32px 28px;
  box-shadow: 0 16px 50px rgba(40, 60, 120, .1);
}
.xyh-card h2 {
  text-align: center; font-size: 20px; margin: 0 0 22px; font-weight: 700;
}
.xyh-tabs {
  display: flex; gap: 6px; margin: 0 0 20px; padding: 4px;
  background: #eef1f8; border-radius: 12px;
}
.xyh-tabs a {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 9px;
  font-size: 14px; color: #5a6377; text-decoration: none;
}
.xyh-tabs a.on {
  background: #fff; color: #1a2340; font-weight: 700;
  box-shadow: 0 2px 8px rgba(26, 35, 64, .08);
}
.guest-login .xyh-card input {
  display: block; width: 100%; margin: 0 0 14px; padding: 12px 14px;
  border: 1px solid #e6eaf2; border-radius: 10px; background: #f7f8fc;
}
.guest-login .xyh-card input:focus {
  outline: none; border-color: #8aa0ff; background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 91, 255, .15);
}
.xyh-pass { position: relative; }
.xyh-pass input { padding-right: 44px; }
.xyh-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-70%);
  width: 32px; height: 32px; border: none; background: transparent;
  cursor: pointer; color: #8b93a7; padding: 0;
}
.xyh-eye:before { content: "显示"; font-size: 12px; }
.xyh-eye.on:before { content: "隐藏"; }
.xyh-submit {
  width: 100%; border: none; background: #3b5bff; color: #fff;
  padding: 12px; border-radius: 10px; font-size: 16px; font-weight: 600;
  cursor: pointer; margin-top: 6px; font-family: inherit;
}
.xyh-submit:hover { background: #2f4ce8; }
.xyh-sub { text-align: center; margin: 14px 0 0; font-size: 13px; }
.xyh-sub a { color: #3b5bff; }
.xyh-warn {
  margin: 18px 0 0; font-size: 12px; color: #8b93a7; text-align: center;
  background: #f4f6fb; padding: 10px 12px; border-radius: 10px;
}
@media (max-width: 860px) {
  .xyh-page { flex-direction: column; gap: 20px; padding: 24px 16px 40px; }
  .xyh-left { text-align: center; }
  .xyh-art-title { transform-origin: center center; font-size: 40px; }
  .xyh-art-title.long { font-size: 28px; }
  .xyh-art { margin: 0 auto; max-height: 260px; }
  .xyh-right { flex: none; width: 100%; max-width: 420px; }
}
html:has(.mbox-app), html:has(.admin-app) { height: 100%; overflow: hidden; }
body.mbox-app {
  height: 100vh; max-height: 100vh; min-height: 0; overflow: hidden;
  display: flex; background: #fff; background-image: none;
}
body.admin-app {
  height: 100vh; max-height: 100vh; min-height: 0; overflow: hidden;
  display: flex; background: #f3f5fb; background-image: none;
}
.mbox-rail {
  width: 72px; flex-shrink: 0; background: #2b3038; color: #c5cad3;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 12px 6px 16px;
  position: sticky; top: 0; height: 100vh; max-height: 100vh; overflow-y: auto;
}
.mbox-logo {
  width: 40px; height: 40px; margin: 4px auto 16px; border-radius: 12px;
  background: #3b5bff; color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
}
.mbox-item {
  display: block; text-align: center; padding: 10px 2px; margin: 2px 0;
  border: none; background: transparent; color: #c5cad3; font: inherit;
  font-size: 12px; text-decoration: none; cursor: pointer; border-radius: 8px;
  line-height: 1.2; white-space: nowrap;
}
.mbox-item:hover, .mbox-item.on { background: #3a414c; color: #fff; text-decoration: none; }
.mbox-spacer { flex: 1; }
.admin-rail {
  width: 168px; flex-shrink: 0; background: #fff; color: #1a2340;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 16px 12px; border-right: 1px solid #e6eaf2;
  position: sticky; top: 0; height: 100vh; max-height: 100vh; overflow-y: auto;
}
.admin-rail .mbox-logo { margin: 0 auto 20px; text-decoration: none; }
.admin-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin: 2px 0; border-radius: 8px;
  color: #1a2340; text-decoration: none; font-size: 14px; white-space: nowrap;
}
.admin-item:hover { background: #eef1fb; color: #1a2340; text-decoration: none; }
.admin-item.on { background: #3b5bff; color: #fff; text-decoration: none; }
.admin-badge {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #e8eeff; color: #3b5bff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-item.on .admin-badge { background: rgba(255,255,255,.22); color: #fff; }
.admin-stage { flex: 1; min-width: 0; min-height: 0; height: 100vh; padding: 20px 24px 40px; overflow: auto; }
.admin-stage:has(.home-idle) {
  display: flex; align-items: center; justify-content: center;
}
.admin-stage:has(.home-desk) {
  display: block; align-items: stretch; justify-content: flex-start;
}
.home-page { width: 100%; max-width: 1120px; margin: 0 auto; }
.home-page:not(.home-idle) { max-width: none; height: 100%; display: flex; flex-direction: column; min-height: calc(100vh - 80px); }
.home-page.home-desk {
  max-width: none; height: 100%; display: flex; flex-direction: column;
  min-height: calc(100vh - 80px); margin: 0;
}
.home-idle { max-width: 640px; text-align: center; padding-bottom: 8vh; }
.home-search h1 {
  margin: 0 0 8px; font-size: 36px; font-weight: 800; letter-spacing: .04em; color: #1a2340;
}
.home-idle .home-search .sub { margin: 0 auto 28px; max-width: 420px; font-size: 15px; }
.home-page:not(.home-idle) .home-search { width: 100%; max-width: 1160px; margin: 8px auto 24px; text-align: center; }
.home-page:not(.home-idle) .home-search h1 { font-size: 22px; }
.home-page.home-desk .home-search { margin: 0 0 12px; max-width: none; text-align: left; }
.home-mods { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.home-mods .btn b { font-weight: 700; }
.home-mods .btn.primary, .home-page.home-desk .home-mods .btn { background: #fff; }
.home-search-row {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #e6eaf2; border-radius: 16px;
  padding: 10px 12px 10px 16px; box-shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
}
.home-search-row input[name="q"] {
  flex: 1; min-width: 0; width: auto; border: none; background: transparent;
  font-size: 16px; padding: 10px 0; outline: none; box-shadow: none;
}
.home-limit-lab { color: #8b93a7; font-size: 14px; flex-shrink: 0; }
.home-search-row .sync-secs { font-size: 16px; }
.home-go { height: 42px; padding: 0 22px; font-size: 15px; border-radius: 12px; flex-shrink: 0; }
.home-mbox {
  flex: 1; min-height: 480px; display: flex; background: #fff;
  border: 1px solid #e6eaf2; border-radius: 16px; overflow: hidden;
}
.home-mbox .mbox-col, .home-mbox .mbox-split { flex: 1; min-width: 0; min-height: 0; }
.codes-page { max-width: none; height: 100%; display: flex; flex-direction: column; min-height: calc(100vh - 80px); }
.codes-top {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  margin-bottom: 16px; flex-wrap: wrap;
}
.codes-top h1 { margin: 0 0 6px; font-size: 22px; }
.codes-page .pager { margin-top: 12px; }
.mail-html { width: 100%; min-height: 520px; border: 0; background: #fff; display: block; }
.mbox-read-body { min-height: 200px; }
.admin-app .btn.primary, .admin-app .nav a.active { background: #3b5bff; border-color: #3b5bff; color: #fff; }
.admin-app .card a, .admin-app .sub a, .admin-app .flash a { color: #3b5bff; }
.admin-app .card { background: #fff; border-color: #e6eaf2; }
.admin-app .sync-switch.on { background: #3b5bff; }
.sync-card {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; margin: 0 0 12px;
}
.mail-tabs { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.mail-tabs a {
  font-size: 13px; padding: 6px 16px; border-radius: 9px;
  color: var(--muted); border: 1px solid var(--line); background: var(--paper);
}
.mail-tabs a:hover { text-decoration: none; border-color: var(--teal); color: var(--teal); }
.mail-tabs a.on { background: #3b5bff; border-color: #3b5bff; color: #fff; }
.mail-tabs-clear { margin-left: 10px; font-size: 12px; color: var(--muted) !important; border: none !important; background: none !important; padding: 6px 4px !important; }
.mail-tabs-clear:hover { color: var(--danger) !important; }
.mail-tabs-refresh {
  font-size: 13px; padding: 6px 18px; border-radius: 9px;
  color: var(--ink); border: 1px solid var(--line); background: var(--paper);
}
.mail-tabs-refresh:hover { text-decoration: none; border-color: var(--teal); color: var(--teal); }
.adm-pass-wrap { display: inline-flex; align-items: center; gap: 8px; }
.adm-pass { font-family: inherit; letter-spacing: 1px; min-width: 56px; display: inline-block; }
.adm-pass[data-shown="1"] { letter-spacing: normal; }
.adm-eye { padding: 2px 8px; font-size: 13px; line-height: 1.4; }
.pass-row { display: flex; align-items: center; gap: 8px; }
.pass-row input { flex: 1; min-width: 0; }
.mbox-stage { flex: 1; min-width: 0; min-height: 0; height: 100vh; display: flex; flex-direction: column; background: #fff; overflow: hidden; }
.ms-compact {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
}
.ms-compact > form { display: contents; }
.ms-field { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ms-field.sm { flex: 0 1 132px; }
.ms-field.md { flex: 1.2; min-width: 160px; }
.ms-field.lg { flex: 1.6; min-width: 180px; }
.ms-compact label { margin: 0 0 4px; font-size: 12px; white-space: nowrap; }
.ms-compact input { padding: 8px 10px; }
.ms-compact .btn { flex: 0 0 auto; white-space: nowrap; height: 38px; }
.ms-tools { display: flex; gap: 8px; margin: 10px 0 0; flex-wrap: wrap; }
.ms-import-head { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.ms-import-head h2 { margin: 0; flex: 0 0 auto; }
.ms-import-head input[type=file] {
  width: auto; max-width: 260px; flex: 0 0 auto; padding: 4px 0; border: none; background: transparent;
}
.ms-import-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.ms-import-actions .hint { margin: 0; display: flex; align-items: center; gap: 8px; }
.ms-import-actions input[type=checkbox] { width: auto; padding: 0; }
.ms-search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.ms-search input { flex: 1; min-width: 0; }
.ms-search .btn { flex: 0 0 auto; }
.page-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px;
}
.page-toolbar h1 { margin: 0 8px 0 0; font-size: 20px; flex: 0 0 auto; }
.page-toolbar-search {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
  flex: 1 1 240px; min-width: 200px; max-width: 420px;
}
.page-toolbar-search input { flex: 1; min-width: 0; margin: 0; }
.page-toolbar-search .btn { flex: 0 0 auto; }
.add-pop { max-width: 640px; }
.add-pop-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 0 0 14px;
}
.add-pop-bar h1 { margin: 0; font-size: 20px; }
.add-seg { display: flex; gap: 8px; margin: 0 0 16px; }
.add-pop label { display: block; margin: 0 0 6px; }
.add-pop input, .add-pop select, .add-pop textarea { margin-bottom: 12px; }
.add-pop .row { margin-bottom: 12px; }
.ms-keep-bar { display: none; margin: 10px 0 0; }
.ms-keep-bar.on { display: block; }
.ms-keep-track { height: 10px; background: #e8eeff; border-radius: 999px; overflow: hidden; }
.ms-keep-fill { height: 100%; width: 0; background: #3b5bff; transition: width .25s ease; }
.ms-keep-meta { font-size: 12px; color: #5c6674; margin-top: 6px; }
body.admin-popup .admin-stage { width: 100%; }
body.admin-popup .admin-stage:has(.mail-pop) { padding: 0; }
.mail-pop { display: flex; flex-direction: column; height: 100%; min-height: calc(100vh - 0px); background: #fff; }
.mail-pop-bar {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  padding: 14px 18px; border-bottom: 1px solid #e6eaf2; flex-shrink: 0;
}
.mail-pop-meta h1 { margin: 0 0 6px; font-size: 18px; }
.mail-pop-meta p { margin: 0; color: #8b93a7; font-size: 13px; }
.mail-pop-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mail-pop-otp {
  border: 1px solid #dfe4f2; background: #eef1fb; color: #3b5bff;
  font-size: 22px; font-weight: 800; letter-spacing: .12em; padding: 8px 14px;
  border-radius: 10px; cursor: text; user-select: all; -webkit-user-select: all; font-family: inherit;
}
.mail-pop-body { flex: 1; min-height: 0; overflow: auto; }
.mail-pop-body .mail-html { min-height: calc(100vh - 90px); }
.mbox-body { flex: 1; display: flex; min-height: 0; }
.mbox-folders {
  width: 200px; flex-shrink: 0; border-right: 1px solid #eceff5;
  background: #f7f8fb; padding: 16px 12px;
}
.mbox-addr {
  font-size: 12px; color: #5c6578; word-break: break-all;
  padding: 0 8px 14px; line-height: 1.4;
}
.mbox-folder {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; color: #1a2340; text-decoration: none; font-size: 14px;
}
.mbox-folder:hover { background: #eef1fb; color: #1a2340; text-decoration: none; }
.mbox-folder.on { background: #e8eeff; color: #3b5bff; font-weight: 700; text-decoration: none; }
.mbox-folder em {
  font-style: normal; background: #3b5bff; color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-left: 6px;
}
.mbox-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mbox-tools {
  height: 48px; border-bottom: 1px solid #eceff5; display: flex; align-items: center; gap: 8px;
  padding: 0 22px; flex-shrink: 0;
}
.mbox-tools form { margin: 0; }
.mbox-split { flex: 1; display: flex; min-height: 0; }
.mbox-list {
  width: 420px; max-width: 48%; border-right: 1px solid #eceff5;
  display: flex; flex-direction: column; min-width: 260px;
}
.mbox-search { padding: 10px 18px; }
.mbox-search input { background: #f4f6fb; border-color: #e6eaf2; }
.mbox-rows { overflow: auto; flex: 1; }
.mbox-row {
  display: flex; align-items: stretch; width: 100%; text-align: left; border: none; border-bottom: 1px solid #f0f2f7;
  background: #fff; padding: 0; cursor: pointer; font: inherit;
}
.mbox-row-main {
  flex: 1; min-width: 0; padding: 10px 12px; border: none; background: transparent;
  text-align: left; font: inherit; cursor: pointer; color: inherit;
}
.mbox-flat { min-height: 360px; }
.mbox-flat .mbox-split { display: block; }
.mbox-flat .mbox-list { width: 100%; max-width: none; border-right: none; }
.mbox-hcols, .mbox-hrow {
  display: grid; grid-template-columns: 244px 124px minmax(200px, 1fr) 104px;
  gap: 0; align-items: stretch; width: 100%;
}
.mbox-hcols { color: #8b93a7; font-size: 12px; border-bottom: 1px solid #eef1f6; padding: 0 28px; }
.mbox-hcols span { padding: 9px 16px; }
.mbox-hcols span + span { border-left: 1px solid #eef1f6; }
.mbox-hcols span:nth-child(2) { text-align: center; }
.mbox-hcols span:last-child { text-align: left; }
/* 邮箱+验证码+主题+发件人+时间 五列（后台邮件页，另加序号列） */
.mbox-5col .mbox-hcols, .mbox-5col .mbox-hrow {
  grid-template-columns: 44px minmax(170px, 220px) 110px minmax(140px, 1fr) minmax(170px, 210px) 92px;
}
.mbox-5col .mbox-hcols span:nth-child(2) { text-align: left; }
.mbox-5col .mbox-hcols span:nth-child(3) { text-align: center; }
.mbox-no { color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; font-size: 12px; }
.mbox-acct { color: #3a4150; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbox-5col .mbox-row.unread .mbox-acct:before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #f5b400; margin-right: 6px; vertical-align: middle;
}
.mbox-5col .mbox-row.unread .mbox-from:before { display: none; }
.mbox-hrow { padding: 0 28px; }
.mbox-hrow > * { min-width: 0; padding: 10px 16px; }
.mbox-hrow > * + * { border-left: 1px solid #f0f3f9; }
.mbox-hrow .mbox-from, .mbox-hrow .mbox-subj, .mbox-hrow .mbox-time { padding: 10px 16px; }
.mbox-hrow .mbox-subj { margin-top: 0; }
.mbox-hrow .mbox-time { text-align: left; color: #8b93a7; font-size: 12px; }
.mbox-otp-cell { display: flex; align-items: center; justify-content: center; }
.mbox-hrow .mbox-row-otp {
  width: auto; flex: none; min-width: 66px; max-width: 112px;
  height: auto; min-height: 0; border: none; border-left: none; margin: 0;
  padding: 5px 12px; border-radius: 999px; background: #e8eeff;
  cursor: text; user-select: all; -webkit-user-select: all;
  font-size: 14px;
}
.mbox-hrow .mbox-row-otp:hover { background: #dbe5ff; }
.mbox-hrow .mbox-row-otp.is-empty { background: transparent; }
.mbox-row-otp { cursor: text; user-select: all; -webkit-user-select: all; }
.mbox-row-otp {
  width: 108px; flex-shrink: 0; border-left: 1px solid #eceff5;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: .08em; color: #3b5bff;
  padding: 0 8px; word-break: break-all;
}
.mbox-row-otp.is-empty { color: #c5cad3; font-weight: 500; letter-spacing: 0; font-size: 14px; }
.mbox-row-otp.otp-copied,
.mbox-hrow .mbox-row-otp.otp-copied {
  background: #16a34a !important; color: #fff !important; border-radius: 999px;
  letter-spacing: 0; font-size: 13px; font-weight: 700; cursor: default;
}
.mbox-row:hover { background: #f6f8ff; }
.mbox-row.on { background: #e8eeff; }
.mbox-row.unread .mbox-subj { font-weight: 700; }
.mbox-row.unread .mbox-from:before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #f5b400; margin-right: 6px; vertical-align: middle;
}
.mbox-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #8b93a7; }
.mbox-from { color: #3a4150; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbox-time { flex-shrink: 0; }
.mbox-subj {
  margin-top: 4px; font-size: 13px; color: #1a2340;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mbox-read { flex: 1; padding: 24px 28px; overflow: auto; }
.mbox-placeholder { color: #8b93a7; margin-top: 20vh; text-align: center; }
.mbox-read-title { font-size: 22px; margin: 0 0 12px; }
.mbox-read-meta { color: #8b93a7; font-size: 13px; margin-bottom: 18px; }
.mbox-read-body { white-space: pre-wrap; line-height: 1.7; }
.mbox-otp { font-size: 28px; letter-spacing: .12em; color: #3b5bff; font-weight: 800; margin-bottom: 16px; }
/* 收件箱表格 + 弹层读信 */
.mail-modal { display: none; }
.mail-modal.open { display: flex; position: fixed; inset: 0; z-index: 60; align-items: center; justify-content: center; }
.mail-modal-mask { position: absolute; inset: 0; background: rgba(17, 24, 39, .42); }
.mail-modal-card {
  position: relative; width: min(880px, calc(100% - 40px)); max-height: min(84vh, 880px);
  background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  display: flex; flex-direction: column; overflow: hidden;
}
.mail-modal .mbox-read { display: block; padding: 26px 28px; overflow: auto; }
.mail-modal .mbox-read.open { position: static; inset: auto; }
.mail-modal-x {
  position: absolute; top: 10px; right: 12px; z-index: 2; width: 30px; height: 30px;
  border: none; border-radius: 8px; background: rgba(244, 246, 251, .92); color: #3a4150;
  font-size: 20px; line-height: 1; cursor: pointer;
}
.mail-modal-x:hover { background: #e8eeff; color: #3b5bff; }
.mbox-settings { max-width: 480px; padding: 28px; }
@media (max-width: 900px) {
  .mbox-folders { width: 150px; }
  .mbox-list { max-width: none; width: 46%; }
  .mbox-hcols, .mbox-hrow { grid-template-columns: 150px 100px minmax(120px, 1fr) 84px; }
  .mbox-5col .mbox-hcols, .mbox-5col .mbox-hrow { grid-template-columns: 34px minmax(120px, 150px) 90px minmax(90px, 1fr) minmax(120px, 150px) 80px; }
}
@media (max-width: 700px) {
  .mbox-folders { display: none; }
  .mbox-list { max-width: none; width: 100%; }
  .mbox-read { display: none; }
  .mbox-read.open { display: block; position: absolute; inset: 0 0 0 72px; background: #fff; z-index: 5; }
}

/* ===== 批量导入 ===== */
.import-page { max-width: 1500px; }
.import-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.import-title { margin: 0; font-size: 22px; letter-spacing: .02em; }
.panel-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.panel-switch a {
  font-size: 13px; padding: 6px 14px; border-radius: 9px;
  color: var(--muted); border: 1px solid var(--line); background: var(--paper);
}
.panel-switch a:hover { text-decoration: none; border-color: var(--teal); color: var(--teal); }
.panel-switch a.on { background: var(--teal); border-color: var(--teal); color: #fff; }

.imp-card { padding: 18px 20px; }
.imp-card-title { margin: 0 0 10px; font-size: 15px; }
.imp-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.imp-mode { width: 100%; max-width: 460px; }
.imp-text { width: 100%; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.7; resize: vertical; }
.imp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.imp-file-btn { cursor: pointer; }
.imp-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.imp-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.imp-check input { width: auto; margin: 0; }
.imp-submit { padding: 9px 22px; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--danger); }

.imp-stats { margin-bottom: 10px; }
.imp-stat-main { font-size: 14px; }
.imp-stat-main b { font-size: 17px; }
.imp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.imp-table { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.imp-table table { min-width: 0; width: 100%; }
.imp-table th, .imp-table td { padding: 8px 12px; font-size: 13px; }
.imp-table thead th { background: #f7f4ee; position: sticky; top: 0; z-index: 1; }
.imp-preview-scroll { max-height: 380px; overflow-y: auto; }
.imp-bad-row td { background: #fff8f7; }

.imp-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.imp-legend > div {
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fffdf9;
}
.imp-legend b { font-size: 13px; }
.imp-legend span { font-size: 12px; color: var(--muted); }

/* 方案 A 分步向导 */
.wizard { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.wizard-steps { display: flex; gap: 8px; list-style: none; margin: 0; padding: 16px 20px 0; }
.wizard-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex: 1; }
.wizard-steps li span {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--muted);
}
.wizard-steps li.on { color: var(--teal); font-weight: 600; }
.wizard-steps li.on span { background: var(--teal); border-color: var(--teal); color: #fff; }
.wizard-steps li.done span { background: #e6f4f2; border-color: var(--teal); color: var(--teal); }
.wizard-steps li:not(:last-child)::after { content: ""; flex: 1; height: 1px; background: var(--line); margin-left: 4px; }
.wizard-body { padding: 18px 20px; }
.wizard-step { display: none; }
.wizard-step.on { display: block; }
.wizard-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: #fbf8f2; }
.wizard-bar .btn[disabled] { opacity: .45; pointer-events: none; }

/* 方案 B 三段式 */
.imp-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* 方案 C 上下分栏 */
.imp-split { display: flex; flex-direction: column; gap: 14px; }
.imp-split .imp-text { min-height: 200px; }

.imp-result { margin-bottom: 16px; }
.imp-result .card-head { align-items: center; }
@media (max-width: 1180px) {
  .imp-grid3 { grid-template-columns: 1fr; }
}
