/* ============================================================
   畅聊星球 · 管理控制台
   设计语言：纯黑白 / 灰阶，细线、留白、无彩色干扰
   侧栏改为白底，选中项反色成墨黑胶囊
   ============================================================ */
:root {
  --ink: #0a0a0a;
  --ink-2: #1c1c1c;
  --ink-3: #333333;
  --bg: #f4f4f4;
  --card: #ffffff;
  --line: #e5e5e5;
  --line-strong: #d0d0d0;
  --text: #111111;
  --muted: #8a8a8a;
  --soft: #fafafa;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { -webkit-user-drag: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: #ffffff;
  color: #3a3a3a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 40px -34px rgba(0, 0, 0, .45);
}

.sidebar .logo {
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.sidebar .logo-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
}
.sidebar .logo-word {
  font-size: 16px;
  letter-spacing: 2px;
  color: #111111;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar .logo .logo-sub {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding-left: 54px;
  font-size: 9px;
  letter-spacing: 2.2px;
  color: #a8a8a8;
}

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav .group {
  font-size: 10px;
  letter-spacing: 2px;
  color: #a6a6a6;
  padding: 15px 12px 8px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #4d4d4d;
  transition: .16s;
  margin-bottom: 2px;
}
.nav a svg { width: 17px; height: 17px; opacity: .52; flex: 0 0 17px; }
.nav a:hover { background: #f3f3f3; color: #111; }
.nav a:hover svg { opacity: .85; }
.nav a.active {
  background: #0a0a0a;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 8px 18px -12px rgba(0, 0, 0, .9);
}
.nav a.active svg { opacity: 1; }

.sidebar .foot {
  padding: 16px 20px 20px;
  font-size: 11px;
  color: #a2a2a2;
  border-top: 1px solid var(--line);
  letter-spacing: .5px;
  line-height: 1.9;
}
.sidebar .foot b { color: #444444; font-weight: 500; }

/* 窄屏展开时的遮罩：点击空白区收起菜单 */
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, .26);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
  z-index: 15;
}
@media (max-width: 900px) {
  .sidebar.open ~ .sidebar-mask { opacity: 1; visibility: visible; }
}

.main { margin-left: 236px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 68px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 16px; font-weight: 600; letter-spacing: .8px; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #111;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; letter-spacing: .5px;
  overflow: hidden;
  flex: 0 0 34px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content { padding: 28px 32px 52px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}
.card + .card { margin-top: 20px; }
.card-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 14.5px; font-weight: 600; letter-spacing: .5px; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.card-body { padding: 22px; }
.card-body.tight { padding: 0; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat .k { font-size: 11.5px; color: var(--muted); letter-spacing: 1.4px; }
.stat .v { font-size: 30px; font-weight: 300; letter-spacing: -.5px; margin: 10px 0 4px; color: var(--ink); }
.stat .v em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.stat .t { font-size: 11.5px; color: var(--muted); }
.stat .t b { color: var(--ink); font-weight: 600; }

/* ---------- 活跃排行榜（现代商务表格） ---------- */
.rank-kpis { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rank-kpi {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.rank-kpi span { font-size: 10.5px; letter-spacing: 1.1px; color: var(--muted); }
.rank-kpi b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
table.rank-tb th { padding: 11px 22px; }
table.rank-tb td { padding: 12px 22px; }
.rank-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: .5px;
  color: #8f8f8f;
  background: #f5f5f5;
  border: 1px solid #ececec;
}
.rank-no.top1 { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }
.rank-no.top2 { background: #e8e8e8; color: #111; border-color: #dedede; }
.rank-no.top3 { background: #f2efe9; color: #6b5c40; border-color: #e8e3d8; }
.rank-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rank-user .avatar { width: 34px; height: 34px; font-size: 12.5px; flex: 0 0 34px; }
.rank-user .meta { min-width: 0; }
.rank-user .nm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.rank-user .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: .3px;
  white-space: nowrap;
}
.rank-bar-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.rank-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #f0f0f0;
  overflow: hidden;
  min-width: 70px;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #4a4a4a, #0a0a0a);
}
.rank-bar i.low { background: linear-gradient(90deg, #d2d2d2, #b0b0b0); }
.rank-pct {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 36px;
  text-align: right;
  flex: 0 0 auto;
}
.rank-val {
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.rank-val em {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: .2px;
}
.rank-when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rank-when.live { color: var(--ink); }
.rank-when.live .dot { margin-right: 5px; vertical-align: 1px; }
@media (max-width: 860px) {
  .rank-bar-cell { min-width: 90px; }
  table.rank-tb th, table.rank-tb td { padding-left: 14px; padding-right: 14px; }
  table.rank-tb th:nth-child(3), table.rank-tb td:nth-child(3),
  table.rank-tb th:nth-child(5), table.rank-tb td:nth-child(5) { display: none; }
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 12px 22px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tb td { padding: 15px 22px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
table.tb tbody tr:hover { background: #fbfbfb; }
table.tb tbody tr:last-child td { border-bottom: none; }
.u-cell { display: flex; align-items: center; gap: 12px; }
.u-cell .avatar { width: 36px; height: 36px; font-size: 13px; flex: 0 0 36px; }
.u-cell b { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; font-weight: 500; font-size: 13.5px; }
.u-cell span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- 徽章 / 状态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 20px;
  background: #f2f2f2; color: #555;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.on { background: #111; color: #fff; }
.badge.off { background: #fff; color: #9a9a9a; border-color: #dedede; }
.badge.gold { background: #111; color: #fff; }
.badge.blue { background: #fff; color: #333; border-color: #d5d5d5; }
.badge.warn { background: #fff; color: #444; border-color: #bfbfbf; border-style: dashed; }
.badge.err { background: #111; color: #fff; }
.badge.ghost { background: transparent; border-color: #dcdcdc; color: #777; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 18px;
  border-radius: 8px; border: 1px solid transparent;
  background: #0a0a0a; color: #fff;
  font-size: 13px; letter-spacing: .5px; cursor: pointer;
  transition: .16s; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: #2a2a2a; }
.btn.gold { background: #0a0a0a; color: #fff; }
.btn.gold:hover { background: #2a2a2a; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: #111; background: #fff; }
.btn.danger { background: #fff; color: #111; border-color: #111; }
.btn.danger:hover { background: #111; color: #fff; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
.field { margin-bottom: 18px; }
.field.full { grid-column: 1 / -1; }
.field label {
  display: block; font-size: 12px; color: #4a4a4a;
  margin-bottom: 8px; letter-spacing: .3px;
}
.field .desc { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], select, textarea {
  width: 100%; height: 42px;
  border: 1px solid #dcdcdc; border-radius: 8px;
  padding: 0 13px; font-size: 13.5px; color: var(--text);
  background: #fbfbfb; outline: none; transition: .16s;
  font-family: inherit;
}
textarea { height: auto; min-height: 92px; padding: 11px 13px; line-height: 1.7; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: #111; background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}
input::placeholder, textarea::placeholder { color: #b4b4b4; }
input[type=file] {
  width: 100%; height: auto; padding: 11px 13px;
  background: #fbfbfb; border: 1px dashed #cfcfcf; border-radius: 8px;
  font-size: 12.5px; color: #555;
}
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 8px; }

/* 自定义勾选 */
.check {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.check input { width: 16px; height: 16px; accent-color: #000; }

/* 开关 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px dashed #eee; gap: 20px;
}
.switch-row:last-child { border-bottom: none; }
.switch-row .txt b { font-size: 13.5px; font-weight: 500; display: block; }
.switch-row .txt span { font-size: 12px; color: var(--muted); display: block; margin-top: 4px; line-height: 1.6; }
.switch {
  width: 50px; height: 28px; border-radius: 20px; border: none;
  background: #d8d8d8; position: relative; cursor: pointer; flex: 0 0 50px;
  transition: .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .24); transition: .2s;
}
.switch.on { background: #0a0a0a; }
.switch.on::after { left: 25px; }
.switch.busy { opacity: .6; cursor: wait; }

/* ---------- 筛选条 ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { height: 38px; width: auto; min-width: 130px; }
.filters input[type=text] { min-width: 220px; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; align-items: center; padding: 18px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px; height: 32px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 12.5px; color: #5b5b5b;
  border: 1px solid transparent;
}
.pager a:hover { background: #f2f2f2; }
.pager .cur { background: #0a0a0a; color: #fff; }
.pager .info { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- 提示 ---------- */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 8px; font-size: 13px;
  background: #fff; color: #111; border: 1px solid #111;
  margin-bottom: 20px;
}
.flash.error { background: #111; color: #fff; border-color: #111; }
.alert { background: #fafafa; border: 1px dashed #cfcfcf; color: #555; padding: 13px 16px; border-radius: 8px; font-size: 12.5px; line-height: 1.9; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- 日志级别 ---------- */
.lv { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.lv.info { color: #777; }
.lv.warning { color: #111; }
.lv.error { color: #fff; background: #111; padding: 2px 6px; border-radius: 4px; }
.lv.debug { color: #999; }

/* ---------- 媒体缩略图 / 图片预览 ---------- */
.thumb {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: cover; background: #f0f0f0; display: block;
  border: 1px solid var(--line);
}
.thumb.lg { width: 72px; height: 72px; border-radius: 12px; }
.thumb.room { border-radius: 10px; }
.logo-preview {
  width: 88px; height: 88px; object-fit: contain;
  border: 1px solid var(--line); border-radius: 14px;
  background: #fafafa; padding: 8px; display: block;
}
.img-strip { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.img-item { position: relative; }
.img-item .cap { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }

/* ---------- 双栏 ---------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .cols, .cols-3 { grid-template-columns: 1fr; } }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0a0a0a;
  background-image:
    radial-gradient(900px 500px at 15% -10%, #262626 0%, #0a0a0a 62%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 1px, transparent 1px 64px);
  padding: 30px 16px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 16px;
  padding: 42px 38px 34px;
  border: 1px solid #222;
  box-shadow: 0 40px 90px -24px rgba(0, 0, 0, .9);
}
.login-card .brand { text-align: center; margin-bottom: 30px; }
.login-logo { width: 72px; height: 72px; object-fit: contain; margin: 0 auto 12px; display: block; filter: grayscale(1) contrast(1.1); }
.login-card .brand b { display: block; font-size: 19px; letter-spacing: 6px; color: #0a0a0a; font-weight: 600; }
.login-card .brand span { display: block; font-size: 10px; letter-spacing: 2.8px; color: #8a8a8a; margin-top: 8px; }
.login-card .field label { font-size: 12px; }
.login-card .btn { width: 100%; height: 44px; margin-top: 6px; letter-spacing: 2px; }
.login-foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 26px; letter-spacing: .4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  table.tb th, table.tb td { padding: 12px 14px; }
}
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: #0a0a0a; }
@media (max-width: 900px) { .menu-toggle { display: block; } }

/* 分页/滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5d5d5; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* 认证徽章 */
.vbadge { width: 15px; height: 15px; object-fit: contain; vertical-align: -2px; flex: 0 0 15px; }
.vbadge.lg { width: 20px; height: 20px; vertical-align: -4px; flex: 0 0 20px; }

