:root {
  --bg: #080a10;
  --bg-2: #0c0f17;
  --panel: rgba(255, 255, 255, 0.036);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);
  --txt: #e9ebf2;
  --txt-2: #9aa0b2;
  --txt-3: #666c7e;
  --accent: #6d5efc;
  --accent-2: #a78bfa;
  --douyin: #fe2c55;
  --kuaishou: #ff7a1a;
  --up: #ff5252;
  --down: #17c964;
  --warn: #f7a03b;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(109, 94, 252, 0.16), transparent 65%),
    radial-gradient(700px 460px at 92% 4%, rgba(254, 44, 85, 0.08), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.11); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ---------- 侧边栏 ---------- */
.side {
  width: 232px;
  flex: 0 0 232px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.008));
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #6d5efc, #b06bf7 55%, #fe2c55);
  display: grid; place-items: center;
  font-weight: 600; font-size: 15px; color: #fff;
  box-shadow: 0 8px 22px -8px rgba(109, 94, 252, 0.85);
  flex: 0 0 36px;
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: 0.2px; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--txt-3); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--txt-2); cursor: pointer;
  font-size: 13.5px; border: 1px solid transparent;
  transition: background .16s, color .16s, border-color .16s;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; opacity: .85; flex: 0 0 17px; }
.nav-item:hover { background: var(--panel); color: var(--txt); }
.nav-item.on {
  background: linear-gradient(100deg, rgba(109, 94, 252, 0.24), rgba(109, 94, 252, 0.06));
  color: #fff; border-color: rgba(127, 120, 255, 0.32);
}
.nav-item.on::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent-2);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.9);
}
.nav-badge {
  margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 20px;
  background: rgba(239, 68, 68, 0.18); color: #ff8a8a; border: 1px solid rgba(239, 68, 68, 0.3);
}

.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.ok { background: var(--down); box-shadow: 0 0 9px rgba(23, 201, 100, .8); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 9px rgba(239, 68, 68, .8); }
.side-foot .row { font-size: 11.5px; color: var(--txt-3); display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.96), rgba(8, 10, 16, 0.72));
  backdrop-filter: blur(14px);
}
.page-title { font-size: 18px; font-weight: 600; letter-spacing: 0.2px; }
.page-sub { font-size: 12px; color: var(--txt-3); margin-top: 3px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { padding: 22px 28px 60px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--panel); color: var(--txt);
  font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all .16s; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: rgba(255,255,255,.24); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #6d5efc, #8b5cf6);
  border-color: transparent; color: #fff; font-weight: 500;
  box-shadow: 0 10px 26px -12px rgba(109, 94, 252, 0.95);
}
.btn.primary:hover { filter: brightness(1.09); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff9494; border-color: rgba(239, 68, 68, 0.32); background: rgba(239, 68, 68, 0.08); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.16); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-link {
  background: none; border: none; color: var(--accent-2);
  cursor: pointer; font-size: 12.5px; padding: 2px 4px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #ff9494; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-desc { font-size: 12px; color: var(--txt-3); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid.c4, .grid.c3, .grid.c2 { grid-template-columns: 1fr; } }

.stat {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.stat:hover { border-color: var(--line-2); transform: translateY(-1px); }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 94, 252, 0.16), transparent 70%);
}
.stat-label { font-size: 11.5px; color: var(--txt-3); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 27px; font-weight: 600; margin: 9px 0 4px; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; color: var(--txt-3); font-weight: 400; margin-left: 3px; }
.stat-sub { font-size: 11.5px; color: var(--txt-3); }
.stat-sub b { color: var(--txt-2); font-weight: 500; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- 徽标 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px;
  border: 1px solid var(--line-2); color: var(--txt-2); background: var(--panel);
}
.chip.douyin { color: #ff7b96; border-color: rgba(254, 44, 85, 0.32); background: rgba(254, 44, 85, 0.1); }
.chip.kuaishou { color: #ffa361; border-color: rgba(255, 122, 26, 0.32); background: rgba(255, 122, 26, 0.1); }
.chip.ok { color: #6ee7a8; border-color: rgba(23, 201, 100, 0.32); background: rgba(23, 201, 100, 0.1); }
.chip.warn { color: #ffc078; border-color: rgba(247, 160, 59, 0.32); background: rgba(247, 160, 59, 0.1); }
.chip.err { color: #ff9a9a; border-color: rgba(239, 68, 68, 0.32); background: rgba(239, 68, 68, 0.1); }
.chip.mute { color: var(--txt-3); }
.chip.accent { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.35); background: rgba(167, 139, 250, 0.12); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 500; font-size: 11.5px;
  color: var(--txt-3); padding: 11px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  background: rgba(255,255,255,.016);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: middle; }
tbody tr { transition: background .13s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.028); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 500; color: var(--txt); }
.cell-sub { font-size: 11.5px; color: var(--txt-3); margin-top: 3px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--txt-2); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--txt-3); margin-top: 5px; line-height: 1.5; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-2);
  color: var(--txt); font-size: 13px; font-family: inherit;
  outline: none; transition: border-color .16s, background .16s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(139, 125, 255, 0.7); background: rgba(255, 255, 255, 0.07); }
input::placeholder, textarea::placeholder { color: var(--txt-3); }
select option { background: #12151f; color: var(--txt); }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; min-width: 0; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 40px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 20px; cursor: pointer;
  background: rgba(255,255,255,.14); transition: .2s;
}
.switch span::before {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: .2s;
}
.switch input:checked + span { background: linear-gradient(135deg, #6d5efc, #a78bfa); }
.switch input:checked + span::before { transform: translateX(18px); }

.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px; border-radius: 9px; background: rgba(255,255,255,.045); border: 1px solid var(--line-2); min-height: 40px; }
.tag-input .tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 7px; background: rgba(109,94,252,.2); border: 1px solid rgba(127,120,255,.35); font-size: 12px; }
.tag-input .tag b { cursor: pointer; color: #b9aefc; font-weight: 400; }
.tag-input input { border: none; background: transparent; flex: 1; min-width: 70px; padding: 3px; }

/* ---------- 空态 / 加载 ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--txt-3); }
.empty .ico { font-size: 26px; opacity: .5; margin-bottom: 10px; }
.empty p { font-size: 13px; margin-bottom: 14px; line-height: 1.7; }
.center { display: grid; place-items: center; padding: 60px; color: var(--txt-3); font-size: 13px; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.16); border-top-color: var(--accent-2);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 6, 12, 0.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 20px 40px; overflow-y: auto;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 620px;
  background: linear-gradient(180deg, #141824, #0d1018);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: pop .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { margin-left: auto; background: none; border: none; color: var(--txt-3); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--txt); }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  padding: 11px 16px; border-radius: 10px; font-size: 13px;
  background: #171b27; border: 1px solid var(--line-2);
  box-shadow: var(--shadow); animation: slide .2s ease;
  max-width: 360px; line-height: 1.5;
}
.toast.ok { border-left: 3px solid var(--down); }
.toast.err { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent-2); }
@keyframes slide { from { transform: translateX(20px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- 图表 ---------- */
.chart { width: 100%; overflow: visible; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .78; }

/* ---------- 详情 ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kv .item { padding: 12px 14px; border-radius: 11px; background: rgba(255,255,255,.032); border: 1px solid var(--line); }
.kv .k { font-size: 11.5px; color: var(--txt-3); margin-bottom: 6px; }
.kv .v { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }

.rule-card { padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); transition: border-color .18s; }
.rule-card:hover { border-color: var(--line-2); }
.rule-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rule-name { font-size: 14px; font-weight: 600; }
.rule-desc { font-size: 12.5px; color: var(--txt-2); line-height: 1.7; }
.rule-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.rule-acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.cond-row { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.cond-row select, .cond-row input { flex: 1; }
.cond-row .btn { flex: 0 0 auto; }

.notice {
  padding: 12px 14px; border-radius: 11px; font-size: 12.5px; line-height: 1.7;
  background: rgba(109, 94, 252, 0.09); border: 1px solid rgba(127, 120, 255, 0.25); color: #c9c2ff;
}
.notice.warn { background: rgba(247, 160, 59, 0.09); border-color: rgba(247, 160, 59, 0.3); color: #ffd0a1; }
.notice b { font-weight: 600; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.list-line { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 13px; align-items: center; }
.list-line:last-child { border-bottom: none; }
.list-line .grow { flex: 1; min-width: 0; }
.list-line .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-line .s { font-size: 11.5px; color: var(--txt-3); margin-top: 3px; }

.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.search-box { position: relative; }
.search-box input { padding-left: 30px; width: 220px; }
.search-box svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; opacity: .45; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 16px; font-size: 12px; color: var(--txt-3); }

.sec-title { font-size: 12px; color: var(--txt-3); margin: 20px 0 10px; letter-spacing: .4px; }

/* ---------- 扫码绑定 ---------- */
.qr-plats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-plat {
  padding: 16px 14px; border-radius: 12px; cursor: pointer; text-align: center;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.qr-plat:hover { border-color: var(--line-2); }
.qr-plat.on { border-color: var(--accent); background: rgba(109,94,252,.09); box-shadow: 0 0 0 3px rgba(109,94,252,.14); }
.qr-plat-name { font-size: 14px; font-weight: 600; }
.qr-plat-sub { font-size: 11.5px; color: var(--txt-3); margin-top: 4px; }

.qr-warn {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 9px; font-size: 12px; line-height: 1.65;
  color: #f0c78b; background: rgba(240,160,75,.08); border: 1px solid rgba(240,160,75,.26);
}
.qr-steps { margin: 18px 0 16px; display: grid; gap: 9px; }
.qr-step { display: flex; gap: 9px; font-size: 12.5px; color: var(--txt-2); align-items: flex-start; line-height: 1.6; }
.qr-step b {
  width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 1px;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
  background: rgba(255,255,255,.07); color: var(--txt-2);
}

.qr-center { display: flex; flex-direction: column; align-items: center; gap: 13px; padding: 6px 0 2px; }
.qr-frame {
  padding: 12px; border-radius: 14px; background: #fff;
  box-shadow: 0 12px 44px rgba(0,0,0,.55);
}
.qr-frame img { display: block; width: 208px; height: 208px; border-radius: 4px; }
.qr-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--txt); }
.qr-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); animation: pulse 1.5s ease-in-out infinite; }
.qr-status.scanned .dot { background: #f0a04b; }
.qr-status.success .dot { background: var(--down); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .22 } }
.qr-tip { font-size: 11.5px; color: var(--txt-3); line-height: 1.6; text-align: center; }
.qr-actions { display: flex; gap: 16px; align-items: center; }
.qr-ok, .qr-fail {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  font-size: 26px; font-weight: 600;
}
.qr-ok { color: #3ecf8e; background: rgba(62,207,142,.1); border: 1px solid rgba(62,207,142,.35); }
.qr-fail { color: #ff6b6b; background: rgba(255,107,107,.09); border: 1px solid rgba(255,107,107,.3); }
.btn.lg { padding: 11px 20px; font-size: 13.5px; }
