/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e5e8ef;
  --text: #1f2430;
  --muted: #8a91a3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: #111827; color: #e5e7eb;
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 4px 10px 18px; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: none; border: none; border-radius: 8px; color: #9ca3af; font-size: 14px;
  text-align: left;
}
.nav-btn:hover { background: rgba(255, 255, 255, .06); color: #f9fafb; }
.nav-btn.active { background: var(--primary); color: #fff; }
.logout-btn {
  background: none; border: 1px solid rgba(255, 255, 255, .15); color: #9ca3af;
  border-radius: 8px; padding: 8px; font-size: 13px;
}
.logout-btn:hover { color: #f9fafb; border-color: rgba(255, 255, 255, .35); }
.content { flex: 1; padding: 28px 32px; max-width: 1200px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%, #eff6ff 100%); padding: 20px;
}
.login-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 40px 36px; width: 360px; text-align: center; }
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 20px; margin: 12px 0 4px; }
.login-sub { color: var(--muted); margin-bottom: 22px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 4px; }
.login-tip { color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ============ 表单元素 ============ */
.input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text); outline: none; min-width: 0;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 14px;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.block { width: 100%; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.icon-btn { background: none; border: none; border-radius: 6px; padding: 4px 6px; font-size: 14px; }
.icon-btn:hover { background: #eef0f5; }
.icon-btn.danger:hover { background: #fee2e2; }

/* ============ 工具栏 ============ */
.toolbar { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 220px; }

/* ============ 仪表盘 ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.stat-icon { font-size: 26px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-card.hot .stat-value { color: var(--danger); }
.stat-card.warm .stat-value { color: #ea580c; }
.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.banner-red { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.banner-orange { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* ============ 面板与表格 ============ */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.panel h2 { margin-bottom: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #f8fafc; }
.note-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 36px 0; }
.empty.sm { padding: 14px 0; font-size: 13px; }

/* ============ 邮箱卡片 ============ */
.email-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px;
}
.email-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.email-addr { font-size: 15px; font-weight: 600; word-break: break-all; }
.email-note { color: var(--muted); font-size: 12.5px; margin-left: 10px; }
.email-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-tbl { margin-top: 6px; }

/* ============ 标签 ============ */
.st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-expired { background: #fee2e2; color: #b91c1c; }
.st-soon7 { background: #ffedd5; color: #c2410c; }
.st-soon30 { background: #fef9c3; color: #a16207; }
.st-ok { background: #dcfce7; color: #15803d; }
.tp { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tp-grok { background: #1f2430; color: #fff; }
.tp-vpn { background: #dbeafe; color: #1d4ed8; }
.tp-other { background: #eef0f5; color: #4b5563; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px; width: 420px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal h3 { font-size: 16px; margin-bottom: 6px; }
.fld { display: block; font-size: 13px; color: #4b5563; margin: 12px 0 6px; }
.modal .input { width: 100%; }
.modal-ops { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.confirm-msg { color: #4b5563; line-height: 1.7; margin-top: 4px; }
.type-pick { display: flex; gap: 8px; margin-bottom: 8px; }
.chip { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 13px; }
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* ============ 提示 ============ */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  background: #111827; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ============ 响应式 ============ */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; }
  .nav { flex-direction: row; }
  .brand { padding: 0 8px 0 0; }
  .brand span { display: none; }
  .logout-btn { margin-left: auto; }
  .content { padding: 16px; }
  .note-cell { display: none; }
}
