/* 中性管理后台样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #eef2fb;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ── 登录页 ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2fb 0%, #dfe7f8 100%);
}
.login-card {
  width: 360px; background: #fff; border-radius: 16px; padding: 40px 36px 32px;
  box-shadow: 0 16px 48px rgba(27, 95, 224, 0.14);
}
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .sub { font-size: 13px; color: #8a93a4; text-align: center; margin-bottom: 24px; }

/* ── 通用 ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #5b6472; margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; padding: 0 12px; font-size: 14px;
  border: 1px solid #d4dae6; border-radius: 8px; outline: none;
}
.field input:focus { border-color: #1B5FE0; }
.btn {
  width: 100%; height: 44px; border: none; border-radius: 8px;
  background: #1B5FE0; color: #fff; font-size: 15px; font-weight: 600;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.sm { width: auto; height: 36px; padding: 0 18px; font-size: 14px; }
.btn.gray { background: #6b7280; }
.btn.danger { background: #dc2626; }
.err { color: #dc2626; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ── 主框架 ── */
.topbar {
  height: 56px; background: #fff; display: flex; align-items: center;
  padding: 0 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: #5b6472; margin-right: 14px; }
.topbar .tabs { display: flex; gap: 4px; }
.topbar .tabs a {
  display: inline-block; padding: 6px 16px; font-size: 14px; color: #5b6472;
  cursor: pointer; border-radius: 6px;
}
.topbar .tabs a:hover { background: #f1f4fa; }
.topbar .tabs a.active { background: #1B5FE0; color: #fff; font-weight: 600; }
.logout {
  background: none; border: 1px solid #d4dae6; border-radius: 6px;
  padding: 6px 14px; font-size: 13px; color: #5b6472;
}
.main { max-width: 1080px; margin: 28px auto; padding: 0 20px; }

.panel {
  background: #fff; border-radius: 12px; padding: 22px 24px; margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(27,95,224,.06);
}
.panel h2 { font-size: 15px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.panel h2 .spacer { flex: 1; }
.panel h3 { font-size: 13px; color: #5b6472; margin-bottom: 10px; }

/* IP 卡 */
.ip-box { background: #f6f8fc; border-radius: 8px; padding: 14px 16px; margin-bottom: 8px; }
.ip-main { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ip-main .dot { width: 8px; height: 8px; border-radius: 50%; }
.ip-main .dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.ip-main .dot.off { background: #c9ced8; }
.ip-state { font-size: 13px; color: #5b6472; }
.ip-flag {
  background: #dbeafe; color: #1d4ed8; padding: 1px 8px; border-radius: 10px;
  font-size: 11px;
}
.ip-addr {
  font-size: 22px; font-weight: 700; color: #1B5FE0;
  font-family: Consolas, monospace; letter-spacing: 1px;
}
code {
  font-family: Consolas, monospace; background: #f1f4fa; padding: 1px 6px;
  border-radius: 4px; font-size: 12px;
}

/* 搜索行 */
.search-row { display: flex; gap: 10px; }
.search-row input {
  flex: 1; height: 42px; padding: 0 12px; font-size: 14px;
  border: 1px solid #d4dae6; border-radius: 8px; outline: none;
}
.search-row input:focus { border-color: #1B5FE0; }

/* 搜索结果下拉 */
.search-results {
  margin-top: 10px; border: 1px solid #d4dae6; border-radius: 8px;
  max-height: 360px; overflow-y: auto; background: #fff;
}
.search-results-title {
  padding: 8px 14px; font-size: 12px; color: #5b6472;
  background: #f6f8fc; border-bottom: 1px solid #ecedf1;
}
.search-result-item {
  padding: 10px 14px; border-bottom: 1px solid #f4f5f8; cursor: pointer;
  transition: background 0.12s;
}
.search-result-item:last-child { border-bottom: 0; }
.search-result-item:hover { background: #eef3fd; }
.sr-main {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px;
}
.sr-nick { font-weight: 600; color: #1f2937; }
.sr-uid {
  font-family: Consolas, monospace; font-size: 12px; color: #1B5FE0;
  background: #eef3fd; padding: 1px 8px; border-radius: 4px;
}
.sr-sub { font-size: 12px; color: #8a93a4; margin-top: 4px; }

/* 账户卡 */
.acct-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 4px; }
.acct-item { background: #f6f8fc; border-radius: 8px; padding: 14px 16px; }
.acct-item .k { font-size: 12px; color: #8a93a4; margin-bottom: 6px; }
.acct-item .v { font-size: 18px; font-weight: 700; }
.acct-item .v.money { color: #1B5FE0; }
.acct-meta { font-size: 12px; color: #8a93a4; margin-top: 10px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge.ok { background: #dcfce7; color: #16a34a; }
.badge.frozen { background: #fef3c7; color: #b45309; }
.badge.gray { background: #f1f4fa; color: #5b6472; }

/* 调整表单 */
.adjust-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.adjust-row .field { margin-bottom: 0; }
.seg { display: flex; border: 1px solid #d4dae6; border-radius: 8px; overflow: hidden; }
.seg button {
  border: none; background: #fff; padding: 0 18px; height: 42px; font-size: 14px; color: #5b6472;
}
.seg button.active-add { background: #16a34a; color: #fff; }
.seg button.active-sub { background: #dc2626; color: #fff; }

/* 流水表 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #eef0f4; }
th { color: #8a93a4; font-weight: 600; }
td.add { color: #16a34a; font-weight: 600; }
td.sub { color: #dc2626; font-weight: 600; }
.empty { text-align: center; color: #aab2c0; padding: 28px 0; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; }
.pager button {
  border: 1px solid #d4dae6; background: #fff; border-radius: 6px;
  padding: 5px 12px; font-size: 13px;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ── 全员余额统计 ──────────────────────────────────────── */
.balance-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.balance-head h2 { margin-bottom: 4px; }
.balance-note { margin: 0 0 16px; color: #8a93a4; font-size: 12px; }
.balance-cards {
  display: grid; grid-template-columns: repeat(6, minmax(135px, 1fr)); gap: 10px;
  margin: 4px 0 18px;
}
.balance-card {
  min-width: 0; padding: 14px 15px; border: 1px solid #e2e8f2;
  border-radius: 10px; background: #f8faff;
}
.balance-card.money-card { background: #eff6ff; border-color: #bfdbfe; }
.balance-num {
  color: #1f2937; font-size: 20px; font-weight: 700; line-height: 1.35;
  overflow-wrap: anywhere;
}
.balance-num.available { color: #15803d; }
.balance-num.frozen { color: #b45309; }
.balance-num.pending { color: #c2410c; }
.balance-label { margin-top: 5px; color: #6b7280; font-size: 12px; }
.balance-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; color: #7c8596; font-size: 12px;
}
.balance-toolbar input {
  width: 280px; max-width: 50%; height: 34px; box-sizing: border-box;
  padding: 0 10px; border: 1px solid #d7deea; border-radius: 6px;
}
.balance-total-cell { color: #1d4ed8; font-weight: 700; }
.table-scroll { width: 100%; overflow-x: auto; }

.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 10px 22px; border-radius: 8px;
  font-size: 14px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.ok { background: #16a34a; }
.toast.err { background: #dc2626; }

/* ── 账户管理对话框 ────────────────────────────────────── */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-card {
  background: #fff; padding: 24px 28px; border-radius: 10px;
  width: 480px; max-width: 92vw; max-height: 86vh; overflow: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
}
.modal-card h3 { margin: 0 0 16px 0; font-size: 18px; }
.modal-card h4 { font-size: 14px; color: #4b5563; }
.form-row {
  display: flex; align-items: center; margin-bottom: 10px;
}
.form-row label {
  width: 96px; flex-shrink: 0; color: #6b7280; font-size: 13px;
}
.form-row input {
  flex: 1; height: 32px; padding: 0 10px;
  border: 1px solid #d6dbe3; border-radius: 4px; font-size: 14px;
}

/* ── 客户端版本 tab ── */
.tm-cards { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.tm-card {
  flex: 1; min-width: 130px; padding: 14px 16px;
  background: #f5f8ff; border: 1px solid #e2e9f7; border-radius: 10px;
}
/* 有问题的卡片才变红 —— 全绿时不该有任何视觉噪音 */
.tm-card.bad { background: #fef2f2; border-color: #fecaca; }
.tm-num { font-size: 26px; font-weight: 700; color: #1B5FE0; line-height: 1.2; }
.tm-card.bad .tm-num { color: #dc2626; }
.tm-lbl { font-size: 12px; color: #6b7280; margin-top: 4px; }

.tm-policy {
  font-size: 13px; color: #4b5563; line-height: 1.7;
  padding: 10px 12px; background: #fafbfd; border-radius: 8px; margin-bottom: 12px;
}
.tm-versions { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: #eef2fb; color: #374151;
}
.tm-chip.bad { background: #fee2e2; color: #b91c1c; }
.tm-chip em { font-style: normal; color: #8a93a4; margin-left: 4px; }

.tm-row-bad { background: #fffaf9; }
.tm-bad-text { color: #dc2626; font-weight: 600; }
.tm-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
}
.tm-tag.bad { background: #fee2e2; color: #b91c1c; }

/* ── 手机工作台 tab ── */
.wb-warning {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 8px;
  background: #fff8e7; border: 1px solid #f7d78a; color: #795b16; font-size: 12px;
}
.wb-grid { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 12px; }
.wb-card { border: 1px solid #e1e6ef; border-radius: 10px; padding: 12px; background: #fff; }
.wb-card-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.wb-card-head code { color: #8a93a4; font-size: 11px; }
.wb-icon {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; color: #fff; font-weight: 700;
}
.wb-switch { margin-left: auto !important; display: flex !important; align-items: center; gap: 4px; }
.wb-switch input { width: auto !important; }
.wb-card > label, .wb-inline label { display: block; color: #5a6478; font-size: 11px; margin: 8px 0 4px; }
.wb-card > input { width: 100%; box-sizing: border-box; }
.wb-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wb-inline input { width: 100%; box-sizing: border-box; }
.wb-inline input[type="color"] { height: 36px; padding: 3px; }
.wb-sensitive { color: #b45309; font-size: 11px; margin: 9px 0; }
.wb-card > .btn { margin-top: 10px; width: 100%; }

.mon-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.mon-flag { font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.mon-flag.ok { background: #dcfce7; color: #16a34a; }
.mon-flag.bad { background: #fee2e2; color: #b91c1c; }
.mon-meta { font-size: 12px; color: #8a93a4; margin-left: auto; }

.mon-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.mon-card {
  flex: 1 1 240px; max-width: 340px; padding: 12px 14px;
  background: #f2fbf6; border: 1px solid #d9f2e3; border-radius: 10px;
}
/* 只有出问题的卡片才变红 —— 全绿时不该有任何视觉噪音 */
.mon-card.down { background: #fef2f2; border-color: #fecaca; }
.mon-card-hd { display: flex; align-items: center; gap: 6px; }
.mon-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mon-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.mon-dot.off { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.mon-name { font-size: 14px; font-weight: 600; color: #1f2937; }
.mon-card-bd { font-size: 12px; color: #5a6478; margin-top: 8px; word-break: break-all; }
.mon-card-ft { font-size: 11px; color: #8a93a4; margin-top: 4px; }

/* 延迟分级:低绿 / 中黄 / 高橙。后端没给级别时走 none(中性灰),不臆造好坏 */
.mon-lat {
  margin-left: auto; font-size: 12px; padding: 1px 8px; border-radius: 999px;
  white-space: nowrap; cursor: help;
}
.mon-lat-low  { background: #dcfce7; color: #15803d; }
.mon-lat-mid  { background: #fef3c7; color: #b45309; }
.mon-lat-high { background: #ffedd5; color: #c2410c; }
.mon-lat-none { background: #f1f4fa; color: #5b6472; }

.mon-ev { font-weight: 600; }
.mon-ev.up { color: #16a34a; }
.mon-ev.down { color: #dc2626; }

/* ── 每日新增用户统计 tab ── */
.reg-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.reg-head h2 { margin-bottom: 4px; }
.reg-sub { margin: 0 0 16px; color: #8a93a4; font-size: 12px; }
.reg-cards .tm-card { min-width: 120px; }
.reg-ranges { display: flex; flex-wrap: wrap; gap: 6px; }
.reg-ranges button {
  border: 1px solid #d9e0ec; background: #fff; color: #5b6472;
  border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.reg-ranges button:hover { border-color: #1B5FE0; color: #1B5FE0; }
.reg-ranges button.active { border-color: #1B5FE0; background: #1B5FE0; color: #fff; }
.reg-ranges button:disabled { opacity: .55; cursor: default; }
.reg-chart-scroll {
  width: 100%; overflow-x: auto; padding: 18px 0 4px;
  scrollbar-color: #cbd5e1 transparent;
}
.reg-chart {
  height: 270px; display: flex; align-items: stretch; gap: 5px;
  border-bottom: 1px solid #dfe5ef;
}
.reg-bar-item {
  min-width: 24px; flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
}
.reg-value { height: 18px; color: #5b6472; font-size: 10px; line-height: 18px; }
.reg-track {
  width: 100%; height: 210px; display: flex; align-items: flex-end;
  background: linear-gradient(to top, rgba(226,232,240,.55) 1px, transparent 1px);
  background-size: 100% 25%;
}
.reg-bar {
  width: 100%; min-height: 0; background: linear-gradient(180deg, #4d8cff, #1B5FE0);
  border-radius: 4px 4px 0 0; transition: height .25s ease;
}
.reg-date {
  height: 24px; padding-top: 6px; color: #8a93a4; font-size: 9px;
  white-space: nowrap; transform: rotate(-35deg); transform-origin: center;
}
.reg-note {
  margin-top: 12px; color: #8a93a4; font-size: 12px; text-align: right;
}

@media (max-width: 1100px) {
  .topbar { padding: 0 12px; }
  .topbar .tabs a { padding: 6px 9px; font-size: 13px; }
  .wb-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
  .balance-cards { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 680px) {
  .balance-cards { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .balance-toolbar { align-items: flex-start; flex-direction: column; }
  .balance-toolbar input { width: 100%; max-width: none; }
}
