:root {
  --bg: #0b0e11; --card: #151a21; --card2: #1a1f28; --border: #232a33;
  --text: #cdd6e0; --muted: #7a8494; --accent: #5b8def; --accent2: #7c5ce7;
  --green: #0ec97a; --red: #f43f5e; --amber: #f59e0b; --purple: #a855f7;
}
* { box-sizing: border-box; }
button, [onclick], label, .btn, .btn-sm, .btn-outline, .gm-select, .tab-btn, .top-btn, [role=button] { cursor: pointer; }
button, .btn, .btn-sm, .top-btn { transition: filter 0.5s, background 0.5s, color 0.5s; }
button:active, .btn:active, .btn-sm:active, .top-btn:active { filter: brightness(0.7); transition: filter 0s; }
body { margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); min-height: 100dvh; padding-bottom: calc(env(safe-area-inset-bottom) + 70px); letter-spacing: 0.02em; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
@media (max-width: 480px) {
  body { padding-bottom: calc(env(safe-area-inset-bottom) + 80px); }
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  input, textarea { font-size: 16px !important; padding: 10px 12px; }
  select { font-size: 16px !important; padding: 10px 12px; }
  #login-fp-select, #login-proxy-type { font-size: 11px !important; padding: 4px 8px; }
  .bc-fallback-text { font-size: 10px !important; padding: 6px 8px !important; }
  .bc-save-inp { font-size: 8px !important; }
  .bc-search-input { font-size: 12px !important; padding: 6px 8px !important; }
  .card { padding: 12px; border-radius: 12px; }
  .top-bar { gap: 3px; padding: 4px 6px; }
  .top-bar .top-btn { padding: 5px 8px; font-size: 10px; }
  .top-bar .top-icon { width: 28px; height: 28px; font-size: 14px; }
  #vip-subtitle-hint { font-size: 9px; }
}
.tab-btn { transition: all .2s; color: var(--muted); }
.tab-btn.active { color: var(--accent); }
.tab-panel { display: none; animation: fadeIn .25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.card2 { background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
input, select, textarea { background: #11161d; border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 13px; width: 100%; outline: none; transition: border .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width:14px; height:14px; cursor: pointer; }
input[type=number] { padding: 6px 8px; -moz-appearance:textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.bc-fallback-text { font-size: 10px !important; padding: 6px 8px !important; }
.bc-save-inp { font-size: 12px !important; }
input[type=time] { padding: 6px 8px; }
.gm-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: #151a21 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8494' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
  border: 1px solid #2a3340;
  border-radius: 10px;
  padding: 7px 32px 7px 12px;
  font-size: 11px;
  color: #cdd6e0;
  width: 100%;
  cursor: pointer;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.gm-select:hover { border-color:#3b4a5a; }
.gm-select:focus { border-color:#5b8def; box-shadow:0 0 0 3px rgba(91,141,239,.15); }
.gm-select option { background:#151a21; color:#cdd6e0; padding:6px; }
#login-fp-select, #login-proxy-type { font-size: 11px; padding: 6px 32px 6px 10px; }
#login-proxy-type { width: 88px; flex: none; }
.btn { padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; transition: all .2s; width: 100%; }
.btn:active { filter: brightness(0.7); transition: filter 0s; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-purple { background: var(--accent2); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #000; }
.btn-outline { background: transparent; border:1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 8px; width: auto; cursor: pointer; transition: filter 0.5s, background 0.5s, color 0.5s; }
.btn-sm:active { filter: brightness(0.7); transition: filter 0s; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 500; }
.badge-green { background: rgba(14,201,122,.15); color: var(--green); }
.badge-red { background: rgba(244,63,94,.15); color: var(--red); }
.badge-amber { background: rgba(245,158,11,.15); color: var(--amber); }
.badge-purple { background: rgba(168,85,247,.15); color: var(--purple); }
.badge-gray { background: rgba(122,132,148,.15); color: var(--muted); }
.toast { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); z-index:99999; padding:10px 20px; border-radius:10px; font-size:13px; font-weight:500; animation: toastIn .3s ease; cursor:pointer; background:rgba(255,255,255,0.2); backdrop-filter:blur(8px); border:1px solid rgba(255,255,255,0.1); color:#fff; }
@keyframes toastIn { from { opacity:0; transform:translate(-50%,-50%) scale(.9); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }
.toast-success { background:rgba(255,255,255,0.1); color:#cdd6e0; }
.toast-error { background:rgba(255,255,255,0.1); color:#cdd6e0; }
.toast-info { background:rgba(255,255,255,0.1); color:#cdd6e0; }
.spinner { display:inline-block; width:16px;height:16px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation: spin .6s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
::-webkit-scrollbar { width:4px; } ::-webkit-scrollbar-thumb { background:var(--border); border-radius:4px; }

/* Monitor rule builder */
#tab-monitor { color:#c5ced9; font-size:11px; line-height:1.5; }
#tab-monitor .card, #tab-monitor .card2 { color:#c5ced9; }
#tab-monitor .text-\[9px\], #tab-monitor .text-\[10px\] { color:#7f8998; }
#tab-monitor input, #tab-monitor select, #tab-monitor textarea { color:#cbd3de; }
.mon-feature-card { margin:0 0 10px; padding:12px 13px; border:1px solid rgba(255,255,255,.07); border-left-width:3px; border-radius:10px; background:rgba(255,255,255,.022); color:#c5ced9; font-size:11px; }
.mon-feature-head { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:10px; min-height:26px; }
.mon-feature-head > span:first-child { color:#d3dae4 !important; font-size:12px !important; font-weight:650; }
.mon-feature-card .text-\[10px\] { color:#7f8998; }
.mon-feature-listen { border-left-color:rgba(45,212,191,.52); background:rgba(45,212,191,.025); }
.mon-feature-keyword { border-left-color:rgba(245,158,11,.50); background:rgba(245,158,11,.025); }
.mon-feature-filter { border-left-color:rgba(168,85,247,.52); background:rgba(168,85,247,.025); }
.mon-feature-bot { border-left-color:rgba(14,201,122,.48); background:rgba(14,201,122,.022); }
.mon-feature-dm { border-left-color:rgba(91,141,239,.52); background:rgba(91,141,239,.025); }
.mon-feature-params { border-left-color:rgba(148,163,184,.48); background:rgba(148,163,184,.022); }
.mon-filter-title { display:flex; flex-direction:column; gap:2px; min-width:0; }
.mon-filter-title > span { color:var(--text); font-size:12px; font-weight:650; white-space:nowrap; }
.mon-filter-title small { color:var(--muted); font-size:9px; font-weight:400; white-space:nowrap; }
.mon-filter-save { margin-left:auto; width:auto; flex:0 0 auto; padding:7px 12px; border-radius:8px; border:1px solid rgba(14,201,122,.25); background:rgba(14,201,122,.15); color:var(--green); font-size:11px; font-weight:600; white-space:nowrap; }
.mon-filter-body { display:flex; flex-direction:column; gap:12px; padding-top:4px; }
.mon-filter-presets { display:flex; align-items:center; flex-wrap:wrap; gap:7px; padding:10px; border-radius:9px; background:rgba(91,141,239,.055); border:1px solid rgba(91,141,239,.12); }
.mon-filter-presets > span { color:var(--muted); font-size:10px; margin-right:2px; white-space:nowrap; }
.mon-filter-presets button { width:auto; padding:6px 10px; border:1px solid rgba(255,255,255,.08); border-radius:7px; background:rgba(255,255,255,.055); color:var(--text); font-size:10px; white-space:nowrap; }
.mon-filter-presets button.danger { color:#fda4af; }
.mon-rule-group { padding:10px 0 10px 12px; border:0; border-left:2px solid rgba(255,255,255,.09); border-radius:0; background:transparent; }
.mon-rule-group-head { display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding-bottom:10px; }
.mon-rule-group-title { min-width:150px; font-size:11px; font-weight:650; white-space:nowrap; }
.mon-rule-logic { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:10px; white-space:nowrap; }
.mon-rule-logic select { width:112px; min-width:112px; height:32px; padding:5px 30px 5px 10px; font-size:11px; white-space:nowrap; }
.mon-rule-add { margin-left:auto; width:auto; padding:6px 10px; border:1px solid rgba(91,141,239,.2); border-radius:7px; background:rgba(91,141,239,.1); color:#8fb1ff; font-size:10px; white-space:nowrap; }
.mon-rule-list { display:flex; flex-direction:column; gap:9px; }
.mon-rule-condition { display:grid; grid-template-columns:minmax(156px,1.25fr) minmax(118px,.9fr) minmax(160px,1.45fr) 34px; gap:8px; align-items:end; padding:10px; border-radius:9px; background:rgba(0,0,0,.16); border:1px solid rgba(255,255,255,.055); }
.mon-rule-control { display:flex; flex-direction:column; gap:5px; min-width:0; }
.mon-rule-control > span { color:var(--muted); font-size:9px; line-height:1; white-space:nowrap; }
.mon-rule-control select, .mon-rule-control input { width:100%; min-width:0; height:36px; padding:7px 32px 7px 10px; border-radius:8px; font-size:11px; line-height:20px; white-space:nowrap; text-overflow:ellipsis; }
.mon-rule-control input { padding-right:10px; }
.mon-rule-field select { min-width:156px; }
.mon-rule-operator select { min-width:118px; }
.mon-rule-remove { width:34px; height:36px; padding:0; border:1px solid rgba(244,63,94,.16); border-radius:8px; background:rgba(244,63,94,.08); color:#fb7185; font-size:18px; line-height:1; }
.mon-rule-empty { padding:16px 12px; border:1px dashed rgba(255,255,255,.08); border-radius:8px; color:var(--muted); font-size:10px; text-align:center; }
.mon-filter-hint { padding:9px 10px; border-radius:8px; background:rgba(245,158,11,.055); color:var(--muted); font-size:9px; line-height:1.6; }

@media (max-width: 640px) {
  #tab-monitor { padding-left:10px !important; padding-right:10px !important; font-size:10px; }
  .mon-feature-card { margin-bottom:8px; padding:10px; border-radius:9px; font-size:10px; }
  .mon-feature-head { margin-bottom:8px; min-height:22px; gap:6px; }
  .mon-feature-head > span:first-child { font-size:11px !important; }
  .mon-filter-save { padding:8px 11px; font-size:11px; }
  .mon-filter-body { gap:11px; }
  .mon-filter-presets { align-items:stretch; padding:10px; }
  .mon-filter-presets > span { width:100%; margin-bottom:1px; }
  .mon-filter-presets button { flex:1 1 calc(50% - 4px); min-height:34px; }
  .mon-rule-group { padding:8px 0 8px 9px; }
  .mon-rule-group-head { align-items:flex-start; gap:9px; }
  .mon-rule-group-title { width:100%; min-width:0; font-size:12px; }
  .mon-rule-logic { flex:1 1 auto; }
  .mon-rule-logic select { width:128px; min-width:128px; }
  .mon-rule-add { margin-left:0; min-height:36px; }
  .mon-rule-condition { grid-template-columns:minmax(0,1.65fr) minmax(82px,.72fr); gap:8px; padding:10px; }
  .mon-rule-control select, .mon-rule-control input { height:38px; font-size:14px !important; padding-top:7px; padding-bottom:7px; }
  .mon-rule-field { grid-column:1; }
  .mon-rule-operator { grid-column:2; }
  .mon-rule-value { grid-column:1 / -1; }
  .mon-rule-field select { min-width:0; }
  .mon-rule-operator select { min-width:82px; padding-left:8px; padding-right:24px; }
  .mon-rule-remove { grid-column:1 / -1; width:100%; height:32px; font-size:13px; }
  .mon-rule-remove::after { content:' 删除条件'; font-size:11px; vertical-align:1px; }
}
