:root{
  --bg:#f5f7fb;
  --surface:#ffffff;
  --text:#1e293b;
  --text-2:#64748b;
  --border:#e8ecf3;
  --primary:#4f46e5;
  --danger:#ef4444;
  --shadow:0 1px 2px rgba(16,24,40,.03),0 8px 24px rgba(16,24,40,.05);
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{min-height:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  font-size:14px;
}
.svg-sprite{position:absolute;width:0;height:0;overflow:hidden}
.icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.icon.lg{width:26px;height:26px}
.hidden{display:none !important}

/* ---------- 登录 ---------- */
.login-page{
  min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  position:relative;overflow:hidden;
  background:radial-gradient(circle at 14% 18%,#eef2ff 0%,transparent 44%),
             radial-gradient(circle at 86% 82%,#e0f2fe 0%,transparent 44%),
             linear-gradient(135deg,#f9fafc,#f1f5f9);
}
.decor{position:absolute;border-radius:50%;pointer-events:none;opacity:.6}
.decor-a{width:420px;height:420px;top:-150px;left:-110px;background:linear-gradient(135deg,rgba(99,102,241,.18),rgba(129,140,248,.03))}
.decor-b{width:380px;height:380px;bottom:-140px;right:-90px;background:linear-gradient(135deg,rgba(56,189,248,.15),rgba(167,139,250,.04))}
.login-card{
  position:relative;z-index:1;width:100%;max-width:420px;background:#fff;
  border:1px solid rgba(255,255,255,.9);border-radius:20px;padding:40px;
  box-shadow:0 24px 70px rgba(49,46,129,.14);
  animation:pop .35s cubic-bezier(.2,.8,.2,1);
}
.login-brand{text-align:center;margin-bottom:30px}
.brand-mark{
  width:52px;height:52px;border-radius:15px;margin:0 auto 18px;
  background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 8px 20px rgba(79,70,229,.28);
}
.brand-mark.sm{width:38px;height:38px;border-radius:11px;box-shadow:none;margin:0}
.login-brand h1{font-size:22px;font-weight:700;color:#0f172a;letter-spacing:.3px;margin-bottom:7px}
.login-brand p{font-size:13px;color:#94a3b8}

/* ---------- 表单通用 ---------- */
.field{margin-bottom:18px}
.field label{display:block;font-size:13px;font-weight:600;color:#475569;margin-bottom:8px}
.field label em{color:var(--danger);font-style:normal;margin-left:2px}
input,textarea{
  width:100%;border:1px solid var(--border);border-radius:10px;padding:11px 13px;
  font-size:14px;color:var(--text);background:#fff;outline:none;
  transition:border-color .18s,box-shadow .18s;font-family:inherit;
}
input::placeholder,textarea::placeholder{color:#b6c0cf}
input:focus,textarea:focus{border-color:#a5b4fc;box-shadow:0 0 0 4px rgba(99,102,241,.1)}
.input-wrap{position:relative}
.input-wrap .icon{position:absolute;left:13px;top:50%;transform:translateY(-50%);color:#a1adbd;width:17px;height:17px}
.input-wrap input{padding-left:40px}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;
  border-radius:10px;padding:10px 18px;font-size:14px;font-weight:600;cursor:pointer;
  font-family:inherit;transition:all .18s;white-space:nowrap;
}
.btn .icon{width:17px;height:17px}
.btn-primary{background:linear-gradient(135deg,#4f46e5,#6d5ce7);color:#fff;box-shadow:0 4px 12px rgba(79,70,229,.22)}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 8px 18px rgba(79,70,229,.3)}
.btn-primary:active{transform:translateY(0)}
.btn-ghost{background:transparent;color:#475569;border:1px solid var(--border)}
.btn-ghost:hover{background:#f8fafc;border-color:#d7dce6}
.btn-danger{background:var(--danger);color:#fff;box-shadow:0 4px 12px rgba(239,68,68,.2)}
.btn-danger:hover{background:#dc2626}
.btn-sm{padding:7px 12px;font-size:13px}
.btn-block{width:100%;padding:12px;margin-top:6px}
.btn:disabled{opacity:.6;cursor:not-allowed;transform:none}

.login-foot{text-align:center;font-size:12px;color:#b0bac9;margin-top:22px;padding-top:20px;border-top:1px solid #f1f5f9}

/* ---------- 顶部栏 ---------- */
.topbar{background:#fff;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:20}
.topbar-inner{max-width:1240px;margin:0 auto;padding:0 28px;height:68px;display:flex;align-items:center;justify-content:space-between}
.topbar-brand{display:flex;align-items:center;gap:12px}
.brand-title{font-size:16px;font-weight:700;color:#0f172a;letter-spacing:.2px}
.brand-sub{font-size:10px;color:#a3adbd;letter-spacing:1.4px;margin-top:2px;font-weight:600}
.topbar-right{display:flex;align-items:center;gap:14px}
.user-chip{display:flex;align-items:center;gap:7px;font-size:13px;color:#475569;background:#f8fafc;border:1px solid var(--border);padding:7px 12px;border-radius:20px}
.user-chip .icon{width:15px;height:15px;color:#6366f1}

.container{max-width:1240px;margin:0 auto;padding:32px 28px 60px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:24px;gap:16px}
.page-head h2{font-size:23px;font-weight:700;color:#0f172a;margin:0 0 6px}
.page-head p{font-size:13px;color:var(--text-2);margin:0}

/* ---------- 统计 ---------- */
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:20px}
.stat-card{background:#fff;border:1px solid var(--border);border-radius:14px;padding:20px;display:flex;align-items:center;gap:15px;box-shadow:var(--shadow)}
.stat-icon{width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;flex:none}
.stat-icon.indigo{background:#eef2ff;color:#4f46e5}
.stat-icon.blue{background:#eff6ff;color:#3b82f6}
.stat-icon.purple{background:#f5f3ff;color:#8b5cf6}
.stat-label{font-size:12.5px;color:var(--text-2);margin-bottom:5px;font-weight:500}
.stat-value{font-size:25px;font-weight:700;color:#0f172a;line-height:1}

/* ---------- 列表 ---------- */
.panel{background:#fff;border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}
.panel-head{padding:18px 20px;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid #f1f5f9}
.panel-title{font-size:15px;font-weight:700;color:#0f172a;display:flex;align-items:center;gap:9px}
.count-badge{font-size:11px;font-weight:700;background:#eef2ff;color:#4f46e5;padding:3px 9px;border-radius:20px}
.search-wrap{position:relative;width:250px;max-width:45%}
.search-wrap .icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:#a1adbd}
.search-wrap input{padding:9px 12px 9px 36px;font-size:13px;border-radius:9px;background:#fafbfc}
.table-scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;min-width:820px}
thead th{text-align:left;font-size:12px;font-weight:600;color:#94a3b8;background:#fafbfc;padding:12px 20px;letter-spacing:.3px;border-bottom:1px solid #f1f5f9}
tbody td{padding:15px 20px;border-bottom:1px solid #f4f6fa;font-size:13.5px;color:#334155;vertical-align:middle}
tbody tr{transition:background .15s}
tbody tr:hover{background:#fafbff}
tbody tr:last-child td{border-bottom:0}
.cell-name{font-weight:600;color:#1e293b;display:flex;align-items:center;gap:8px}
.name-dot{width:7px;height:7px;border-radius:50%;background:#6366f1;flex:none}
.badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:5px 10px;border-radius:20px}
.badge::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}
.badge.fixed{background:#eef2ff;color:#4f46e5}
.badge.random{background:#f5f3ff;color:#8b5cf6}
.url-box{display:inline-flex;align-items:center;gap:4px;max-width:100%;background:#f8fafc;border:1px solid #eef1f6;border-radius:8px;padding:4px 5px 4px 10px}
.url-box code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:230px}
.copy-btn{width:24px;height:24px;border:0;background:transparent;border-radius:6px;color:#9aa6b6;display:flex;align-items:center;justify-content:center;cursor:pointer;flex:none;transition:.15s}
.copy-btn:hover{background:#eef2ff;color:#4f46e5}
.copy-btn .icon{width:14px;height:14px}
.content-preview{color:#64748b;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px}
.actions{display:flex;justify-content:flex-end;gap:4px}
.icon-btn{width:30px;height:30px;border:0;background:transparent;border-radius:8px;color:#9aa6b6;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:.15s}
.icon-btn .icon{width:16px;height:16px}
.icon-btn.edit:hover{background:#eef2ff;color:#4f46e5}
.icon-btn.del:hover{background:#fef2f2;color:#ef4444}

.empty{padding:56px 20px;text-align:center}
.empty-icon{width:52px;height:52px;margin:0 auto 14px;border-radius:15px;background:#f1f5f9;color:#9aa6b6;display:flex;align-items:center;justify-content:center}
.empty-icon .icon{width:24px;height:24px}
.empty-title{font-size:15px;font-weight:600;color:#475569;margin-bottom:6px}
.empty-desc{font-size:13px;color:#9aa6b6}

.footer{text-align:center;font-size:12px;color:#a8b2c1;margin-top:30px}

/* ---------- 弹窗 ---------- */
.modal{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;padding:20px}
.modal-mask{position:absolute;inset:0;background:rgba(15,23,42,.42);backdrop-filter:blur(3px);animation:fadeIn .2s ease}
.modal-dialog{position:relative;background:#fff;border-radius:18px;width:100%;max-width:560px;max-height:90vh;overflow:auto;box-shadow:0 24px 70px rgba(15,23,42,.22);animation:pop .22s cubic-bezier(.2,.8,.2,1)}
.modal-sm{max-width:420px}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid #f1f5f9}
.modal-head h3{margin:0;font-size:17px;font-weight:700;color:#0f172a}
.form-body{padding:22px 24px 4px}
.mode-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.mode-option{cursor:pointer;display:block}
.mode-option input{position:absolute;opacity:0;width:0;height:0}
.mode-box{display:flex;align-items:flex-start;gap:10px;padding:13px;border:1.5px solid var(--border);border-radius:12px;transition:.18s;background:#fff}
.mode-box .icon{width:19px;height:19px;color:#a1adbd;margin-top:1px;flex:none}
.mode-box b{display:block;font-size:13.5px;color:#334155;margin-bottom:3px;font-weight:600}
.mode-box small{display:block;font-size:11.5px;color:#9aa6b6;line-height:1.45}
.mode-option input:checked + .mode-box{border-color:#818cf8;background:#f8f8ff;box-shadow:0 0 0 3px rgba(99,102,241,.08)}
.mode-option input:checked + .mode-box .icon{color:#4f46e5}
.mode-option input:checked + .mode-box b{color:#4338ca}
textarea{resize:vertical;min-height:130px;line-height:1.65;font-size:13.5px}
.field-hint{font-size:11.5px;color:#9aa6b6;margin-top:7px}
.code-box{background:#f8fafc;border:1px dashed #dbe2ec;border-radius:9px;padding:11px 13px}
.code-box code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;letter-spacing:1px;color:#4f46e5;font-weight:600}
.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:18px 24px;border-top:1px solid #f1f5f9;margin-top:22px}
.confirm-body{padding:28px 26px 8px;text-align:center}
.confirm-icon{width:50px;height:50px;margin:0 auto 14px;border-radius:50%;background:#fef2f2;color:#ef4444;display:flex;align-items:center;justify-content:center}
.confirm-icon .icon{width:23px;height:23px}
.confirm-body h3{margin:0 0 10px;font-size:17px;color:#0f172a}
.confirm-body p{margin:0;font-size:13.5px;line-height:1.7;color:#64748b}

/* ---------- 提示 ---------- */
.toast{
  position:fixed;top:24px;right:24px;z-index:200;display:flex;align-items:center;gap:10px;
  background:#1e293b;color:#fff;padding:12px 18px;border-radius:11px;font-size:13.5px;
  box-shadow:0 12px 30px rgba(15,23,42,.25);opacity:0;transform:translateY(-14px);
  pointer-events:none;transition:all .25s;max-width:340px;
}
.toast.show{opacity:1;transform:translateY(0)}
.toast .icon{width:17px;height:17px}
.toast.success .icon{color:#4ade80}
.toast.error .icon{color:#f87171}

@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes pop{from{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}

@media(max-width:900px){
  .stats{grid-template-columns:1fr}
}
@media(max-width:640px){
  .topbar-inner{padding:0 16px;height:60px}
  .container{padding:22px 16px 40px}
  .page-head{align-items:flex-start;flex-direction:column}
  .stats{grid-template-columns:1fr 1fr}
  .stat-card:first-child{grid-column:span 2}
  .login-card{padding:30px 24px}
  .mode-grid{grid-template-columns:1fr}
  .panel-head{flex-direction:column;align-items:stretch}
  .search-wrap{width:100%;max-width:100%}
  .brand-sub{display:none}
  .user-chip span{display:none}
  .toast{left:16px;right:16px;top:16px;max-width:none}
}
