/* ============ 拓客采集 · 管理后台 深色主题 ============ */
:root {
  --bg: #0a1018;
  --bg-soft: #0e1622;
  --panel: #121c2b;
  --panel-2: #162234;
  --panel-3: #1b2942;
  --border: #1e2c42;
  --border-soft: #17233a;
  --text: #e8eef8;
  --text-2: #a9b7cd;
  --muted: #6f809b;
  --accent: #2f7bff;
  --accent-soft: rgba(47, 123, 255, .14);
  --cyan: #22d3ee;
  --ok: #22c55e;
  --warn: #f5a524;
  --danger: #f04a5c;
  --purple: #a77bff;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #253449; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #33465f; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 登录 ---------------- */
#login-view {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: var(--bg);
}

/* 背景：流动光斑 + 网格 */
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-bg .glow {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55;
}
.login-bg .glow-a {
  width: 620px; height: 620px; left: -140px; top: -180px;
  background: radial-gradient(circle at 50% 50%, rgba(47,123,255,.55), transparent 68%);
  animation: floatA 16s ease-in-out infinite;
}
.login-bg .glow-b {
  width: 560px; height: 560px; right: -160px; bottom: -200px;
  background: radial-gradient(circle at 50% 50%, rgba(34,211,238,.34), transparent 68%);
  animation: floatB 20s ease-in-out infinite;
}
.login-bg .grid-lines {
  position: absolute; inset: 0; opacity: .35;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 50%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 65% at 50% 50%, #000 30%, transparent 78%);
}
@keyframes floatA { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px,40px); } }
@keyframes floatB { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-50px,-30px); } }

/* 卡片：玻璃拟态 */
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 408px;
  padding: 38px 34px 26px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg, rgba(23,35,54,.86), rgba(14,22,34,.92));
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 26px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.25) inset;
  animation: cardIn .5s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.login-head { text-align: center; margin-bottom: 26px; }
.logo-wrap { position: relative; display: inline-grid; place-items: center; margin-bottom: 14px; }
.logo-wrap .brand-logo {
  width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3a82ff, #22d3ee);
  color: #fff; font-weight: 800; font-size: 25px;
  box-shadow: 0 10px 26px rgba(47,123,255,.42);
}
.logo-ring {
  position: absolute; width: 78px; height: 78px; border-radius: 50%;
  border: 1px solid rgba(47,123,255,.35);
  animation: ringPulse 3.2s ease-out infinite;
}
@keyframes ringPulse {
  0% { transform: scale(.82); opacity: .9; }
  100% { transform: scale(1.22); opacity: 0; }
}
.login-head .prod {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 3px;
  color: #f2f7ff;
  text-shadow: 0 2px 14px rgba(80,150,255,.5);
}
.login-head .slogan { margin: 6px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .4px; }

/* 提示条 */
.login-alert, .login-notify {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 16px;
  font-size: 12.5px; line-height: 1.55;
}
.login-alert {
  background: rgba(240,74,92,.13); border: 1px solid rgba(240,74,92,.34); color: #ffb3bd;
}
.login-notify {
  background: rgba(245,165,36,.12); border: 1px solid rgba(245,165,36,.34); color: #ffd894;
}
.login-alert b, .login-notify b { color: #fff; }

/* 登录页输入框 */
.login-card .field { margin-bottom: 16px; }
.login-card label { font-size: 12px; color: var(--text-2); margin-bottom: 7px; letter-spacing: .3px; }
.input-wrap { position: relative; }
.input-wrap > .ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; fill: none; stroke: var(--muted);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none; transition: stroke .18s;
}
.input-wrap input {
  height: 44px; padding: 0 42px 0 40px; border-radius: 11px;
  background: rgba(8,14,24,.6); border: 1px solid rgba(255,255,255,.08);
  font-size: 13.5px; transition: border-color .18s, box-shadow .18s, background .18s;
}
.input-wrap input:hover { border-color: rgba(255,255,255,.14); }
.input-wrap input:focus {
  border-color: rgba(58,130,255,.75); background: rgba(8,14,24,.85);
  box-shadow: 0 0 0 3.5px rgba(47,123,255,.16);
}
.input-wrap:focus-within > .ico { stroke: #6ea8ff; }
.input-wrap .eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: grid; place-items: center;
  background: none; border: none; cursor: pointer; border-radius: 7px; color: var(--muted);
}
.input-wrap .eye:hover { color: var(--text); background: rgba(255,255,255,.06); }
.input-wrap .eye svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 登录按钮 */
.btn-login {
  position: relative; width: 100%; height: 46px; margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; border-radius: 11px; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 600; letter-spacing: 3px; color: #fff;
  background: linear-gradient(135deg, #2f7bff, #4b9dff 55%, #22c7ea);
  box-shadow: 0 10px 24px rgba(47,123,255,.34);
  transition: transform .16s, box-shadow .16s, filter .16s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(47,123,255,.44); filter: brightness(1.06); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { cursor: not-allowed; filter: saturate(.7) brightness(.9); transform: none; }
.btn-login .spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#login-form.is-loading .btn-login .spinner { display: block; }

.login-card .sub { color: var(--muted); font-size: 12px; margin: 2px 0 12px; text-align: center; }
.login-foot {
  margin-top: 20px; padding-top: 16px; text-align: center;
  font-size: 11.5px; color: var(--muted);
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.login-foot .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}

@media (max-width: 480px) {
  .login-card { padding: 30px 22px 20px; border-radius: 16px; }
  .login-head .prod { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-card, .login-bg .glow, .logo-ring, .btn-login .spinner { animation: none; }
}

/* 侧边栏品牌区（登录页不使用 .brand，保留给主界面） */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #fff; font-weight: 800; font-size: 19px;
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .5px; }
.brand small { color: var(--muted); font-size: 12px; }

/* ---------------- 表单控件 ---------------- */
label { display: block; font-size: 12.5px; color: var(--text-2); margin: 0 0 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; font-family: inherit; font-size: 13.5px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: #55657f; }
select option { background: var(--panel-2); }
.field { margin-bottom: 15px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer;
  font-size: 13px; font-family: inherit; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #2a3d59; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1e6bf5; border-color: #1e6bf5; }
.btn-danger { background: rgba(240,74,92,.12); border-color: rgba(240,74,92,.4); color: #ff8896; }
.btn-danger:hover { background: rgba(240,74,92,.22); }
.btn-ok { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: #6ee7a0; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--accent); padding: 2px 6px; cursor: pointer; font-size: 12.5px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ---------------- 主框架 ---------------- */
#main-view { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: 0 0 218px; background: var(--panel);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 18px 14px; margin: 0; border-bottom: 1px solid var(--border-soft); }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 13.5px; margin-bottom: 3px; cursor: pointer;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: #8ab7ff; font-weight: 600; }
.nav a .ico { width: 18px; text-align: center; font-size: 15px; }
.nav .group-title {
  font-size: 11px; color: var(--muted); padding: 14px 12px 6px; letter-spacing: 1px;
}
.side-foot { padding: 14px; border-top: 1px solid var(--border-soft); }
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2f7bff33, #22d3ee33); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: #8ab7ff;
}
.who .n { font-size: 13px; font-weight: 600; line-height: 1.35; }
.who .t { font-size: 11.5px; color: var(--muted); }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; border-bottom: 1px solid var(--border); background: rgba(10,16,24,.82);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; }
.topbar .tools { display: flex; gap: 8px; align-items: center; }
.content { padding: 20px 22px 40px; }
.page { display: none; }
.page.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; margin: 0; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 980px) {
  .g3, .g2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
}

.stat {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--accent-soft);
}
.stat .lbl { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.stat .val { font-size: 27px; font-weight: 700; letter-spacing: .5px; line-height: 1.1; }
.stat .val small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.stat .foot { font-size: 12px; color: var(--muted); margin-top: 8px; }
.c-accent { color: #7aabff; } .c-ok { color: #5fd98a; } .c-warn { color: #f7bd55; }
.c-danger { color: #ff7c8b; } .c-cyan { color: #4fdcef; } .c-purple { color: #c2a2ff; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--panel-2); color: var(--text-2); font-weight: 600; text-align: left;
  padding: 11px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--border); font-size: 12.5px;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
tbody tr:hover td { background: rgba(47,123,255,.06); }
tbody tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; letter-spacing: .3px; }
/* 卡密：点文字或点「复制」按钮都能复制 */
.code-cell { cursor: pointer; border-bottom: 1px dashed transparent; transition: color .15s, border-color .15s; }
.code-cell:hover { color: var(--accent); border-bottom-color: var(--accent); }
.copy-mini {
  background: none; border: none; padding: 2px 7px; margin-left: 6px; cursor: pointer;
  color: var(--muted); font-size: 12px; border-radius: 5px; vertical-align: middle;
  transition: color .15s, background .15s;
}
.copy-mini:hover { color: var(--accent); background: var(--bg-soft); }
.copy-mini:active { transform: scale(.94); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.7;
}
.tag-green { background: rgba(34,197,94,.13); color: #62d98c; border-color: rgba(34,197,94,.3); }
.tag-blue  { background: rgba(47,123,255,.14); color: #7aabff; border-color: rgba(47,123,255,.32); }
.tag-gray  { background: rgba(111,128,155,.14); color: #9aabc4; border-color: rgba(111,128,155,.3); }
.tag-amber { background: rgba(245,165,36,.14); color: #f7bd55; border-color: rgba(245,165,36,.32); }
.tag-red   { background: rgba(240,74,92,.14);  color: #ff8593; border-color: rgba(240,74,92,.32); }
.tag-purple{ background: rgba(167,123,255,.14);color: #c2a2ff; border-color: rgba(167,123,255,.32); }
.tag-cyan  { background: rgba(34,211,238,.13); color: #4fdcef; border-color: rgba(34,211,238,.3); }

/* ---------------- 工具条 / 分页 ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .f { min-width: 140px; }
.toolbar .f.grow { flex: 1; min-width: 200px; }
.toolbar .sp { flex: 1; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 2px 0; font-size: 13px; color: var(--text-2); }
.pager .total { margin-right: auto; color: var(--muted); font-size: 12.5px; }

/* ---------------- 树 ---------------- */
.tree { font-size: 13.5px; }
.tree-node { border-left: 2px solid var(--border); margin-left: 12px; padding-left: 12px; }
.tree-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent;
}
.tree-row:hover { background: var(--panel-2); border-color: var(--border); }
.tree-row.root { background: var(--accent-soft); border-color: rgba(47,123,255,.28); }
.tree-toggle { width: 16px; color: var(--muted); font-size: 11px; user-select: none; }
.tree-name { font-weight: 600; }
.tree-meta { color: var(--muted); font-size: 12px; }

/* ---------------- 图表 ---------------- */
.chart-box { width: 100%; height: 220px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-row .k { width: 128px; flex: 0 0 128px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; height: 16px; background: var(--bg-soft); border-radius: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #2f7bff, #22d3ee); }
.bar-row .v { width: 62px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(4, 8, 14, .72); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px;
  overflow-y: auto; backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); animation: pop .18s ease;
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .x { cursor: pointer; color: var(--muted); font-size: 19px; line-height: 1; }
.modal-body { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- 提示 ---------------- */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px; max-width: 380px; padding: 11px 15px; border-radius: 9px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: slideIn .18s ease; border-left: 3px solid var(--accent);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.code-box {
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.9;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; max-height: 260px; overflow: auto; white-space: pre; color: #9ad9ff;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mb8 { margin-bottom: 8px; } .mb14 { margin-bottom: 14px; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hidden { display: none !important; }
.kv { display: grid; grid-template-columns: 104px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------------- 品牌设置（白标） ---------------- */
.brand-row { display: flex; align-items: center; gap: 14px; }
.brand-img {
  width: 56px; height: 56px; border-radius: 12px; object-fit: contain;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
}
.brand-img.ph {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px;
}
.b-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
