/* 微信群消息监控 - 前端样式（用户页与 admin 页共用，纯原生无外部依赖） */
:root {
  --primary: #3b74ff;
  --primary-dark: #2e5fe8;
  --primary-bg: #eef4ff;
  --danger: #e5484d;
  --danger-bg: #fdebec;
  --ok: #1a9e42;
  --ok-bg: #e9f9ef;
  --warn: #b58900;
  --warn-bg: #fdf6e3;
  --muted: #8b949e;
  --text: #24292f;
  --border: #e5e7eb;
  --bg: #f5f6fa;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 16px; font-weight: 700; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 8px;
  font-family: inherit;
  transition: all .15s;
}
.tab:hover:not(:disabled):not(.active) { color: var(--text); background: #f3f4f6; }
.tab.active { color: var(--primary); background: var(--primary-bg); font-weight: 600; }
.tab:disabled { opacity: .45; cursor: not-allowed; }
.topbar-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.expiry { color: var(--muted); font-size: 13px; }

/* ---------- 布局 ---------- */
.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px 48px; }
.container.narrow { max-width: 760px; }
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card h3 { font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.7; }
.center-card { max-width: 420px; margin: 8vh auto 0; }

/* ---------- 表单 ---------- */
input:not([type]), input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border .15s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 116, 255, .12); }
input:disabled, select:disabled { background: #f6f8fa; color: var(--muted); cursor: not-allowed; }
.form-row { margin: 14px 0; }

/* ---------- 按钮 ---------- */
button { font-family: inherit; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 14px;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #a8c1ff; cursor: not-allowed; }
.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  transition: all .15s;
}
.btn-ghost:hover { border-color: #cbd2dc; background: #f7f8fa; }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-del {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 8px;
  border-radius: 6px;
}
.btn-del:hover { background: var(--danger-bg); }

/* ---------- 消息提示 ---------- */
.msg { font-size: 13px; min-height: 18px; margin-top: 10px; word-break: break-all; }
.msg.ok { color: var(--ok); }
.msg.error { color: var(--danger); }

/* ---------- 配置视图 ---------- */
.add-bar { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.add-bar label { font-size: 13px; color: var(--muted); }
.add-bar select { width: auto; min-width: 260px; flex: 0 1 auto; }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.actions .msg { margin-top: 0; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
table.grid th { color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
table.grid td.center, table.grid th.center { text-align: center; }
table.grid input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }
td.cell-actions { width: 44px; }
.nowrap { white-space: nowrap; }

.push-meta { font-size: 13px; line-height: 2; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.error { background: var(--danger-bg); color: var(--danger); }
.tag.info { background: var(--primary-bg); color: var(--primary); }

/* ---------- 推送记录 ---------- */
.logs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.content-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; color: var(--muted); padding: 36px 0; font-size: 13px; }

/* ---------- admin 页 ---------- */
.stat-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.admin-login-row { display: flex; gap: 10px; margin-top: 14px; }
.admin-login-row input { flex: 1; }
.token-label { font-family: Consolas, Menlo, monospace; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 12px; }
  .brand { font-size: 14px; }
  .expiry { display: none; }
  .card { padding: 14px; }
}
