:root{
  --primary:#4f46e5;
  --primary-2:#7c3aed;
  --bg:#f1f5f9;
  --card:#ffffff;
  --text:#0f172a;
  --text-2:#64748b;
  --text-3:#94a3b8;
  --border:#e2e8f0;
  --sidebar:#0f172a;
  --sidebar-2:#1e293b;
  --green:#10b981;
  --red:#ef4444;
  --amber:#f59e0b;
  --radius:14px;
  --shadow:0 1px 2px rgba(15,23,42,.05),0 8px 24px -12px rgba(15,23,42,.12);
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;background:var(--bg);color:var(--text);font-size:14px;line-height:1.5}
button{font-family:inherit;cursor:pointer;border:none;background:none}
input,select{font-family:inherit;font-size:14px}

/* login */
#loginScreen{min-height:100vh;display:flex;align-items:center;justify-content:center;background:radial-gradient(1200px 600px at 20% -10%,#4f46e5 0%,transparent 55%),radial-gradient(1000px 500px at 110% 110%,#7c3aed 0%,transparent 50%),#0f172a;padding:24px}
.login-card{width:420px;max-width:100%;background:var(--card);border-radius:20px;padding:40px 36px;box-shadow:0 30px 80px -20px rgba(0,0,0,.5)}
.login-logo{display:flex;align-items:center;gap:12px;margin-bottom:6px}
.login-logo .mark{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;color:#fff;background:linear-gradient(135deg,var(--primary),var(--primary-2));font-weight:800;font-size:20px}
.login-logo h1{font-size:20px;font-weight:700}
.login-sub{color:var(--text-2);margin-bottom:28px;font-size:13px}
.field{margin-bottom:16px}
.field label{display:block;font-size:12px;color:var(--text-2);margin-bottom:6px;font-weight:600}
.field input,.field select{width:100%;padding:11px 14px;border:1px solid var(--border);border-radius:10px;outline:none;transition:.15s;background:#f8fafc}
.field input:focus,.field select:focus{border-color:var(--primary);background:#fff;box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 18px;border-radius:10px;font-weight:600;font-size:14px;transition:.15s}
.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff;width:100%}
.btn-primary:hover{filter:brightness(1.05);box-shadow:0 10px 24px -10px rgba(79,70,229,.7)}
.btn-ghost{background:#eef2ff;color:var(--primary)}
.btn-ghost:hover{background:#e0e7ff}
.btn-outline{background:#fff;color:var(--text);border:1px solid var(--border)}
.btn-outline:hover{border-color:var(--primary);color:var(--primary)}
.demo-list{margin-top:24px;border-top:1px dashed var(--border);padding-top:18px}
.demo-list p{font-size:12px;color:var(--text-3);margin-bottom:10px}
.demo-acc{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;margin-bottom:8px;background:#f8fafc;transition:.15s;text-align:left}
.demo-acc:hover{border-color:var(--primary);background:#eef2ff}
.demo-acc .nm{font-weight:600}
.demo-acc .role{font-size:11px;color:var(--text-2)}
.err-tip{color:#dc2626;font-size:12px;margin-top:10px;min-height:16px}

/* layout */
#app{display:flex;min-height:100vh}
aside{width:248px;background:var(--sidebar);color:#cbd5e1;flex-shrink:0;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
.side-brand{display:flex;align-items:center;gap:12px;padding:22px 20px}
.side-brand .mark{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;color:#fff;background:linear-gradient(135deg,var(--primary),var(--primary-2));font-weight:800}
.side-brand .t{font-weight:700;color:#fff;font-size:15px}
.side-brand .s{font-size:11px;color:#64748b}
nav{flex:1;padding:8px 12px}
.nav-item{display:flex;align-items:center;gap:12px;padding:11px 14px;border-radius:10px;color:#cbd5e1;font-weight:500;margin-bottom:4px;transition:.15s;width:100%;text-align:left}
.nav-item:hover{background:var(--sidebar-2);color:#fff}
.nav-item.active{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff}
.side-foot{padding:16px 20px;border-top:1px solid var(--sidebar-2)}
.user-chip{display:flex;align-items:center;gap:10px}
.avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:700;background:linear-gradient(135deg,var(--primary),var(--primary-2))}
.user-chip .nm{color:#fff;font-weight:600;font-size:13px}
.user-chip .rl{font-size:11px;color:#64748b}
.logout{margin-left:auto;color:#64748b;transition:.15s}
.logout:hover{color:#fff}

.main{flex:1;display:flex;flex-direction:column;min-width:0}
header{background:var(--card);border-bottom:1px solid var(--border);padding:16px 28px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:5}
header h2{font-size:18px;font-weight:700}
header .crumb{font-size:12px;color:var(--text-3);margin-top:2px}
.role-badge{padding:5px 12px;border-radius:999px;font-size:12px;font-weight:700}
.role-admin{background:#ede9fe;color:#6d28d9}
.role-manager{background:#ffedd5;color:#9a3412}
.role-agent{background:#dbeafe;color:#1d4ed8}
.role-terminal{background:#d1fae5;color:#047857}
#content{padding:28px;max-width:1280px;width:100%;margin:0 auto}

/* stats */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}
.stat{background:var(--card);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);border:1px solid var(--border)}
.stat .lb{font-size:12px;color:var(--text-2);font-weight:600}
.stat .vl{font-size:28px;font-weight:800;margin:6px 0 2px}
.stat .hd{font-size:12px;color:var(--text-3)}
.stat .ic{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;margin-bottom:12px}
.stat .ic svg{width:20px;height:20px}

.panel{background:var(--card);border-radius:var(--radius);border:1px solid var(--border);box-shadow:var(--shadow);margin-bottom:20px}
.panel-hd{padding:18px 22px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.panel-hd h3{font-size:15px;font-weight:700}
.panel-bd{padding:22px}

.bars{display:flex;flex-direction:column;gap:14px}
.bar-row{display:grid;grid-template-columns:86px 1fr 54px;align-items:center;gap:12px}
.bar-row .bl{font-size:13px;font-weight:600;display:flex;align-items:center;gap:8px}
.dot{width:9px;height:9px;border-radius:3px;display:inline-block}
.bar-track{height:14px;background:#f1f5f9;border-radius:8px;overflow:hidden}
.bar-fill{height:100%;border-radius:8px;transition:width .6s ease}
.bar-row .bv{font-size:13px;font-weight:700;text-align:right}

.filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:18px}
.filters select,.filters input{padding:9px 12px;border:1px solid var(--border);border-radius:9px;outline:none;background:#fff}
.filters select:focus,.filters input:focus{border-color:var(--primary)}
.filters .grow{flex:1;min-width:140px}
.filters .spacer{flex:1}

.tbl-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;min-width:720px}
th{text-align:left;font-size:12px;color:var(--text-2);font-weight:600;padding:12px 16px;border-bottom:1px solid var(--border);white-space:nowrap}
td{padding:13px 16px;border-bottom:1px solid #f1f5f9;font-size:13px;vertical-align:middle}
tr:hover td{background:#f8fafc}
.phone{font-family:"SF Mono",ui-monospace,Menlo,monospace;font-weight:600;letter-spacing:.5px}
.tag{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;font-size:12px;font-weight:600;color:#fff}
.tag .dot{background:rgba(255,255,255,.85);width:6px;height:6px;border-radius:50%}
.src-douyin{background:#fe2c55}
.src-baidu{background:#3b5bdb}
.src-deepseek{background:#6d4aff}
.src-yuanbao{background:#07c160}
.muted{color:var(--text-3)}
.empty{padding:40px;text-align:center;color:var(--text-3)}
.link-btn{color:var(--primary);font-weight:600;font-size:13px}
.link-btn:hover{text-decoration:underline}
.mini-badge{padding:3px 8px;border-radius:6px;font-size:11px;font-weight:700}

/* modal */
.overlay{position:fixed;inset:0;background:rgba(15,23,42,.5);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;z-index:50;padding:20px}
.modal{background:var(--card);border-radius:16px;width:460px;max-width:100%;max-height:90vh;overflow:auto;box-shadow:0 30px 80px -20px rgba(0,0,0,.4)}
.modal-hd{padding:18px 22px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-hd h3{font-size:16px;font-weight:700}
.modal-bd{padding:22px}
.modal-ft{padding:16px 22px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px}
.x-btn{color:var(--text-3);font-size:20px;line-height:1}
.x-btn:hover{color:var(--text)}

#toastRoot{position:fixed;top:20px;right:20px;z-index:100;display:flex;flex-direction:column;gap:10px}
.toast{background:#0f172a;color:#fff;padding:12px 16px;border-radius:10px;font-size:13px;box-shadow:0 10px 30px -10px rgba(0,0,0,.5);animation:slideIn .25s ease;display:flex;align-items:center;gap:8px}
.toast.ok{background:#065f46}
.toast.err{background:#991b1b}
@keyframes slideIn{from{transform:translateX(20px);opacity:0}to{transform:none;opacity:1}}

.warn{display:flex;gap:8px;align-items:flex-start;font-size:12px;color:var(--amber);background:#fffbeb;border:1px solid #fde68a;border-radius:10px;padding:10px 12px}

.pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 22px;border-top:1px solid var(--border);font-size:13px;color:var(--text-2)}

@media(max-width:860px){
  aside{position:fixed;left:0;top:0;bottom:0;transform:translateX(-100%);transition:.2s;z-index:40}
  aside.open{transform:none}
  .main{margin-left:0}
  #menuBtn{display:grid!important}
}
#menuBtn{display:none;width:38px;height:38px;border-radius:9px;place-items:center;border:1px solid var(--border);color:var(--text)}
