:root {
  --bg: #0f1419;
  --bg2: #1a2332;
  --bg3: #243044;
  --card: #1e2a3a;
  --border: #2d3f56;
  --text: #e8eef6;
  --muted: #8fa3b8;
  --accent: #3d9cf0;
  --accent2: #2dd4a8;
  --danger: #f07178;
  --warn: #e6c07b;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: linear-gradient(160deg, #0c1220 0%, #152238 50%, #0f1a28 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: rgba(15, 22, 35, 0.95);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.5px;
}
.sidebar .brand-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 7px;
  display: block;
}
.sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: var(--muted);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: all .15s;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text);
  background: rgba(61, 156, 240, 0.08);
  border-left-color: var(--accent);
  text-decoration: none;
}
.main { flex: 1; padding: 28px 32px; overflow-x: auto; }
.page-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 8px; }
.page-desc { color: var(--muted); margin-bottom: 24px; font-size: 0.9rem; }
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.page-title-row .btn { flex-shrink: 0; white-space: nowrap; }

/* 支付方式选择 */
.pay-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}
.pay-method {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  margin: 0;
}
.pay-method:has(input:checked) {
  border-color: var(--accent);
  background: rgba(61, 156, 240, 0.12);
}
.pay-method input { margin: 0; }

/* 财务中心 */
.fin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px 24px;
  margin-bottom: 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(45, 212, 168, 0.14), transparent 55%),
    linear-gradient(135deg, #1a2638 0%, #152033 100%);
}
.fin-hero-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.fin-hero-balance {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.1;
  letter-spacing: 0.5px;
}
.fin-hero-balance small {
  font-size: 1rem;
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
}
.fin-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.fin-wallet-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: rgba(45, 212, 168, 0.15);
  color: var(--accent2);
}
.fin-wallet-chip.is-warn {
  background: rgba(230, 192, 123, 0.15);
  color: var(--warn);
}
.fin-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 4px;
}
@media (max-width: 900px) {
  .fin-grid { grid-template-columns: 1fr; }
}
.fin-panel h3 {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.fin-form .form-group:last-of-type { margin-bottom: 12px; }
.fin-form-tight { margin-bottom: 4px; }
.fin-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}
.fin-hint { color: var(--muted); font-size: 0.82rem; margin: 0 0 12px; line-height: 1.5; }
.fin-amount-row { display: flex; flex-direction: column; gap: 8px; }
.fin-amount-row .form-control { max-width: 200px; }
.fin-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.fin-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.fin-chip:hover { border-color: var(--accent); color: var(--text); }
.fin-pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.fin-pkg {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.fin-pkg-name { font-weight: 650; font-size: 1.05rem; }
.fin-pkg-days { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.fin-pkg-price {
  margin: 12px 0 8px;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent2);
}
.fin-pkg-desc {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 12px;
  flex: 1;
  line-height: 1.45;
}
.fin-pkg .pay-methods { margin-top: 0; }
.fin-pkg .btn { width: 100%; margin-top: 4px; }
.fin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.fin-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.fin-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.fin-tab-panel { display: none; }
.fin-tab-panel.is-active { display: block; }
.fin-table-wrap { overflow-x: auto; }
.fin-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }
.fin-ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ann-list { display: flex; flex-direction: column; gap: 0; }
.ann-item {
  display: block;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.ann-item:last-child { border-bottom: none; }
.ann-item:hover { background: rgba(255,255,255,0.02); text-decoration: none; color: var(--text); }
.ann-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.ann-title { font-weight: 600; }
.ann-time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.ann-summary {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stats-home {
  grid-template-columns: repeat(3, 1fr);
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .label { color: var(--muted); font-size: 0.85rem; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; color: var(--accent2); }
.stat-card-clean {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.stat-clean-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stat-clean-form {
  margin: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-clean-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  cursor: pointer;
  min-width: 0;
}
.stat-clean-name {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.stat-clean-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
@media (max-width: 800px) {
  .stats-home { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card h3 { margin-bottom: 14px; font-size: 1.05rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,0.02); }

.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-success { background: var(--accent2); color: #0a1a14; }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--warn); color: #1a1408; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.85rem; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-check input { width: 16px; height: 16px; }
.form-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 4px 0 10px;
}
.form-check-row .form-check { margin-bottom: 0; }

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-success { background: rgba(45, 212, 168, 0.15); border: 1px solid var(--accent2); color: var(--accent2); }
.alert-error { background: rgba(240, 113, 120, 0.15); border: 1px solid var(--danger); color: var(--danger); }
.alert-info { background: rgba(61, 156, 240, 0.15); border: 1px solid var(--accent); color: var(--accent); }

/* 自定义确认框 / Toast（替代系统 confirm / alert） */
.ui-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(4, 10, 18, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .18s ease;
}
.ui-backdrop.is-open { opacity: 1; }
.ui-modal {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, #243447 0%, #1a2636 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.45);
  padding: 22px 22px 18px;
  transform: translateY(10px) scale(0.98);
  transition: transform .18s ease;
}
.ui-backdrop.is-open .ui-modal { transform: translateY(0) scale(1); }
.ui-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 12px;
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}
.ui-modal-icon.is-warn {
  background: rgba(230, 192, 123, 0.15);
  color: var(--warn);
}
.ui-modal-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin-bottom: 6px;
}
.ui-modal-msg {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 18px;
}
.ui-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.ui-modal-actions .btn { min-width: 76px; }

.ui-toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.ui-toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #1e2a3a;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: uiToastIn .22s ease;
}
.ui-toast.is-out { animation: uiToastOut .2s ease forwards; }
.ui-toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--accent);
}
.ui-toast.is-success .ui-toast-dot { background: var(--accent2); }
.ui-toast.is-error .ui-toast-dot { background: var(--danger); }
.ui-toast.is-info .ui-toast-dot { background: var(--accent); }
.ui-toast-body { flex: 1; line-height: 1.45; }
.ui-toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.ui-toast-close:hover { color: var(--text); }
@keyframes uiToastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes uiToastOut {
  to { opacity: 0; transform: translateY(-6px); }
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--bg3);
  white-space: nowrap;
}
.badge-vip { background: rgba(230, 192, 123, 0.2); color: var(--warn); }
.badge-ok { background: rgba(45, 212, 168, 0.2); color: var(--accent2); }
.badge-off { background: rgba(143, 163, 184, 0.2); color: var(--muted); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
}
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 1.4rem; }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 0.9rem; }
.code-display {
  font-size: 2.4rem;
  letter-spacing: 12px;
  text-align: center;
  font-weight: 700;
  color: var(--accent2);
  padding: 20px;
  background: var(--bg);
  border-radius: 8px;
  margin: 16px 0;
}

.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
}
.tabs a.active, .tabs a:hover {
  background: var(--bg3);
  color: var(--text);
  text-decoration: none;
}

/* 列表操作按钮：桌面横排，移动端两列 */
.table-ops { white-space: nowrap; vertical-align: middle; }
.row-ops {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  vertical-align: middle;
}
.row-ops form {
  display: inline-flex;
  margin: 0;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* 可视化按钮编辑器 */
.btn-editor { margin: 12px 0 8px; }
.btn-editor-hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }
.btn-editor-preview {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  min-height: 48px;
}
.btn-preview-line {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 8px;
  width: 100%;
}
.btn-preview-line:last-child { margin-bottom: 0; }
.btn-preview-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: #fff;
  background: var(--accent);
  text-align: center;
  line-height: 1.3;
  word-break: break-all;
  box-sizing: border-box;
}
.btn-preview-chip.is-success { background: var(--accent2); color: #0a1a14; }
.btn-preview-chip.is-danger { background: var(--danger); }
.btn-preview-chip.is-primary { background: var(--accent); }
.btn-preview-chip.is-default { background: #5a6a7a; color: #fff; }
.btn-editor-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(0,0,0,0.12);
  transition: opacity .15s, box-shadow .15s;
}
.btn-editor-row.is-dragging { opacity: 0.55; box-shadow: 0 0 0 2px rgba(61,156,240,0.45); }
.btn-editor-row.is-drag-over { box-shadow: inset 0 0 0 2px var(--accent); }
.btn-editor-chips {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.btn-editor-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  max-width: 100%;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #fff;
  background: #5a6a7a;
  cursor: grab;
  user-select: none;
  line-height: 1.3;
  word-break: break-all;
}
.btn-editor-chip.is-primary { background: var(--accent); }
.btn-editor-chip.is-success { background: var(--accent2); color: #0a1a14; }
.btn-editor-chip.is-danger { background: var(--danger); }
.btn-editor-chip.is-dragging { opacity: 0.5; cursor: grabbing; }
.btn-editor-chip.is-drag-over { outline: 2px solid #fff; outline-offset: 2px; }
.btn-editor-chip-actions {
  display: none;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  gap: 2px;
  background: rgba(0,0,0,0.55);
  border-radius: 6px;
  padding: 2px;
}
.btn-editor-chip:hover .btn-editor-chip-actions { display: flex; }
.btn-editor-chip-actions button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 4px;
}
.btn-editor-chip-actions button:hover { background: rgba(255,255,255,0.18); }
.btn-editor-add-btn {
  border: 1px dashed rgba(61,156,240,0.55);
  background: rgba(61,156,240,0.12);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-editor-add-btn:hover { background: rgba(61,156,240,0.22); }
.btn-editor-row-handle {
  flex-shrink: 0;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: grab;
  font-size: 1.1rem;
  border-radius: 6px;
  user-select: none;
}
.btn-editor-row-handle:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn-editor-add-row {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-editor-add-row:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61,156,240,0.06);
}
.btn-editor-hidden { display: none !important; }

/* 按钮编辑子弹窗 */
.btned-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.btned-backdrop.is-open { display: flex; }
.btned-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}
.btned-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.btned-dialog-head h4 { margin: 0; font-size: 1rem; }
.btned-dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.btned-dialog-body { padding: 16px; }
.btned-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.btned-colors {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btned-color {
  width: 44px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.btned-color.is-default { background: #5a6a7a; }
.btned-color.is-primary { background: var(--accent); }
.btned-color.is-success { background: var(--accent2); }
.btned-color.is-danger { background: var(--danger); }
.btned-color.is-active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* 定时发送弹窗 */
.sch-hint { color: var(--muted); font-size: 0.82rem; margin: 0 0 8px; }
.sch-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow: auto;
}
.sch-backdrop.is-open { display: flex; }
.sch-dialog {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  margin-bottom: 40px;
}
.sch-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sch-dialog-head h3 { margin: 0; font-size: 1.1rem; }
.sch-dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.sch-dialog-body { padding: 18px 20px 20px; }
.sch-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.btn.is-disabled { opacity: 0.5; pointer-events: none; }

/* 进群欢迎排版 */
.welcome-page { width: 100%; max-width: none; }
.welcome-section { margin-bottom: 16px; }
.welcome-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.welcome-section-head h3 { margin: 0; font-size: 1.05rem; }
.welcome-section-sub { color: var(--muted); font-size: 0.82rem; }
.welcome-basics {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px 40px;
}
.tog-enable {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.tog-enable-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tog-enable-copy strong { font-size: 0.95rem; }
.tog-enable-copy small { color: var(--muted); font-size: 0.8rem; }
.tog-enable-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: #2a3340;
  border: 1px solid #3d4a5c;
  flex-shrink: 0;
}
.tog-enable-seg label {
  margin: 0;
  cursor: pointer;
}
.tog-enable-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tog-enable-seg span {
  display: block;
  min-width: 64px;
  padding: 7px 14px;
  border-radius: 6px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.tog-enable-seg label:hover span { color: var(--text); }
.tog-enable-seg input:checked + span {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.welcome-delete-group {
  margin: 0;
  flex: 0 0 auto;
  width: 180px;
}
.welcome-delete-group .form-control { max-width: 100%; }
.welcome-field-tip { color: var(--muted); font-size: 0.8rem; margin: 6px 0 0; line-height: 1.45; }
.welcome-content {
  min-height: 160px;
  width: 100%;
  line-height: 1.6;
  font-size: 0.95rem;
}
.welcome-vars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.welcome-vars-label { color: var(--muted); font-size: 0.8rem; margin-right: 2px; }
.welcome-var {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(61, 156, 240, 0.12);
  border: 1px solid rgba(61, 156, 240, 0.28);
  color: var(--accent);
  font-size: 0.8rem;
  cursor: default;
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0 8px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, var(--bg) 28%);
  padding-top: 16px;
}

.ad-rule-list { padding: 4px 0; }
.ad-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.ad-rule-row:hover {
  background: rgba(255,255,255,0.04);
}
.ad-rule-row:last-child { border-bottom: 0; }
.copy-mod-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 4px 0 8px;
}
.copy-mod-list .form-check {
  margin: 0;
  white-space: nowrap;
}
.copy-mod-all {
  width: 100%;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.ad-rule-name { font-size: 0.95rem; }
.ad-rule-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mute-mode-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 4px 0 8px;
}
.mute-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 16px;
  padding: 4px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  width: fit-content;
  max-width: 100%;
}
.mute-subtabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.2;
}
.mute-subtabs button:hover {
  color: var(--text);
  background: var(--bg3);
}
.mute-subtabs button.active {
  color: var(--text);
  background: var(--bg3);
  font-weight: 600;
}
.mute-panel[hidden] { display: none !important; }
.mute-ops {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  vertical-align: middle;
}
.mute-ops .btn,
.mute-ops form .btn {
  min-width: 52px;
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
  margin: 0;
}
.mute-ops form {
  display: inline-flex;
  margin: 0;
}
.mem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.mem-table th,
.mem-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.mem-table th {
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.mem-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  white-space: nowrap;
  align-items: center;
}
.mem-ops form {
  display: inline;
  margin: 0;
}
#memPtsModal { z-index: 1200; }
.mem-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.ad-act-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
}
.ad-kw-box {
  width: 100%;
  min-height: 220px;
  max-height: 50vh;
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.ad-act-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-height: 36px;
}
.ad-act-label {
  flex: 0 0 auto;
  min-width: 8.5em;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
}
.ad-act-select {
  width: auto;
  min-width: 160px;
  max-width: 100%;
  flex: 0 1 220px;
  height: 36px;
}
.ad-act-hint {
  color: var(--muted);
  font-size: 0.8rem;
  flex: 1 1 160px;
  line-height: 1.4;
}
.ad-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.ad-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}
/* 必须 inline-block，否则 span 的宽高不生效，只剩白圆点 */
.ad-switch-ui {
  display: inline-block;
  box-sizing: border-box;
  width: 40px;
  height: 20px;
  border-radius: 10px;
  background: #5a6578;
  border: none;
  vertical-align: middle;
  transition: background .2s ease;
  position: relative;
  flex-shrink: 0;
}
.ad-switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform .2s ease;
}
.ad-switch input:checked + .ad-switch-ui {
  background: #409eff;
}
.ad-switch input:checked + .ad-switch-ui::after {
  transform: translateX(20px);
}
.ad-switch input:focus-visible + .ad-switch-ui {
  outline: 2px solid rgba(64,158,255,.5);
  outline-offset: 2px;
}
.ad-switch:hover .ad-switch-ui {
  filter: brightness(1.08);
}

.ar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.ar-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
}
.ar-search .form-control {
  max-width: 280px;
  min-width: 180px;
}

/* 富文本编辑器 */
.rte { margin-top: 4px; }
.rte-source { display: none !important; }
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(0,0,0,0.2);
}
.rte-toolbar button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  min-width: 32px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 8px;
}
.rte-toolbar button:hover {
  background: rgba(61,156,240,0.15);
  border-color: rgba(61,156,240,0.35);
}
.rte-editor {
  border-radius: 0 0 8px 8px !important;
  min-height: 110px;
  max-height: 360px;
  overflow: auto;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.rte-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.rte-editor:focus {
  outline: none;
  border-color: var(--accent);
}
.rte-editor img.rte-photo {
  display: block;
  max-width: min(100%, 320px);
  max-height: 180px;
  margin: 0 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.15);
}
.rte-inline-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: rgba(0, 0, 0, 0.18);
}
.rte-inline-panel[hidden] { display: none !important; }
.rte-inline-panel .rte-panel-input {
  flex: 1 1 180px;
  min-width: 0;
  height: 32px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.rte-inline-panel .btn { height: 32px; padding: 0 12px; }

/* 变量说明：按窗口宽度自动多列排列 */
.var-tips { margin-top: 10px; }
.var-tips-title {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.var-tips-title span { opacity: 0.85; }
.var-tips-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 8px;
}
.var-tip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
}
.var-tip-item:hover {
  border-color: rgba(61,156,240,0.45);
  background: rgba(61,156,240,0.08);
}
.var-tip-item code {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(61,156,240,0.14);
  border: 1px solid rgba(61,156,240,0.28);
  color: var(--accent);
  font-size: 0.78rem;
}
.var-tip-item span {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .var-tips-list {
    grid-template-columns: 1fr;
  }
  .var-tip-item span {
    white-space: normal;
  }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 0; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .sidebar nav a.active { border-bottom-color: var(--accent); }
  .main { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
  }
  .tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 9px 6px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
  }
  .tabs a:hover {
    background: var(--bg3);
    color: var(--text);
    text-decoration: none;
  }
  .tabs a.active {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--accent);
    text-decoration: none;
  }

  .page-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-title-row .btn {
    width: 100%;
    text-align: center;
  }

  /* 列表转卡片，操作按钮两排 */
  .m-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  .m-list-table thead { display: none; }
  .m-list-table tbody { display: block; }
  .m-list-table tr {
    display: block;
    margin-bottom: 10px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
  }
  .m-list-table tr:last-child { margin-bottom: 0; }
  .m-list-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 6px 0;
    border: none;
    white-space: normal;
    word-break: break-word;
  }
  .m-list-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.82rem;
    flex: 0 0 5.5em;
    line-height: 1.4;
  }
  .m-list-table td.table-ops {
    display: block;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }
  .m-list-table td.table-ops::before {
    display: block;
    margin-bottom: 8px;
  }
  .m-list-table td .empty {
    width: 100%;
    text-align: center;
    padding: 16px 0;
  }
  .m-list-table td.empty,
  .m-list-table td:has(.empty) {
    display: block;
    text-align: center;
    padding: 16px 8px;
    color: var(--muted);
  }
  .m-list-table td.empty::before,
  .m-list-table td:has(.empty)::before { display: none; }

  .table-ops { white-space: normal; min-width: 0; }
  .row-ops {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .row-ops .btn,
  .row-ops form .btn {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    text-align: center;
  }
  .row-ops form { display: block; width: 100%; margin: 0; }
}

/* 积分兑换弹窗 */
.pts-ex-dialog { max-width: 860px; }
.pts-goods-dialog { max-width: 560px; }
#ptsGoodsModal { z-index: 1200; }
#ptsContentModal { z-index: 1250; }
#ptsPreviewModal { z-index: 1300; }
.pts-content-dialog { max-width: 720px; }
.pts-ex-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: -4px 0 18px;
}
.pts-ex-tabs a {
  padding: 10px 16px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.95rem;
}
.pts-ex-tabs a:hover { color: var(--text); }
.pts-ex-tabs a.active {
  color: var(--primary, #3b82f6);
  border-bottom-color: var(--primary, #3b82f6);
  font-weight: 600;
}
.pts-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pts-form-row-top { align-items: flex-start; }
.pts-form-row > label {
  width: 168px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text);
  line-height: 1.4;
  padding-top: 0;
}
.pts-form-row-top > label { padding-top: 8px; }
.pts-form-row .pts-field { flex: 1; min-width: 0; }
.pts-form-row .req { color: #ef4444; }
.pts-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}
.pts-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg, #fff);
}
.pts-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg3, #eef2ff);
  color: var(--primary, #3b82f6);
  font-size: 0.875rem;
}
.pts-tag-x {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  opacity: 0.7;
}
.pts-tag-x:hover { opacity: 1; }
.pts-tag-input {
  flex: 1;
  min-width: 120px;
  border: 0;
  outline: none;
  background: transparent;
  padding: 4px 0;
  color: var(--text);
  font: inherit;
}
.pts-msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pts-msg-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2, rgba(0,0,0,0.02));
}
.pts-cond-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.pts-goods-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pts-goods-search { flex: 1; min-width: 180px; max-width: 280px; }
.pts-goods-table-wrap { overflow-x: auto; }
.pts-goods-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.pts-goods-table th,
.pts-goods-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.pts-goods-table thead th {
  background: var(--bg3, #f5f5f5);
  font-weight: 600;
  color: var(--muted);
}
.pts-preview-box {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2, #fafafa);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
  line-height: 1.5;
}
.form-control.is-readonly,
.form-control[readonly] {
  background: var(--bg3, #f3f4f6);
  color: var(--muted);
  cursor: default;
}
@media (max-width: 640px) {
  .pts-form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .pts-form-row > label,
  .pts-form-row-top > label {
    width: auto;
    text-align: left;
    padding-top: 0;
  }
  .pts-cond-grid { grid-template-columns: 1fr; }
  .pts-ex-dialog { max-width: 100%; }
}
