/* =====================================================================
   联派会员中台 设计系统（移动优先，自适应 PC）
   无第三方框架，原生 CSS，轻量易维护
   ===================================================================== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-light: #9ca3af;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(17, 24, 39, .06);
  --shadow-lg: 0 8px 28px rgba(17, 24, 39, .12);
  --maxw: 640px;
  --navh: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* 移动端容器：手机满宽，PC 居中手机化卡片 */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 16px; }
.container-fluid { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

/* 表单：大触控目标，适合手指输入 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; color: var(--text-sub); margin-bottom: 7px; font-weight: 500; }
.form-control, input, select, textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 16px; /* >=16px 防止 iOS 聚焦缩放 */
  color: var(--text);
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, background .15s;
}
textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; }
input::placeholder, textarea::placeholder { color: var(--text-light); }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 5px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-control { flex: 1; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 48px; padding: 0 20px;
  font-size: 16px; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: opacity .15s, transform .05s;
  text-align: center; width: 100%;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: #f3f4f6; color: var(--text); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; width: auto; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 验证码按钮 */
.code-btn { min-width: 124px; white-space: nowrap; }

/* 标签 / 徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #dcfce7; color: var(--success); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-gray { background: #f3f4f6; color: var(--text-sub); }
.badge-warning { background: #fef3c7; color: var(--warning); }

/* 顶部品牌头 */
.app-header {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff; padding: 22px 18px 26px;
  border-radius: 0 0 22px 22px;
}
.app-header .brand { font-size: 20px; font-weight: 700; }
.app-header .slogan { font-size: 13px; opacity: .9; margin-top: 4px; }

/* 会员信息条 */
.member-bar { display: flex; align-items: center; gap: 14px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: #e5e7eb; flex-shrink: 0; }
.avatar-sm { width: 38px; height: 38px; }
.avatar-lg { width: 76px; height: 76px; }
.member-meta { flex: 1; min-width: 0; }
.member-name { font-size: 17px; font-weight: 600; }
.member-sub { font-size: 13px; color: var(--text-sub); margin-top: 2px; }

/* 数据统计格 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-cell { background: #f9fafb; border-radius: var(--radius-sm); padding: 14px 8px; text-align: center; }
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-sub); margin-top: 3px; }
.stat-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

/* 平台宫格导航（参考 m 站 apps） */
.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.platform-item {
  background: #f9fafb; border-radius: var(--radius); padding: 16px 8px;
  text-align: center; color: var(--text); transition: box-shadow .15s, transform .05s;
  display: block;
}
.platform-item:active { transform: scale(.96); }
.platform-icon { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.platform-name { font-size: 13px; font-weight: 500; }
.platform-desc { font-size: 11px; color: var(--text-light); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 列表 */
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 500; }
.list-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* 底部导航（移动端固定） */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: var(--navh); background: #fff; border-top: 1px solid var(--border);
  display: flex; max-width: var(--maxw); margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-light); gap: 3px;
}
.tabbar a .ico { font-size: 20px; }
.tabbar a.active { color: var(--primary); font-weight: 600; }
.page-pad { padding-bottom: calc(var(--navh) + 16px); }

/* 表格（后台，移动端横向滚动） */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
table.data th, table.data td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { background: #f9fafb; color: var(--text-sub); font-weight: 600; }
table.data tr:hover td { background: #fafbff; }

/* 后台布局：移动端顶部抽屉，PC 端侧栏 */
.admin-body { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #111827; color: #d1d5db;
  display: none; flex-direction: column; flex-shrink: 0;
}
.sidebar .logo { padding: 20px 18px; font-size: 17px; font-weight: 700; color: #fff; border-bottom: 1px solid #1f2937; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 13px 18px; color: #d1d5db; font-size: 14px; }
.sidebar a.nav:hover { background: #1f2937; color: #fff; }
.sidebar a.nav.active { background: var(--primary); color: #fff; }
.admin-main { flex: 1; min-width: 0; background: var(--bg); }
.admin-topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  position: sticky; top: 0; z-index: 20;
}
.menu-toggle { display: inline-flex; font-size: 22px; background: none; border: none; cursor: pointer; color: var(--text); }
.admin-content { padding: 16px; }

/* 移动端侧栏抽屉 */
.sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; z-index: 60; height: 100vh; }
.mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
.mask.show { display: block; }

/* 推荐树 */
.tree { list-style: none; padding-left: 0; margin: 0; }
.tree ul { list-style: none; padding-left: 22px; margin: 0; border-left: 1px dashed var(--border); }
.tree-node { padding: 8px 0; }
.tree-card { display: flex; align-items: center; gap: 10px; background: #f9fafb; border-radius: 10px; padding: 8px 12px; }
.tree-toggle { cursor: pointer; color: var(--primary); user-select: none; min-width: 18px; }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 18px 0 4px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; color: var(--text);
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-light); }

/* 提示条 */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); }
.alert-warning { background: #fef3c7; color: var(--warning); }
.alert-danger { background: #fee2e2; color: var(--danger); }
.alert-success { background: #dcfce7; color: var(--success); }

/* 工具类 */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; }
.text-center { text-align: center; } .text-sub { color: var(--text-sub); } .text-light { color: var(--text-light); }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; } .font-bold { font-weight: 700; }
.w-full { width: 100%; } .flex-1 { flex: 1; min-width: 0; }
.copy-box { display: flex; gap: 8px; align-items: center; background: #f9fafb; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all; font-size: 13px; }
.empty { text-align: center; color: var(--text-light); padding: 40px 0; font-size: 14px; }
.section-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.section-tabs a { white-space: nowrap; padding: 8px 16px; border-radius: 999px; background: #fff; color: var(--text-sub); font-size: 14px; border: 1px solid var(--border); }
.section-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 登录/授权页 */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-hero { background: linear-gradient(135deg, var(--primary), #4f46e5); color: #fff; padding: 44px 24px 36px; text-align: center; border-radius: 0 0 28px 28px; }
.auth-hero .logo-mark { font-size: 46px; }
.auth-hero h1 { margin: 10px 0 4px; font-size: 24px; }
.auth-hero p { margin: 0; opacity: .92; font-size: 14px; }
.auth-body { flex: 1; padding: 24px 20px; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.divider { display: flex; align-items: center; color: var(--text-light); font-size: 13px; margin: 22px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { padding: 0 14px; }

/* toast */
#toast {
  position: fixed; left: 50%; top: 42%; transform: translateX(-50%);
  background: rgba(17,24,39,.9); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; z-index: 999; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 80%; text-align: center;
}
#toast.show { opacity: 1; }

/* PC 自适应 */
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .menu-toggle { display: none; }
  .mask { display: none !important; }
  .stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .platform-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1100px) {
  .platform-grid { grid-template-columns: repeat(5, 1fr); }
}
