body{font-family:Arial;margin:14px;background:#fafafa;}
.card{background:#fff;border:1px solid #e6e6e6;border-radius:10px;padding:14px;margin-bottom:12px;}
input,select,button,textarea{padding:8px;border:1px solid #ddd;border-radius:8px;}
button{cursor:pointer;background:#1677ff;color:#fff;border:0;}
button.gray{background:#777;}
a{color:#1677ff;text-decoration:none;}
.topbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.badge{padding:6px 10px;border:1px solid #ddd;border-radius:999px;background:#fff;}
.table{width:100%;border-collapse:collapse;background:#fff;}
.table th,.table td{border:1px solid #eee;padding:8px;font-size:13px;}
.table th{background:#f5f5f5;}
.red{background:#ff0000;}
.small{font-size:12px;color:#666;}

/* ========= index.php 顶部导航样式（新增） ========= */
.nav-link{
  display:inline-block;
  padding:6px 10px;
  border-radius:8px;
  text-decoration:none;
}
.nav-link.active{
  background:#f2f4f7;
  font-weight:700;
}

/* 顶部统计区 */
.zz-stats{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  font-size:15px;
  color:#333;
}
.zz-stats b{font-size:13px;}

/* 红点 & 数字徽标（异常提醒） */
.dot{
  display:inline-block;
  width:5px;height:5px;
  border-radius:50%;
  background:#e74c3c;
  margin-left:6px;
  vertical-align:middle;
}
.badge{
  display:inline-block;
  min-width:10px;
  height:15px;
  padding:0 6px;
  border-radius:999px;
  font-size:12px;
  line-height:16px;
  background:#e74c3c;
  color:#fff;
  margin-left:6px;
  vertical-align:middle;
  text-align:center;
}

/* ========= 操作按钮（最终版：覆盖全局 button 背景） ========= */
button.op-btn{
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.2;
  margin: 0 2px;
  border-radius: 3px;
  cursor: pointer;
  border: 0;
}

/* 骗子 - 红 */
button.op-btn.cheater{
  background:#e74c3c;
  color:#fff;
}
button.op-btn.cheater:hover{
  background:#c0392b;
}

/* 刷子 - 橙 */
button.op-btn.brusher{
  background:#f39c12;
  color:#fff;
}
button.op-btn.brusher:hover{
  background:#d68910;
}

/* ===============================
   推广在线表 - 顶部统计（修正居中 & 字号）
   =============================== */

.tg-topbar{
  display:flex;
  align-items:center;      /* 整体垂直居中 */
  gap:12px;
  flex-wrap:wrap;
}

/* badge 本身用 flex，保证文字真正居中 */
.tg-topbar .badge{
  display:flex;
  align-items:center;      /* 关键：垂直居中 */
  font-size:14px;          /* 比刚才小一号 */
  padding:6px 10px;
  border-radius:8px;
  line-height:1;           /* 防止撑高 */
}

/* 数字 */
.tg-topbar .badge span{
  font-size:16px;          /* 数字略大即可 */
  font-weight:700;
  margin-left:6px;
  line-height:1;           /* 防止上下偏移 */
}

/* 按钮也对齐 */
.tg-topbar button{
  height:32px;             /* 固定高度，和 badge 对齐 */
  padding:0 12px;
  font-size:13px;
  display:flex;
  align-items:center;
}

/* =========================
   通用登录页（组长 / 推广 通用）
   ========================= */

.login-page{
  margin:0;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:
    radial-gradient(900px 500px at 10% 10%, rgba(22,119,255,.12), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(243,156,18,.10), transparent 60%),
    radial-gradient(900px 500px at 50% 90%, rgba(231,76,60,.10), transparent 60%),
    #f7f8fb;
}

.login-wrap{ width:100%; max-width:420px; }

.login-card{
  border-radius:16px;
  border:1px solid rgba(0,0,0,.06);
  background:rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  box-shadow:0 10px 30px rgba(0,0,0,.08);
  padding:22px 22px 18px;
}

.login-brand{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}

.login-logo{
  width:42px;
  height:42px;
  border-radius:12px;
  object-fit:contain;
  background:#fff;
  box-shadow:0 8px 18px rgba(0,0,0,.08);
}

.login-brand h1{
  font-size:18px;
  margin:0;
  line-height:1.2;
  color:#111;
}
.login-brand p{
  margin:2px 0 0;
  font-size:12px;
  color:#6b7280;
}

.login-hint{
  margin:10px 0 16px;
  font-size:12px;
  color:#6b7280;
}

.login-field{ margin-bottom:12px; }

.login-label{
  font-size:12px;
  color:#374151;
  margin-bottom:6px;
  display:block;
}

.login-input{
  width:100%;
  box-sizing:border-box;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.12);
  font-size:14px;
  outline:none;
}
.login-input:focus{
  border-color:rgba(22,119,255,.55);
  box-shadow:0 0 0 4px rgba(22,119,255,.12);
}

.login-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:8px 0 14px;
  gap:12px;
}

.login-mini{
  font-size:12px;
  color:#6b7280;
  display:flex;
  align-items:center;
  gap:8px;
}
.login-mini input{ transform:translateY(1px); }

.login-btn{
  width:100%;
  border:0;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  color:#fff;
  font-size:14px;
  font-weight:700;
  background:linear-gradient(135deg,#1677ff,#0f62d8);
  box-shadow:0 10px 18px rgba(22,119,255,.18);
}
.login-btn:disabled{
  cursor:not-allowed;
  opacity:.75;
}

.login-footer{
  margin-top:12px;
  display:flex;
  justify-content:space-between;
  font-size:12px;
  color:#9ca3af;
}

.login-kbd{
  font-family:monospace;
  font-size:11px;
  background:#f3f4f6;
  border:1px solid rgba(0,0,0,.08);
  border-radius:6px;
  padding:2px 6px;
}

/* =========================
   通用：顶部固定 + iframe 切换壳（后台/组长/推广通用）
   ========================= */
.app-shell{ height:100vh; display:flex; flex-direction:column; }
.app-top{ position:sticky; top:0; z-index:999; background:#fff; }
.app-main{ flex:1; min-height:0; }
.app-iframe{ width:100%; height:100%; border:0; display:block; }

.app-topbar{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  width:100%;
}

/* 左侧品牌 */
.app-brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.app-brand img{
  width:28px; height:28px; border-radius:10px; object-fit:contain;
  background:#fff; border:1px solid rgba(0,0,0,.06);
}
.app-brand b{ font-size:14px; }

/* 导航 pill */
.app-nav{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.app-nav a{
  text-decoration:none;
  color:#334155;
  font-size:13px;
  padding:8px 12px;
  border-radius:999px;
  background:#f3f4f6;
  border:1px solid rgba(0,0,0,.06);
  transition:.15s;
}
.app-nav a:hover{
  transform: translateY(-1px);
  background:#eef2ff;
  border-color: rgba(99,102,241,.25);
}
.app-nav a.active{
  color:#0f172a;
  background:#6ceaff;
  border-color: rgba(99,102,241,.35);
  box-shadow: 0 8px 18px rgba(0,0,0,.06);
}

/* 右侧区域 */
.app-spacer{ flex:1; }

/* 小分隔（可选） */
.app-sep{
  width:1px; height:22px;
  background: rgba(0,0,0,.08);
  margin:0 6px;
}
/* ========= users 管理页（更好看） ========= */
.u-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width:1000px){ .u-grid{ grid-template-columns:1fr; } }

.u-formrow{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.u-formrow input,
.u-formrow select{
  width:120px;
  height:34px;
  padding:0 10px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
  background:#fff;
}

.u-formrow button{
  height:34px;
  padding:0 14px;
}

.u-hint{ font-size:12px; color:#667085; margin-top:8px; }

.u-tablewrap{ overflow:auto; }
.u-fixed{ table-layout:fixed; width:max-content; min-width:100%; }
.u-fixed th,.u-fixed td{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.u-actions{ display:flex; gap:8px; align-items:center; }
.u-pill{ font-size:12px; padding:4px 10px; border-radius:999px;
  background:#f3f4f6; border:1px solid rgba(0,0,0,.06); color:#111;
}

/* ========= 弹窗 modal ========= */
.modal-mask{
  position:fixed; inset:0;
  background: rgba(15,23,42,.45);
  display:none; align-items:center; justify-content:center;
  padding:18px;
  z-index:2000;
}
.modal{ width:min(520px, 100%); background:#fff; border-radius:14px;
  border:1px solid rgba(0,0,0,.08); box-shadow:0 18px 50px rgba(0,0,0,.18);
}
.modal-hd{ padding:14px 14px 10px; display:flex; align-items:center; gap:10px; }
.modal-hd b{ font-size:14px; }
.modal-hd .x{ margin-left:auto; cursor:pointer; border:0; background:#f3f4f6; border-radius:10px; height:30px; padding:0 10px; }
.modal-bd{ padding:0 14px 14px; }
.modal-grid{ display:grid; grid-template-columns:90px 1fr; gap:10px 10px; align-items:center; }
.modal-grid label{ font-size:12px; color:#667085; }
.modal-grid input,.modal-grid select{
  height:34px; padding:0 10px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px; background:#fff;
  box-sizing:border-box;
}
.modal-ft{ padding:12px 14px 14px; display:flex; gap:10px; justify-content:flex-end; border-top:1px solid rgba(0,0,0,.06); }

/* ================================
 * TG 表格页 · 刷新按钮 loading
 * 仅作用于 #btnRefresh
 * ================================ */
#btnRefresh.loading{
  position: relative;
  padding-right: 34px;
  opacity: .85;
  pointer-events: none; /* 防连点 */
}

#btnRefresh.loading::after{
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(0,0,0,.25);
  border-top-color: rgba(0,0,0,.75);
  border-radius: 50%;
  animation: tg-refresh-spin .8s linear infinite;
}

@keyframes tg-refresh-spin{
  to{ transform: rotate(360deg); }
}

/* ========= 推广表格（#sheet）专用：判断(pd)颜色，不影响其他 ========= */
#sheet .pd-badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:6px;
  font-size:12px;
  font-weight:600;
  line-height:1.4;
  color:#fff;
  white-space:nowrap;
}
#sheet .pd-normal{ background:#9e9e9e; }
#sheet .pd-warning{ background:#f5a623; } /* 可疑 */
#sheet .pd-error{ background:#e53935; }   /* 异常 */

/* ========= 通用：判断(pd)颜色（全站通用） ========= */
.pd-badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:6px;
  font-size:12px;
  font-weight:600;
  line-height:1.4;
  color:#fff;
  white-space:nowrap;
}
.pd-warning{ background:#f5a623; } /* 可疑 */
.pd-error{ background:#e53935; }   /* 异常 */

