/* BillionMail 多租户邮箱管理面板 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6f9;
  color: #2c3e50;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container { max-width: 1100px; width: 100%; margin: 0 auto; padding: 24px 16px; flex: 1; }
h1 { font-size: 22px; margin-bottom: 16px; }
h2 { font-size: 16px; margin: 20px 0 10px; }
h3 { font-size: 16px; margin-bottom: 12px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: #8a94a6; }
.accent { color: #2563eb; }

/* 顶部导航 */
.topnav { background: #1e293b; color: #fff; }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 15px; }
.nav-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav-links a { color: #cbd5e1; }
.nav-links a.active, .nav-links a:hover { color: #fff; text-decoration: none; }
.nav-user { color: #94a3b8; font-size: 12px; padding: 2px 10px; background: #334155; border-radius: 10px; }

/* 提醒条 */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* 卡片 */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; margin-bottom: 18px; }
.card.slim { max-width: 420px; }
.card summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; color: #1e293b; }

/* 表单 */
label { display: block; font-size: 12px; color: #64748b; margin: 8px 0 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"] {
  width: 100%; max-width: 320px; padding: 8px 10px; border: 1px solid #cbd5e1;
  border-radius: 6px; font-size: 14px; background: #fff;
}
input:focus { outline: 2px solid #bfdbfe; border-color: #2563eb; }
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.inline-form input { margin-bottom: 0; }
.inline-form label { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.vform input { max-width: 100%; }
.input-group { display: flex; gap: 6px; align-items: stretch; }
.input-group input { flex: 1; max-width: none; }
.suffix { display: flex; align-items: center; color: #64748b; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 10px; }
.align-end { display: flex; align-items: flex-end; padding-bottom: 2px; }
.searchbar { display: flex; gap: 8px; margin: 14px 0; }
.searchbar input { max-width: 260px; }
.readonly { background: #f1f5f9 !important; }
.dompick { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.cklabel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #334155; }
.cklabel input { width: auto; }

/* 按钮 */
.btn {
  display: inline-block; padding: 8px 14px; border: 1px solid #cbd5e1; border-radius: 6px;
  background: #fff; color: #334155; font-size: 13px; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 14px; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); margin-top: 12px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef2f7; font-size: 13px; }
.tbl th { background: #f8fafc; color: #64748b; font-weight: 600; font-size: 12px; }
.tbl tr:hover td { background: #f8fafc; }
.tbl-actions { margin-top: 12px; }
.empty { text-align: center; color: #94a3b8; padding: 24px !important; }
.ops { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.ops form { display: inline; }

/* 统计卡 */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 18px 26px; min-width: 150px; }
.stat-num { font-size: 28px; font-weight: 700; color: #2563eb; }
.stat-label { font-size: 12px; color: #8a94a6; margin-top: 4px; }

/* 标签 */
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #e0e7ff; color: #3730a3; vertical-align: middle; }
.tag-ok { background: #dcfce7; color: #166534; }
.tag-warn { background: #fef3c7; color: #92400e; }

/* 分页 */
.pager { margin-top: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.pager a { padding: 5px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; color: #334155; background: #fff; text-decoration: none; }
.pager a.cur { background: #2563eb; color: #fff; border-color: #2563eb; }
.pager a.dis { color: #cbd5e1; cursor: default; }
.pg-dots { color: #94a3b8; padding: 0 2px; }
.pg-size { padding: 5px 6px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; background: #fff; color: #334155; margin-left: 8px; max-width: 100px; }
.pg-jump { color: #64748b; margin-left: 6px; }
.pg-jump input { width: 58px; padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; text-align: center; margin: 0 3px; }
.pg-total { color: #64748b; margin-left: 8px; }

/* 弹窗 */
dialog {
  border: none; border-radius: 12px; padding: 22px; width: min(420px, 92vw);
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  /* 全局 *{margin:0} 会干掉 UA 的 margin:auto 居中，这里显式补回 */
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; margin: auto;
  max-height: 90vh; overflow: auto;
}
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog input { max-width: 100%; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* 登录页 */
.login-box {
  max-width: 360px; margin: 12vh auto 0; background: #fff; padding: 32px;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.login-box h2 { margin-bottom: 20px; text-align: center; }
.login-box input { max-width: 100%; }

/* 页脚 */
.footer { text-align: center; color: #94a3b8; font-size: 12px; padding: 18px; }

.hint { font-size: 12px; color: #8a94a6; margin-top: 8px; }

/* ---------- 邮箱密码列 ---------- */
.pwbar { display: flex; align-items: center; gap: 12px; margin: 12px 0 2px; font-size: 12px; flex-wrap: wrap; }
.pwbar .pw-export { display: inline-flex; margin: 0; }
.btn-export { border-color: #2563eb; color: #2563eb; }
.btn-export:hover { background: #eff6ff; }
.pwcell { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.btn-quota { border-color: #7c3aed; color: #7c3aed; }
.btn-quota:hover { background: #f5f3ff; }
.btn-quota:disabled { opacity: .5; cursor: default; }
.pwbox { display: inline-flex; align-items: center; gap: 4px; }
.pwval {
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  font-size: 12px; letter-spacing: .5px;
  background: #f1f5f9; color: #334155;
  border-radius: 5px; padding: 3px 8px;
  min-width: 88px; display: inline-block; text-align: center;
  user-select: all; cursor: text;
}
.pwval[data-show="1"] { background: #ecfdf5; color: #065f46; user-select: text; }
.pwbtn {
  border: 1px solid #cbd5e1; background: #fff; border-radius: 5px;
  cursor: pointer; padding: 3px 6px; font-size: 12px; line-height: 1.2;
}
.pwbtn:hover { background: #f1f5f9; }
.pwbtn:disabled { opacity: .45; cursor: default; }

#bm-toast {
  position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 9999; opacity: 0; transition: opacity .18s;
  pointer-events: none; max-width: 80vw;
}
#bm-toast.on { opacity: .96; }
#bm-toast.err { background: #b91c1c; }

/* ---------- 批量创建 / 批量结果 ---------- */
.tabs2 { display: block; }
.tabs2 > .card:last-child { margin-bottom: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 16px; }
.grid3 select { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; background: #fff; color: #1e293b; }
.bt-preview { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; font-size: 12px; }
.bt-preview code { background: #f1f5f9; padding: 4px 10px; border-radius: 6px; color: #0f766e; font-size: 13px; }

.batch-result { border-color: #bbf7d0; background: #f6fef9; }
.br-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.br-acts { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
.tbl-sm th, .tbl-sm td { padding: 6px 10px; font-size: 12px; }
.batch-result .tbl { margin-top: 0; }

/* ---------- 登录信息弹窗 ---------- */
dialog:has(.li-dlg) { width: min(560px, 94vw); }
.li-dlg h3 { margin-bottom: 4px; }
.li-pre {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  max-height: 50vh; overflow: auto; margin: 0;
}
