/* ============================================================
   公众号账号管家后台管理 - 通用样式（淡紫色主题）
   ============================================================ */

:root {
  --primary: #7C6CF0;
  --primary-light: #9b8ef5;
  --primary-dark: #6354E0;
  --primary-bg: rgba(124, 108, 240, 0.06);
  --primary-border: rgba(124, 108, 240, 0.25);
  --bg: #f5f6fa;
  --sidebar-bg: #fff;
  --card: #fff;
  --text: #1f2329;
  --text-secondary: #8a919f;
  --text-light: #b0b3bb;
  --border: #e5e6eb;
  --border-light: #f0f1f3;
  --danger: #f53f3f;
  --success: #52c41a;
  --warning: #faad14;
  --info: #1890ff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 220px;
  --header-height: 56px;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

button { cursor: pointer; font-family: inherit; }

/* ============================================================
   登录页
   ============================================================ */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-bg {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-bg::before,
.login-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
}
.login-bg::before {
  width: 400px; height: 400px;
  background: #7C6CF0;
  top: -100px; left: -100px;
}
.login-bg::after {
  width: 300px; height: 300px;
  background: #a78bfa;
  bottom: -80px; right: -60px;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 12px 40px rgba(124, 108, 240, 0.15);
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #7C6CF0, #6354E0);
  color: #fff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(124, 108, 240, 0.3);
}
.login-brand h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.login-brand p {
  font-size: 13px;
  color: var(--text-secondary);
}
.login-form .form-item {
  margin-bottom: 18px;
}
.login-form label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.login-form input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}
.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.1);
}
.btn-primary {
  background: linear-gradient(135deg, #7C6CF0, #6354E0);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(124, 108, 240, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; height: 42px; }
.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}

/* ============================================================
   主布局
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border-light);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #d0d3d9; border-radius: 2px; }

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #7C6CF0, #6354E0);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-menu {
  flex: 1;
  padding: 12px 0;
}
.menu-group-title {
  font-size: 12px;
  color: var(--text-light);
  padding: 10px 20px 6px;
  letter-spacing: 0.5px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-size: 13px;
}
.menu-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
.menu-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}
.menu-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
}

/* 主内容区 */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 顶部栏 */
.header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.breadcrumb-sep { color: var(--text-light); margin: 0 4px; }
.breadcrumb-current { color: var(--text); font-weight: 500; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.header-user:hover { background: var(--bg); }
.header-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C6CF0, #6354E0);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.header-username { font-size: 13px; color: var(--text); }

/* 内容区 */
.content {
  flex: 1;
  padding: 20px 24px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.page-actions { display: flex; gap: 8px; }

/* ============================================================
   通用组件
   ============================================================ */

/* 按钮 */
.btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-primary {
  background: linear-gradient(135deg, #7C6CF0, #6354E0);
  color: #fff;
  border: none;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 2px 8px rgba(124, 108, 240, 0.3); }
.btn-default {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #fbc4c4;
}
.btn-danger:hover { background: #fff1f0; border-color: var(--danger); }
.btn-text {
  background: transparent;
  color: var(--primary);
  border: none;
  padding: 4px 8px;
}
.btn-text:hover { color: var(--primary-dark); background: var(--primary-bg); }
.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { background: rgba(245, 63, 63, 0.08); }

/* 卡片 */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.stat-icon.purple { background: linear-gradient(135deg, #7C6CF0, #6354E0); }
.stat-icon.green { background: linear-gradient(135deg, #52c41a, #389e0d); }
.stat-icon.blue { background: linear-gradient(135deg, #1890ff, #096dd9); }
.stat-icon.orange { background: linear-gradient(135deg, #fa8c16, #d46b08); }
.stat-icon svg { width: 24px; height: 24px; }
.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}
.stat-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 搜索栏 */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.search-bar .form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.search-bar label {
  font-size: 12px;
  color: var(--text-secondary);
}
.search-bar input,
.search-bar select {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  min-width: 160px;
  background: #fff;
}
.search-bar input:focus,
.search-bar select:focus { border-color: var(--primary); }
.search-bar .btn { height: 34px; }

/* 表格 */
.table-wrapper {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: #fafbfc;
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-danger { background: #fff1f0; color: #f53f3f; border: 1px solid #ffa39e; }
.tag-warning { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.tag-info { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tag-default { background: #f5f6f8; color: #8a919f; border: 1px solid #e5e6eb; }
.tag-primary { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-border); }

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 16px;
}
.pagination-total {
  margin-right: auto;
  font-size: 13px;
  color: var(--text-secondary);
}
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.page-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.page-jump input {
  width: 50px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 13px;
  outline: none;
}
.page-jump input:focus { border-color: var(--primary); }

/* 空状态 */
.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--text-light);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-text { font-size: 14px; }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-lg { width: 640px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close {
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 表单 */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.form-item {
  flex: 1;
  min-width: 0;
}
.form-item label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-item input,
.form-item select,
.form-item textarea {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.08); }
.form-item textarea { resize: vertical; min-height: 80px; }
.form-item .hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 35, 41, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 2000;
  max-width: 320px;
  text-align: center;
}
.toast.success { background: rgba(82, 196, 26, 0.95); }
.toast.error { background: rgba(245, 63, 63, 0.95); }
.toast.warning { background: rgba(250, 173, 20, 0.95); }

/* 确认弹窗 */
.confirm-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}
.confirm-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 360px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.confirm-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.confirm-message { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 用户信息下拉 */
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  padding: 4px 0;
  margin-top: 4px;
  z-index: 100;
}
.user-dropdown-item {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-item.danger { color: var(--danger); }
.user-dropdown-item.danger:hover { background: #fff1f0; }

/* Tab 切换 */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.tab-item {
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  user-select: none;
}
.tab-item:hover {
  color: var(--primary);
}
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* 卡片头部和内容 */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.card-body {
  padding: 16px 20px;
}
