/* 上号台 · 全站样式 */

:root {
  --primary: #3563E9;
  --primary-dark: #2a53d4;
  --primary-light: rgba(53, 99, 233, .10);
  --primary-soft: rgba(53, 99, 233, .055);
  --bg: #f4f6fa;
  --surface: #fff;
  --ink: #1a2233;
  --muted: #6b7688;
  --line: #e3e8f0;
  --line-soft: #f0f3f8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(26, 34, 51, .06);
  --ok: #1a9e6a;
  --ok-light: rgba(26, 158, 106, .10);
  --warn: #c8871a;
  --warn-light: rgba(200, 135, 26, .12);
  --danger: #d8443c;
  --danger-light: rgba(216, 68, 60, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  font-size: 14px; transition: all .15s ease; white-space: nowrap;
}
.btn:hover { border-color: #c9d3e5; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c23a33; border-color: #c23a33; }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 0 8px; }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { background: var(--danger-light); }

/* ================= 表单 ================= */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; transition: border-color .15s ease;
}
.input:focus { border-color: var(--primary); outline: none; }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; }
select.input { appearance: none; background-image: none; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.err-text { font-size: 12.5px; color: var(--danger); margin-top: 6px; }

/* ================= 登录/注册 ================= */
.auth-layout { display: flex; min-height: 100vh; }
.auth-brand {
  flex: 0 0 46%; background: linear-gradient(160deg, #2c50c8, #3563E9 55%, #4a7bf0);
  color: #fff; padding: 56px 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-logo { font-size: 20px; font-weight: 700; letter-spacing: .06em; }
.auth-slogan h2 { font-size: 30px; line-height: 1.35; font-weight: 700; margin-bottom: 14px; }
.auth-slogan p { font-size: 13.5px; opacity: .88; }
.auth-points { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.auth-points div { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 9px; }
.auth-points i { width: 5px; height: 5px; border-radius: 50%; background: #fff; display: block; }
.auth-foot { font-size: 12px; opacity: .65; }
.auth-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: #fff; }
.auth-form { width: 320px; }
.auth-form h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.auth-form .sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.auth-form .sub a { font-weight: 500; }

/* ================= 顶栏 ================= */
.topnav {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 24px; display: flex; align-items: center; gap: 28px;
  position: sticky; top: 0; z-index: 50;
}
.topnav .logo { font-size: 15px; font-weight: 700; color: var(--primary); letter-spacing: .04em; }
.topnav .links { display: flex; gap: 22px; font-size: 14px; }
.topnav .links a { color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.topnav .links a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; text-decoration: none; }
.topnav .right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ================= 内容区 ================= */
.page { max-width: 1200px; margin: 0 auto; padding: 22px 24px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h1 { font-size: 19px; font-weight: 600; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; }

/* ================= 筛选 ================= */
.filters {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  margin-bottom: 14px;
}
.filters .flabel { font-size: 12.5px; color: var(--muted); }
.chip {
  height: 27px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; color: var(--muted); transition: all .15s ease;
}
.chip:hover { border-color: #c9d3e5; color: var(--ink); }
.chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.fsep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

/* ================= 统计卡片 ================= */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.stat.sub::before { background: var(--ok); opacity: .65; }
.stat .num { font-size: 26px; font-weight: 700; line-height: 1.15; }
.stat .name { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.stat .extra { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--primary); }

/* ================= 面板 ================= */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel { margin-top: 14px; }
.panel-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600;
}
.panel-head .aside { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.panel-body { padding: 15px 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 16px; background: #f8fafc; color: var(--muted);
  font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfcfe; }
.table .num { font-family: var(--mono); font-size: 12px; }
.table .muted { color: var(--muted); }
.table .nowrap { white-space: nowrap; }
.ops { display: flex; gap: 10px; }

/* ================= 标签 ================= */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--primary-light); color: var(--primary);
}
.tag.gray { background: #eef1f6; color: var(--muted); }
.tag.ok { background: var(--ok-light); color: var(--ok); }
.tag.warn { background: var(--warn-light); color: var(--warn); }
.tag.danger { background: var(--danger-light); color: var(--danger); }

/* ================= 空状态 / 加载 ================= */
.empty { padding: 52px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }

/* ================= 分页 ================= */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.pager .nav { display: flex; gap: 8px; align-items: center; }

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(26, 34, 51, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  width: 460px; max-width: 100%; background: #fff; border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(20, 28, 45, .25); max-height: 90vh; display: flex; flex-direction: column;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 20px; line-height: 1; color: var(--muted); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px 4px; overflow-y: auto; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.warn-box {
  background: var(--warn-light); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12.5px; color: #8a5c0d; margin-bottom: 12px; line-height: 1.7;
}
.danger-box { background: var(--danger-light); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; color: #9c2f29; margin-bottom: 12px; line-height: 1.7; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 10px; }

/* ================= Toast ================= */
#toastBox { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1e2536; color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 999px; box-shadow: 0 8px 22px rgba(20, 28, 45, .24);
  animation: toastIn .2s ease;
}
.toast.ok { background: #14724f; }
.toast.err { background: #a8342d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ================= 后台 ================= */
.admin-layout { display: flex; min-height: 100vh; }
.admin-side {
  flex: 0 0 196px; background: #1e2536; padding: 18px 0;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh;
}
.admin-side .logo { font-size: 14px; font-weight: 700; color: #fff; padding: 0 18px 18px; letter-spacing: .04em; }
.side-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; border: none; background: transparent; color: #98a4bb;
  font-size: 13.5px; padding: 11px 18px; border-left: 3px solid transparent; transition: all .15s ease;
}
.side-item:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.side-item.active { color: #fff; background: rgba(53, 99, 233, .22); border-left-color: var(--primary); font-weight: 600; }
.side-item .badge { background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.admin-side .side-foot { margin-top: auto; padding: 14px 18px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; color: #7d8aa3; }
.admin-side .side-foot .name { color: #fff; font-weight: 600; margin-bottom: 8px; }
.admin-side .side-foot button {
  border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #c3cbd9;
  font-size: 12.5px; padding: 5px 11px; border-radius: 6px;
}
.admin-side .side-foot button:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }
.admin-main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.admin-view { display: none; }
.admin-view.active { display: block; }

/* 配置行 */
.config-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.config-row:last-child { border-bottom: none; }
.config-row .grow { flex: 1; min-width: 0; }
.config-row .count { font-size: 12px; color: var(--muted); }

/* 日志前后对比 */
.diff { font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.7; }
.diff .before { color: var(--danger); text-decoration: line-through; }
.diff .after { color: var(--ok); }
.diff .field { color: var(--muted); }

/* 趋势条 */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.bars .bar { flex: 1; background: var(--primary-light); border-radius: 3px 3px 0 0; position: relative; min-height: 2px; }
.bars .bar.hi { background: var(--primary); }
.bars .bar span {
  position: absolute; top: -16px; left: 0; right: 0; text-align: center;
  font-size: 10px; color: var(--muted); font-family: var(--mono);
}
.bars-x { display: flex; gap: 6px; margin-top: 6px; }
.bars-x div { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

.kv-list { display: flex; flex-direction: column; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13px; border-bottom: 1px dashed var(--line-soft); }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; }

/* ================= 响应式 ================= */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .admin-side { flex: 0 0 148px; }
  .admin-main { padding: 16px 14px 50px; }
}
@media (max-width: 620px) {
  .page { padding: 16px 14px 50px; }
  .topnav { padding: 0 14px; gap: 14px; }
  .topnav .links { gap: 14px; font-size: 13px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .modal { width: 100%; }
}
