/* AI实景直播 · 代理商管理系统 —— 深色科技风 */
:root {
  --bg: #0a1020;
  --bg2: #0e1730;
  --panel: #131c34;
  --panel2: #1a2542;
  --line: #24304f;
  --text: #e6edf7;
  --muted: #8fa0bd;
  --accent: #38bdf8;
  --accent2: #6366f1;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2a55 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 110%, #14274d 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 420px; max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px 34px;
}
.brand { text-align: center; margin-bottom: 26px; }
.brand .logo {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--grad); display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 12px;
}
.brand h1 { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand p { color: var(--muted); font-size: 13px; margin-top: 6px; }

.tabs { display: flex; background: var(--bg2); border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.tabs button {
  flex: 1; padding: 10px 0; border: none; background: transparent; color: var(--muted);
  font-size: 15px; cursor: pointer; border-radius: 8px; transition: .2s; font-weight: 500;
}
.tabs button.active { background: var(--grad); color: #fff; font-weight: 600; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-size: 15px; outline: none; transition: .2s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.15); }

.btn {
  width: 100%; padding: 13px; border: none; border-radius: 10px;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: .2s; letter-spacing: 1px;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 7px 14px; font-size: 13px; }
.btn.danger { background: linear-gradient(135deg, #f87171, #ef4444); }

.login-tip { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ---------- 布局 ---------- */
.topbar {
  height: 62px; background: rgba(19,28,52,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 50;
}
.topbar .left { display: flex; align-items: center; gap: 12px; }
.topbar .logo-sm {
  width: 36px; height: 36px; border-radius: 10px; background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
}
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.pill {
  padding: 6px 12px; border-radius: 20px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.pill b { color: var(--accent); }

.wrap { display: flex; min-height: calc(100vh - 62px); }

/* 侧边栏 */
.sidebar {
  width: 220px; background: var(--bg2); border-right: 1px solid var(--line);
  padding: 20px 14px; flex-shrink: 0;
}
.sidebar .nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar .nav button {
  text-align: left; padding: 12px 14px; border: none; background: transparent;
  color: var(--muted); font-size: 14px; cursor: pointer; border-radius: 10px; transition: .15s;
  display: flex; align-items: center; gap: 10px;
}
.sidebar .nav button:hover { background: var(--panel2); color: var(--text); }
.sidebar .nav button.active { background: var(--grad); color: #fff; font-weight: 600; }
.sidebar .nav .ico { width: 20px; text-align: center; }

.main { flex: 1; padding: 26px; overflow-x: hidden; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ---------- 卡片 / 网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .num { font-size: 30px; font-weight: 800; margin-top: 6px; }
.stat-card .num.money { color: var(--accent); }
.stat-card .lbl { color: var(--muted); font-size: 13px; }

/* 产品卡片 */
.product-card { text-align: center; position: relative; overflow: hidden; }
.product-card .tag {
  position: absolute; top: 14px; right: -34px; transform: rotate(45deg);
  background: var(--grad); color: #fff; font-size: 11px; padding: 4px 40px; font-weight: 600;
}
.product-card .p-name { font-size: 17px; font-weight: 700; }
.product-card .p-hours { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.product-card .p-price { font-size: 30px; font-weight: 800; color: var(--accent); }
.product-card .p-price span { font-size: 14px; color: var(--muted); font-weight: 500; }
.product-card .btn { margin-top: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
tr:hover td { background: rgba(56,189,248,.04); }
td .mono { font-family: Consolas, "Courier New", monospace; }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.paid { background: rgba(52,211,153,.15); color: var(--green); border: 1px solid rgba(52,211,153,.4); }
.badge.unpaid { background: rgba(251,191,36,.15); color: var(--amber); border: 1px solid rgba(251,191,36,.4); }
.badge.active { background: rgba(52,211,153,.15); color: var(--green); border: 1px solid rgba(52,211,153,.4); }
.badge.inactive { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.4); }
.badge.role { background: rgba(99,102,241,.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,.4); }
.badge.recharged { background: rgba(56,189,248,.15); color: var(--accent); border: 1px solid rgba(56,189,248,.4); }
.badge.unrecharged { background: rgba(148,163,184,.12); color: var(--muted); border: 1px solid rgba(148,163,184,.35); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4,8,18,.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: 440px; max-width: 100%; padding: 26px; box-shadow: var(--shadow);
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 20px; }
.modal .foot { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px; border-radius: 10px; font-size: 14px; z-index: 200;
  box-shadow: var(--shadow); display: none; animation: slideIn .25s ease;
}
#toast.ok { background: rgba(52,211,153,.95); color: #06281c; }
#toast.err { background: rgba(248,113,113,.95); color: #3d0707; }
@keyframes slideIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.hidden { display: none !important; }
.row-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.code-box {
  font-family: Consolas, monospace; font-size: 18px; font-weight: 700; color: var(--accent);
  background: var(--bg2); border: 1px dashed var(--accent); border-radius: 10px;
  padding: 12px 16px; text-align: center; letter-spacing: 2px;
}
.muted { color: var(--muted); font-size: 13px; }
