/* ===== 管理后台全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-w: 220px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ===== 通用按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 14px; cursor: pointer;
  transition: all .2s; font-weight: 500;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: none; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; }
.btn-success { background: var(--success); color: #fff; border: none; }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-warning { background: var(--warning); color: #fff; border: none; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 500; font-size: 13px; color: #334155; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ===== 卡片 ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
thead th {
  text-align: left; padding: 13px 16px; background: #f8fafc;
  font-size: 13px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ===== 徽章/标签 ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #047857; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-primary { background: #e0e7ff; color: #4338ca; }
.badge-muted { background: #f1f5f9; color: #64748b; }
.badge-gold { background: #fef3c7; color: #92400e; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 16px; background: #fff; border-top: 1px solid var(--border); }
.pagination button { padding: 6px 12px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-muted); }

/* ===== 工具条 ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.toolbar .left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box { display: flex; gap: 8px; }

/* ===== 登录/注册页 ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  padding: 20px;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-card {
  background: #fff; border-radius: 20px; padding: 36px 34px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo .logo-icon {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), #d946ef);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
}
.auth-logo h1 { font-size: 22px; font-weight: 700; }
.auth-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.auth-tabs .tab {
  flex: 1; text-align: center; padding: 9px; border-radius: 8px;
  cursor: pointer; font-weight: 500; color: var(--text-muted);
  border: 1px solid var(--border);
}
.auth-tabs .tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.auth-foot { text-align: center; margin-top: 18px; color: var(--text-muted); font-size: 13px; }
.auth-foot a { color: var(--primary); cursor: pointer; }
.oauth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; color: var(--text-muted); font-size: 12px; }
.oauth-divider::before, .oauth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.oauth-btns { display: flex; gap: 12px; justify-content: center; }
.oauth-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .2s;
}
.oauth-btn:hover { border-color: var(--primary); }
.oauth-btn.wechat { color: #07c160; }
.oauth-btn.alipay { color: #1677ff; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-muted); }
.checkbox input { margin-top: 2px; }
.checkbox a { color: var(--primary); }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
}
.sidebar .brand {
  padding: 22px 20px; font-size: 17px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #d946ef);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.sidebar .nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar .nav .group-title { font-size: 11px; color: #64748b; padding: 12px 10px 6px; text-transform: uppercase; letter-spacing: 1px; }
.sidebar .nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px;
  border-radius: 8px; color: #94a3b8; font-size: 14px; transition: all .2s; margin-bottom: 2px;
}
.sidebar .nav a:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar .nav a.active { background: var(--primary); color: #fff; }
.sidebar .nav a .icon { width: 20px; text-align: center; }
.sidebar .foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar .foot .user { display: flex; align-items: center; gap: 10px; }
.sidebar .foot .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; flex-shrink: 0;
}
.sidebar .foot .name { font-size: 13px; color: #e2e8f0; }
.sidebar .foot .logout { font-size: 12px; color: #64748b; cursor: pointer; }
.main { flex: 1; margin-left: var(--sidebar-w); padding: 24px; min-width: 0; }
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ===== 顶部导航栏（小屏） ===== */
.topbar-mobile { display: none; }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.stat-card .s-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.stat-card .s-icon.blue { background: #e0e7ff; }
.stat-card .s-icon.green { background: #d1fae5; }
.stat-card .s-icon.purple { background: #ede9fe; }
.stat-card .s-icon.orange { background: #ffedd5; }
.stat-card .s-num { font-size: 24px; font-weight: 700; }
.stat-card .s-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px; display: none;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-header .close { cursor: pointer; font-size: 22px; color: var(--text-muted); border: none; background: none; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Toast 通知 ===== */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px; border-radius: 10px; color: #fff; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2); min-width: 240px; animation: slideIn .3s;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast.warning { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 拖拽排序 ===== */
.sortable-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: #fff; cursor: grab; }
.sortable-item .handle { cursor: grab; color: var(--text-muted); }
.sortable-item .drag-active { opacity: 0.4; }

/* ===== 开关 ===== */
.switch { position: relative; width: 46px; height: 26px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 26px; background: #cbd5e1; transition: .3s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  border-radius: 50%; background: #fff; transition: .3s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ===== 上传区 ===== */
.upload-box {
  border: 2px dashed var(--border); border-radius: 10px; padding: 24px; text-align: center;
  color: var(--text-muted); cursor: pointer; transition: all .2s; margin-bottom: 14px;
}
.upload-box:hover { border-color: var(--primary); background: #f8fafc; }
.upload-box .icon { font-size: 30px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.preview-item { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: #f1f5f9; }
.preview-item img, .preview-item video { width: 100%; height: 100%; object-fit: cover; }
.preview-item .del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; border: none; cursor: pointer; font-size: 12px; }
.preview-item .drag { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,0.5); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: grab; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty .icon { font-size: 40px; margin-bottom: 12px; }

/* ===== 二维码展示 ===== */
.qrcode-display { text-align: center; padding: 10px; }
.qrcode-display img { max-width: 260px; width: 100%; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: .3s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; }
  .topbar-mobile {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #0f172a; color: #fff;
    position: sticky; top: 0; z-index: 90;
  }
  .topbar-mobile .menu-btn { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
