:root {
  --bg-0: #070b16;
  --bg-1: #0b1020;
  --fg: #e8ecf6;
  --muted: #8891a8;
  --muted-2: #616a82;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.07);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.45);
  --ok: #34d399;
  --pending: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--fg);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(139, 92, 246, 0.12), transparent 60%),
    radial-gradient(1000px 600px at -10% 20%, rgba(99, 102, 241, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 背景光斑 */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-a { width: 420px; height: 420px; background: #4f46e5; top: -120px; right: -80px; animation: float 18s ease-in-out infinite; }
.orb-b { width: 360px; height: 360px; background: #7c3aed; bottom: -140px; left: -60px; animation: float 22s ease-in-out infinite reverse; }
.orb-c { width: 300px; height: 300px; background: #2563eb; top: 40%; left: 55%; opacity: 0.28; animation: float 26s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.08); }
}

/* 玻璃拟态 */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

/* 顶栏 */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 24, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px -6px var(--accent-glow);
}
.brand-mark.lg { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 15px; letter-spacing: 0.2px; }
.brand-text small { font-size: 12px; color: var(--muted); }

.user-area { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.user-area .uname { color: var(--fg); font-weight: 600; }
.user-area .chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--glass-2); border: 1px solid var(--line);
}
.user-area .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

main { position: relative; z-index: 1; padding: 32px 24px 56px; max-width: min(1560px, 95vw); margin: 0 auto; }

/* 登录 */
.login-view { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; padding: 36px 34px; }
.login-head { text-align: center; margin-bottom: 26px; }
.login-head h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.login-head p { margin: 0; font-size: 13px; color: var(--muted); }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 7px; }
input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
  background: rgba(255, 255, 255, 0.05);
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
select { appearance: none; -webkit-appearance: none; cursor: pointer; }
select option { background: #131a2c; color: var(--fg); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: transform 0.12s, box-shadow 0.18s, background 0.18s, border-color 0.18s;
  color: var(--fg);
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -10px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 14px 32px -10px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost { background: var(--glass-2); border-color: var(--line); color: var(--muted); font-weight: 500; padding: 8px 13px; }
.btn-ghost:hover { color: var(--fg); border-color: var(--line-strong); }
.btn-logout {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 7px 13px; font-size: 13px; border-radius: 9px;
}
.btn-logout:hover { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }

.form-msg { font-size: 13px; margin: 12px 0 0; min-height: 18px; }
.form-msg.error { color: var(--bad); }
.form-msg.success { color: var(--ok); }

.card { padding: 24px; }
.card-head { margin-bottom: 18px; }
.card-head h2 { margin: 0 0 4px; font-size: 17px; font-weight: 650; }
.card-sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.policy {
  display: flex; gap: 9px; align-items: flex-start;
  margin-top: 18px; padding: 12px 14px;
  font-size: 12px; line-height: 1.6; color: var(--muted);
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: var(--radius-sm);
}
.policy svg { flex: none; margin-top: 2px; color: var(--accent-2); }

/* 表格 */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; font-weight: 500; font-size: 12px;
  color: var(--muted); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
  background: #0e1524; /* 不透明背景：滚动时行不再从 sticky 表头下透出、避免重叠 */
}
tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }
.cell-id { color: var(--muted-2); font-variant-numeric: tabular-nums; }
.cell-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.prod-tag {
  display: inline-block; padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--fg);
}

/* 状态徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.s-active { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.badge.s-submitted, .badge.s-verifying, .badge.s-provisioning { color: var(--pending); background: rgba(251, 191, 36, 0.12); }
.badge.s-verify_failed, .badge.s-provision_failed { color: var(--bad); background: rgba(248, 113, 113, 0.12); }
.badge.s-expired { color: var(--muted); background: rgba(148, 163, 184, 0.12); }
.badge.s-removed { color: var(--muted-2); background: rgba(148, 163, 184, 0.1); text-decoration: line-through; }
.badge.pulse::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- 号池调度（状态/容量展示）---- */
.badge.a-down { color: var(--pending); background: rgba(251, 191, 36, 0.12); }
.badge.a-stuck { color: var(--bad); background: rgba(248, 113, 113, 0.14); }
.badge.a-stuck::before { animation: pulse 1.4s ease-in-out infinite; }
.badge.a-online { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
/* 管理员绝对保持：紧跟在「已摘/暂停」后的锁定标记 */
.badge.a-hold { color: #c4b5fd; background: rgba(139, 92, 246, 0.16); margin-left: 5px; }
.badge.a-hold::before { background: currentColor; animation: none; }

/* 号池调度中心：卡片头美化 */
.sched-head { align-items: center; }
.sched-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sched-icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.sched-icon svg { width: 22px; height: 22px; }
.sched-head-text { min-width: 0; }
.sched-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-row.sched-tools { flex: none; flex-wrap: nowrap; align-items: center; }
.filter-row.sched-tools .select-sm { flex: none; width: auto; min-width: 118px; padding-right: 30px; }
.filter-row.sched-tools .btn { flex: none; }
.filter-row.sched-tools .sched-toggle input { flex: none; width: auto; }

.sched-fresh { display: inline-flex; gap: 6px; }
.src-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid var(--line);
}
.src-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.src-pill.ok { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.28); }
.src-pill.ok .dot { background: var(--ok); box-shadow: 0 0 7px rgba(52, 211, 153, 0.9); }
.src-pill.bad { color: var(--bad); background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }
.src-pill.bad .dot { background: var(--bad); box-shadow: 0 0 7px rgba(248, 113, 113, 0.9); }

.sched-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.sched-toggle input { accent-color: var(--accent); }
.sched-reason { color: var(--muted); font-size: 12px; max-width: 360px; }

.conc-now { font-weight: 700; font-variant-numeric: tabular-nums; }

.quota { font-weight: 600; font-variant-numeric: tabular-nums; }
.quota.q-cool { color: var(--muted); }
.quota.q-warm { color: var(--pending); }
.quota.q-hot { color: var(--bad); }

/* ---- GPT 号池调度中心：真实流量三指标 + 分档红绿灯 + 事件横幅 ---- */
.select-sm { padding: 6px 10px; border-radius: 8px; font-size: 13px; background: rgba(15, 20, 34, 0.6); color: var(--fg); border: 1px solid var(--line-strong); }

/* 真实流量比率/延迟色阶 */
.rate { font-weight: 700; font-variant-numeric: tabular-nums; }
.rate.r-cool { color: var(--ok); }
.rate.r-warn { color: var(--pending); }
.rate.r-hot { color: var(--bad); }

/* ① 事件横幅 */
.gp-events { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.gp-events.hidden { display: none; }
.gp-event { padding: 11px 15px; border-radius: 11px; font-size: 13px; font-weight: 500; border: 1px solid transparent; }
.gp-event.hot { color: var(--bad); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3); }
.gp-event.warn { color: var(--pending); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.28); }

/* ② 分档红绿灯 */
.gp-cohorts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.gp-cohort { padding: 16px 18px; }
.gp-cohort-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gp-cohort-nums { display: flex; gap: 24px; margin-bottom: 12px; }
.gp-cohort-nums > div { display: flex; flex-direction: column; }
.gp-cohort-nums b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gp-cohort-nums b.gp-num-bad { color: var(--bad); }
.gp-cohort-nums span { font-size: 11.5px; color: var(--muted-2); }
.gp-cohort-probs { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-chip { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.gp-chip.ok { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.gp-chip.warn { color: var(--pending); background: rgba(251, 191, 36, 0.14); }
.gp-chip.hot { color: var(--bad); background: rgba(248, 113, 113, 0.16); }
.gp-chip.info { color: var(--accent, #60a5fa); background: rgba(96, 165, 250, 0.12); }
.reset-at { font-variant-numeric: tabular-nums; white-space: nowrap; }
.reset-win { display: inline-block; margin-right: 5px; padding: 1px 5px; border-radius: 5px; font-size: 10px; font-weight: 700; color: var(--muted); background: rgba(148, 163, 184, 0.14); }

/* 行内人工干预按钮 */
.gp-ops { white-space: nowrap; }
.gp-op-btn { padding: 4px 9px; margin-right: 5px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--muted); transition: all 0.15s; }
.gp-op-btn:hover { color: var(--fg); background: rgba(255, 255, 255, 0.1); }
.gp-op-btn.pin { color: #a78bfa; border-color: rgba(139, 92, 246, 0.4); }
.gp-op-btn.unpin { color: #8b5cf6; }
.gp-op-btn.pause { color: var(--pending); border-color: rgba(251, 191, 36, 0.35); }
.gp-op-btn.resume { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); }

/* 容量余量徽标 */
.hr { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hr.hr-idle { color: var(--muted-2); background: rgba(148, 163, 184, 0.12); }
.hr.hr-cool { color: var(--ok); background: rgba(52, 211, 153, 0.14); }
.hr.hr-warn { color: var(--pending); background: rgba(251, 191, 36, 0.16); }
.hr.hr-hot { color: var(--bad); background: rgba(248, 113, 113, 0.16); }

.fail-reason { display: block; margin-top: 4px; font-size: 11px; color: var(--bad); opacity: 0.85; max-width: 260px; }

.empty { text-align: center; color: var(--muted-2); padding: 48px 20px; }
.empty svg { opacity: 0.5; margin-bottom: 12px; }
.empty p { margin: 0; font-size: 13px; }

/* Toast */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 240px; max-width: 340px;
  padding: 13px 16px; border-radius: 12px; font-size: 13px;
  background: rgba(20, 26, 42, 0.92); border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.out { animation: toastOut 0.25s ease forwards; }
.toast .ic { flex: none; width: 18px; height: 18px; }
.toast.ok .ic { color: var(--ok); }
.toast.err .ic { color: var(--bad); }
.toast.info .ic { color: var(--accent-2); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* Dropzone */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  background: rgba(255, 255, 255, 0.02);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.drag { border-color: var(--accent); background: rgba(99, 102, 241, 0.08); }
.link-btn { background: none; border: none; color: var(--accent-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

.search-input { width: 150px; padding: 8px 12px; font-size: 13px; }

/* 通知设置表单 */
.settings-form { display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.settings-form .setting-group { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255,255,255,0.02); }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch-row.big { font-size: 14px; font-weight: 600; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline label { margin: 0; white-space: nowrap; font-size: 13px; }
.field.inline input { width: 90px; }

/* 有效期数值 + 单位 */
.validity-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.validity-row .select-wrap { min-width: 108px; }


/* 管理页顶部号池概览：扁长横条，按会员等级分卡（无标题、常驻、紧贴导航栏下方） */
.admin-pool-bar { margin: 0 0 18px; }
.apb-items { display: flex; flex-wrap: wrap; gap: 14px; }
.apb-item {
  flex: 1 1 300px; min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012));
  padding: 12px 18px;
  display: flex; flex-direction: column; gap: 9px;
  box-shadow: 0 10px 28px -22px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.15s;
}
.apb-item.low { border-color: rgba(248,113,113,0.4); background: linear-gradient(135deg, rgba(248,113,113,0.08), rgba(248,113,113,0.02)); }
.apb-item-top { display: flex; align-items: center; gap: 8px; }
.apb-name { font-size: 14px; font-weight: 700; letter-spacing: 0.2px; }
.apb-flag { font-size: 10px; font-weight: 600; color: var(--bad); background: rgba(248,113,113,0.14); padding: 1px 8px; border-radius: 999px; }
.apb-pct { margin-left: auto; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.apb-pct.cool { color: var(--ok); }
.apb-pct.warm { color: var(--pending); }
.apb-pct.hot { color: var(--bad); }
.apb-pct.empty { color: var(--muted-2); }
.apb-metrics { display: flex; gap: 26px; align-items: baseline; flex-wrap: wrap; }
.apb-metric { display: flex; align-items: baseline; gap: 5px; }
.apb-metric b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.apb-metric b.ok { color: var(--ok); }
.apb-metric b.bad { color: var(--bad); }
.apb-metric b.warn { color: var(--pending); }
.apb-metric span { font-size: 11px; color: var(--muted); }
.apb-bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.apb-bar-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.apb-bar-fill.cool { background: linear-gradient(90deg, var(--ok), #22d3ee); }
.apb-bar-fill.warm { background: linear-gradient(90deg, var(--pending), #fb923c); }
.apb-bar-fill.hot { background: linear-gradient(90deg, #fb7185, var(--bad)); }
.apb-bar-fill.full { background: linear-gradient(90deg, var(--bad), #ff2d2d); }
.apb-bar-fill.empty { background: var(--muted-2); }
/* 实时打满醒目标：已打满(红·呼吸) / 接近打满(黄)。替换右上角占用率，靠右显示 */
.apb-pct.full { color: var(--bad); }
.apb-item.low.full-sat { border-color: var(--bad); background: linear-gradient(135deg, rgba(248,113,113,0.16), rgba(248,113,113,0.04)); }
.apb-item-top .apb-flag.full, .apb-item-top .apb-flag.near { margin-left: auto; }
.apb-flag.full { color: #fff; background: var(--bad); font-size: 11px; font-weight: 800; padding: 2px 10px; animation: apbFullPulse 1.1s ease-in-out infinite; }
.apb-flag.near { color: #111; background: var(--pending); font-size: 11px; font-weight: 700; padding: 2px 10px; }
@keyframes apbFullPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,0.55); } 50% { box-shadow: 0 0 0 5px rgba(248,113,113,0); } }
/* 顶部长条：容量余量徽标紧跟档名，占用率靠右；问题小标签一行 */
.apb-item-top .hr { font-size: 11px; padding: 2px 9px; }
.apb-item-top .apb-pct { margin-left: auto; }
.apb-probs { display: flex; flex-wrap: wrap; gap: 6px; }

/* 可排序表头 */
th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; transition: color 0.15s; }
th.th-sort:hover, th.th-sort.active { color: var(--fg); }
.sort-caret { color: #7dd3fc; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 5px; width: fit-content; }
.tab { background: none; border: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; padding: 9px 18px; border-radius: 8px; cursor: pointer; transition: color 0.15s, background 0.15s; }
.tab:hover { color: var(--fg); }
.tab.active { color: white; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px -8px var(--accent-glow); }

/* 管理后台顶栏：品牌(左) · 导航(居中) · 用户区(右) 同一行 */
.topbar.topbar-admin { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.topbar-admin .brand { justify-self: start; }
.topbar-admin .user-area { justify-self: end; }
.topbar-admin .tabs { justify-self: center; margin-bottom: 0; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.topbar-admin .tabs::-webkit-scrollbar { display: none; }
.topbar-admin .tab { padding: 8px 13px; font-size: 13px; white-space: nowrap; }
@media (max-width: 1280px) {
  .topbar.topbar-admin { grid-template-columns: 1fr auto; grid-template-areas: "brand user" "nav nav"; row-gap: 12px; }
  .topbar-admin .brand { grid-area: brand; }
  .topbar-admin .user-area { grid-area: user; }
  .topbar-admin .tabs { grid-area: nav; justify-self: center; }
}

.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.select-wrap.sm select { padding: 8px 34px 8px 12px; font-size: 13px; }

.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.icon-btn { background: var(--glass-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 7px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.icon-btn:hover { color: var(--fg); border-color: var(--line-strong); }
.icon-btn.danger:hover { color: var(--bad); border-color: rgba(248,113,113,0.4); }
.icon-btn.primary { color: var(--accent-2); border-color: rgba(139,92,246,0.4); }
.icon-btn.primary:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.muted-txt { color: var(--muted-2); }
.exp-cell.warn { color: var(--pending); font-weight: 600; }
.exp-cell.bad { color: var(--bad); font-weight: 600; }

/* 产品模型限制选择器 */
.model-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: 200px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255,255,255,0.02); }
.model-add-row { margin-top: 8px; }
.model-add-row input { width: 100%; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(5, 8, 16, 0.6); backdrop-filter: blur(4px); }
.modal { width: 100%; max-width: 520px; padding: 24px 26px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--fg); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; margin-bottom: 4px; }
.switch-row input { width: auto; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 200px; overflow-y: auto; padding: 4px; }
.check-item { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: rgba(255,255,255,0.02); }
.check-item:hover { border-color: var(--line-strong); }
.check-item input { width: auto; flex: none; }
.check-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-item small { color: var(--muted-2); font-size: 10px; }

.user-area .btn-ghost, .user-area a.btn-ghost { text-decoration: none; }

.hidden { display: none !important; }

/* 响应式 */
@media (max-width: 560px) {
  main { padding: 20px 14px 40px; }
  .topbar { padding: 14px 16px; }
  .card { padding: 18px; }
  .form-2col, .form-3col { grid-template-columns: 1fr; }
}


/* IP 管理 */
.proxy-stats { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 14px; margin-bottom: 16px; }
.proxy-stat { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; }
.proxy-stat span { color: var(--muted); font-size: 13px; }
.proxy-stat b { font-size: 25px; font-variant-numeric: tabular-nums; }
.proxy-stat.free b { color: var(--ok); }
.proxy-stat.reserved b { color: var(--pending); }
.proxy-stat.bound b { color: var(--accent-2); }
/* 号池预留 / 上号预留 标签 */
.pool-reserved { display: inline-flex; flex-direction: column; gap: 1px; font-size: 12px; font-weight: 600; color: var(--pending); }
.pool-reserved small { font-weight: 400; font-size: 11px; color: var(--muted); }
.proxy-head { flex-direction: column; align-items: stretch; }
.proxy-head .filter-row { margin-top: 10px; }
.proxy-search { width: min(260px, 100%); }
.proxy-address { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
#proxiesTable { min-width: 1060px; }
#proxiesTable tbody td { vertical-align: top; }
.proxy-cell { min-width: 210px; display: flex; flex-direction: column; gap: 6px; }
.proxy-cell strong { font-size: 13px; }
.proxy-cell > div { display: flex; align-items: center; gap: 7px; }
.proxy-cell code { color: var(--fg); font-size: 12px; white-space: nowrap; }
.proxy-cell small { color: var(--muted); font-size: 11px; }
.expiry { color: var(--fg); white-space: nowrap; }
.expiry.permanent { color: var(--ok); }
.expiry.warn { color: var(--pending); font-weight: 600; }
.expiry.bad { color: var(--bad); font-weight: 600; }
.proxy-accounts-cell { min-width: 330px; }
.proxy-accounts { display: flex; flex-direction: column; gap: 7px; max-height: 260px; overflow-y: auto; padding-right: 3px; }
.proxy-account { padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,0.025); }
.proxy-account-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.proxy-account-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.proxy-account-head .badge { padding: 2px 7px; font-size: 10px; }
.proxy-account-meta { display: flex; flex-wrap: wrap; gap: 4px 11px; margin-top: 5px; color: var(--muted); font-size: 10.5px; }
.proxy-account-meta .expiry { font-size: inherit; }
.proxy-exit { display: flex; align-items: center; gap: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }
.proxy-country-code { padding: 1px 5px; border-radius: 5px; color: var(--accent-2); background: rgba(139,92,246,0.12); font: 10px/1.5 Inter, sans-serif; }
.proxy-latency { display: flex; flex-direction: column; gap: 4px; }
.proxy-latency-status { color: var(--muted); text-transform: uppercase; }
.proxy-latency-message { max-width: 150px; color: var(--muted); white-space: normal; line-height: 1.35; }
.proxy-region { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; white-space: nowrap; }
.import-help { margin-top: 7px; line-height: 1.6; }
.proxy-import-modal { max-width: 620px; }
.import-result { padding: 13px 14px; border: 1px solid rgba(52, 211, 153, 0.28); border-radius: var(--radius-sm); background: rgba(52, 211, 153, 0.06); }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 12px; }
.import-summary b { color: var(--fg); font-size: 14px; margin-left: 3px; }
.import-errors { max-height: 150px; overflow-y: auto; margin: 12px 0 0; padding: 10px 10px 0 28px; border-top: 1px solid var(--line); color: var(--bad); font-size: 12px; line-height: 1.7; }
@media (max-width: 720px) {
  .proxy-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .proxy-stats { grid-template-columns: 1fr; }
  .proxy-stat { padding: 12px 15px; }
}

/* 账号代理选择器（号池调度中心「代理」弹窗内复用） */
.account-proxy-select { width: 220px; max-width: 220px; padding: 7px 28px 7px 9px; font-size: 12px; }
.acct-proxy-wrap { margin-top: 2px; }
.acct-proxy-wrap .account-proxy-select { width: 100%; max-width: none; }

/* 白号池工具栏分组 */
.wp-group { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border:1px solid #2a3646; border-radius:8px; }
.wp-group-label { color:#7c8aa0; font-size:11px; margin-right:2px; }
.wp-chip { cursor:pointer; display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:14px; border:1px solid #2a3646; background:#141b26; font-size:12px; user-select:none; }
.wp-chip:hover { border-color:#4f7cff; }
.wp-chip.active { border-color:#4f7cff; background:rgba(79,124,255,.12); }
.wp-chip b { font-weight:600; }

/* 号池「说明」列：固定窄列，不吃表格剩余宽度。
   table{width:100%} 时 max-width 拦不住列宽；内层 width:0;min-width:100% 才能真正省略。 */
.gm-reason-th,
.gm-reason-cell {
  width: 108px;
  max-width: 108px;
  padding-left: 8px;
  padding-right: 8px;
}
.gm-reason-cell { color: var(--muted); font-size: 11px; }
.gm-reason {
  display: block;
  width: 0;
  min-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
}
.gm-reason:hover { color: #8ab4ff; }
.gm-reason-empty { color: var(--muted-2); opacity: 0.55; }
.gm-rl1h-n {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 8px;
  border-radius: 8px;
  background: rgba(120, 130, 150, 0.12);
  white-space: nowrap;
}
.gm-rl1h-sep { color: #5a6785; font-weight: 500; margin: 0 1px; }
.wp-op-cell { max-width: 150px; }
.wp-op { cursor: pointer; max-width: 150px; }
.wp-op-text { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.wp-op:hover .wp-op-text { text-decoration: underline; }

/* ---------- 用户看板 ---------- */
.ub-toolbar .ub-tools { flex-wrap: wrap; gap: 8px; align-items: center; }
.ub-ranges, .ub-views { display: inline-flex; gap: 4px; padding: 3px; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; }
.ub-range, .ub-view { border: none !important; background: transparent !important; padding: 5px 12px !important; }
.ub-range.active, .ub-view.active { background: var(--accent-soft) !important; color: var(--accent) !important; }
.ub-custom { display: inline-flex; align-items: center; gap: 6px; }
.ub-custom.hidden { display: none; }
.ub-date { background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 12px; color-scheme: dark; }
.ub-sep { color: var(--muted); }
.ub-meta { margin: 10px 4px 0; }

.ub-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 14px 0; }
@media (max-width: 1280px) { .ub-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .ub-kpis { grid-template-columns: repeat(2, 1fr); } }
.ub-kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); }
.ub-kpi-label { color: var(--muted); font-size: 12px; }
.ub-kpi-value { font-size: 24px; font-weight: 700; letter-spacing: 0.3px; }
.ub-kpi-sub { color: var(--muted); font-size: 11px; }
.ub-kpi-cost .ub-kpi-value { color: var(--ok); }
.ub-kpi-warn .ub-kpi-value { color: var(--warn); }
.ub-kpi-safety .ub-kpi-value { color: var(--pending); }

#ubTable .ub-row { cursor: pointer; }
#ubTable .ub-row:hover { background: var(--accent-soft); }
.ub-caret { display: inline-block; width: 12px; color: var(--muted); font-size: 9px; transition: transform 0.15s; }
.ub-caret.open { transform: rotate(90deg); }
.ub-cost b { color: var(--ok); }
.ub-warn { color: var(--warn); font-weight: 700; }
/* 触发安全策略率：按机率分档配色 */
.ub-safety { font-weight: 600; cursor: default; }
.ub-safety.lvl-bad { color: var(--bad); }
.ub-safety.lvl-warn { color: var(--pending); }
.ub-safety.lvl-ok { color: var(--ok); }
.ub-safety.lvl-none { color: var(--muted); font-weight: 400; }
.ub-today b { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.ub-today.lvl-none { color: var(--muted); font-weight: 400; }
.ub-kpi-today .ub-kpi-value { color: var(--accent-2); }
.ub-conc { font-weight: 700; font-variant-numeric: tabular-nums; cursor: default; }
.ub-conc .ub-conc-max { font-weight: 500; color: var(--muted); }
.ub-conc.lvl-bad { color: var(--bad); }
.ub-conc.lvl-warn { color: var(--pending); }
.ub-conc.lvl-ok { color: var(--ok); }
.ub-conc.lvl-none { color: var(--muted); font-weight: 400; }
/* 可排序表头：点击列头排序（用户中心表格） */
th.ub-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.ub-sortable:hover { color: var(--accent); }
.ub-sort-ind { display: inline-block; min-width: 10px; margin-left: 2px; font-size: 10px; opacity: 0.3; }
.ub-sort-ind.on { opacity: 1; color: var(--accent); }
.ub-chips { max-width: 380px; }
.ub-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 8px; font-size: 11px; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.ub-chip b { color: var(--text); font-weight: 600; }
.ub-chip.more { color: var(--accent); }
/* 展开明细：作为与父表同列对齐的子行（不再用独立子表，避免列错位） */
.ub-subrow > td { background: rgba(255, 255, 255, 0.02); border-bottom: 1px solid rgba(34, 48, 65, 0.5); font-size: 12px; padding-top: 8px; padding-bottom: 8px; }
.ub-subrow .ub-subname { padding-left: 34px; position: relative; color: var(--muted); }
.ub-subrow .ub-subname::before { content: "└"; position: absolute; left: 16px; color: var(--muted-2); }
/* 已删除用户/分组标记 */
.ub-tag-del { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px; font-size: 10px; color: var(--muted); background: rgba(148, 163, 184, 0.14); vertical-align: middle; }

/* ===== 请求明细（使用记录）模态 ===== */
.req-modal { max-width: 1180px; }
.req-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.req-ranges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.req-custom { display: inline-flex; align-items: center; gap: 6px; }
.req-toolbar .search-input { width: 130px; }
.req-toolbar .req-user-filter { width: 100px; }
.req-live { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.req-live input { accent-color: var(--accent); }
.req-meta { margin: 0 0 8px; }
.req-scroll { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.req-table { font-size: 12px; }
.req-table thead th { position: sticky; top: 0; background: var(--bg-1); z-index: 1; padding: 8px 10px; white-space: nowrap; }
.req-table tbody td { padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.req-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.req-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.req-k { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.req-k.ok { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.req-k.err { color: var(--bad); background: rgba(248, 113, 113, 0.12); }
.req-model { color: var(--fg); }
.req-dim { color: var(--muted-2); }
.req-err-msg { color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
.req-open-btn { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline dotted; }
.req-open-btn:hover { color: var(--accent-2); }
.req-row-new { animation: reqFlash 1.3s ease-out; }
@keyframes reqFlash { from { background: rgba(99, 102, 241, 0.22); } to { background: transparent; } }
