/* ==========================================================================
   林默邮箱 · 管理后台样式
   纯自包含，无外部字体 / CDN 依赖；视觉语言与 Tailwind 实用类风格保持一致
   （卡片、圆角、间距刻度、状态色），便于后续迁移或复用。
   ========================================================================== */
:root {
  --bg: #f4f6fb;
  --side: #111a2e;
  --side-soft: #1b2740;
  --card: #ffffff;
  --text: #1c2537;
  --muted: #6b7690;
  --line: #e6eaf2;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --ok: #16a34a;
  --ok-soft: #e8f7ed;
  --err: #dc2626;
  --err-soft: #fdeaea;
  --warn: #d97706;
  --warn-soft: #fff4e5;
  --radius: 14px;
  --shadow: 0 2px 6px rgba(18, 30, 60, .04), 0 12px 30px rgba(18, 30, 60, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button, input, select { font-family: inherit; font-size: inherit; }
h1, h2, h3, p { margin: 0; }

/* ------------------------------ 通用组件 ------------------------------ */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background .16s, border-color .16s, transform .1s, box-shadow .16s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .22); }
.btn-primary:hover { background: #4338ca; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--line); }
.btn-outline:hover { border-color: #c9d1e4; background: #fafbff; }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #dbe3f5; border-color: rgba(255, 255, 255, .14); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.input {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.select { min-width: 130px; cursor: pointer; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-note { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  background: #eef1f7; color: var(--muted); white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.kv-list { display: grid; gap: 2px; }
.kv {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ------------------------------ 登录页 ------------------------------ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1000px 600px at 15% 10%, #26356a 0%, transparent 60%),
              radial-gradient(900px 700px at 90% 90%, #3b2a6b 0%, transparent 55%),
              #0d1526;
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 18px; padding: 34px 32px 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
.login-brand, .side-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-weight: 800; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.35; }
.brand-txt strong { font-size: 16px; }
.brand-txt span { font-size: 12px; color: var(--muted); }
.login-lead { color: var(--muted); font-size: 13px; margin: 18px 0 24px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; font-weight: 650; color: #46516a; margin-bottom: 6px; }
.field input { width: 100%; }
.login-error { min-height: 20px; color: var(--err); font-size: 12px; margin: -4px 0 8px; }
.login-foot { text-align: center; color: #9aa4ba; font-size: 11px; margin-top: 22px; }

/* ------------------------------ 主布局 ------------------------------ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--side); color: #c9d3ea;
  display: flex; flex-direction: column; padding: 24px 16px 18px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 0 8px 26px; }
.side-brand .brand-txt strong { color: #fff; }
.side-brand .brand-txt span { color: #8493b5; }
.side-nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; color: #aebbd6; border: none; border-radius: 9px;
  padding: 11px 12px; cursor: pointer; text-align: left; font-weight: 550;
  transition: background .16s, color .16s;
}
.nav-item:hover { background: var(--side-soft); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, .3); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot-b { background: #60a5fa; } .dot-g { background: #34d399; }
.dot-y { background: #fbbf24; } .dot-p { background: #c084fc; }
.nav-item.active .dot { background: #fff; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .09); padding: 16px 4px 0; }
.who { display: flex; flex-direction: column; margin-bottom: 12px; padding: 0 4px; }
.who-label { font-size: 11px; color: #8493b5; }
.who strong { font-size: 14px; color: #fff; }

.content { flex: 1; min-width: 0; padding: 26px 30px 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; font-weight: 750; }
.page-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.stamp { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.panel { display: none; }
.panel.active { display: block; }

/* ------------------------------ 概览 ------------------------------ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.kpi .k-label { color: var(--muted); font-size: 12px; }
.kpi .k-value { font-size: 27px; font-weight: 750; letter-spacing: -.5px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .k-note { font-size: 11px; color: var(--muted); }
.kpi.accent .k-value { color: var(--accent); }
.two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.two-col > .card { margin-bottom: 18px; }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ellip { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
tr.clickable { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 26px 0; }

/* ------------------------------ 查询 / 服务卡片 ------------------------------ */
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row .input:first-child { flex: 1; min-width: 220px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.svc {
  border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; background: #fcfdff;
}
.svc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.svc-name { font-weight: 650; font-size: 13px; }
.svc-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding: 3px 0; }
.svc-meta strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ------------------------------ 弹层 ------------------------------ */
.modal { position: fixed; inset: 0; background: rgba(12, 20, 38, .55); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal-card { background: #fff; border-radius: 16px; width: min(760px, 100%); max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.icon-btn { background: transparent; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 6px; }
.icon-btn:hover { color: var(--text); }
.detail-body { margin: 0; padding: 20px 24px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.75; color: #33405a; }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 14px 16px; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
  .side-brand { padding: 0; }
  .side-nav { display: flex; gap: 6px; overflow-x: auto; flex: 1; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .side-foot { margin: 0; border: none; padding: 0; display: flex; align-items: center; gap: 10px; }
  .who { display: none; }
  .side-foot .btn { width: auto; padding: 7px 12px; }
  .content { padding: 20px 16px 32px; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar h1 { font-size: 19px; }
  .card { padding: 16px; }
}
