/* ── 微信风格基础 ── */
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #333;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* ── 微信绿主题 ── */
:root {
  --wx-green: #07c160;
  --wx-green-dark: #06ad56;
  --wx-green-light: #e8f8ef;
  --wx-blue: #1989fa;
  --wx-red: #fa5151;
  --wx-orange: #ff9800;
  --wx-bg: #f5f5f5;
  --wx-card: #ffffff;
  --wx-border: #e5e5e5;
  --wx-text: #333333;
  --wx-text-light: #888888;
  --wx-text-lighter: #b2b2b2;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ── 容器 ── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--wx-bg);
}

/* ── 顶部导航 ── */
.nav-bar {
  background: var(--wx-green);
  color: white;
  padding: 16px 20px;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-bar .back {
  position: absolute;
  left: 16px;
  cursor: pointer;
  font-size: 20px;
  text-decoration: none;
  color: white;
}
.nav-bar .nav-title {
  flex: 1;
}

/* ── 卡片 ── */
.card {
  background: var(--wx-card);
  margin: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 16px 8px;
  font-size: 13px;
  color: var(--wx-text-light);
}
.card-body { padding: 0 16px 16px; }

/* ── 按钮 ── */
.btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--wx-green); color: white; }
.btn-primary:hover { background: var(--wx-green-dark); }
.btn-danger { background: var(--wx-red); color: white; }
.btn-outline {
  background: transparent;
  color: var(--wx-green);
  border: 1px solid var(--wx-green);
}
.btn-sm {
  display: inline-block;
  width: auto;
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 6px;
}
.btn-disabled {
  background: #ccc;
  color: #999;
  cursor: not-allowed;
}
.btn-orange { background: var(--wx-orange); color: white; }

/* ── 表单 ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 14px;
  color: var(--wx-text-light);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--wx-border);
  border-radius: 8px;
  font-size: 16px;
  background: #fafafa;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus { border-color: var(--wx-green); background: white; }

/* ── 状态标签 ── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.tag-green { background: var(--wx-green-light); color: var(--wx-green-dark); }
.tag-orange { background: #fff3e0; color: #e65100; }
.tag-red { background: #ffebee; color: #c62828; }
.tag-blue { background: #e3f2fd; color: #1565c0; }
.tag-gray { background: #f0f0f0; color: #666; }

/* ── 空状态 ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--wx-text-lighter);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 14px; }

/* ── Tab 切换 ── */
.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--wx-border);
  position: sticky;
  top: 52px;
  z-index: 50;
}
.tab-item {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  font-size: 14px;
  color: var(--wx-text-light);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  border: none;
  background: transparent;
}
.tab-item.active {
  color: var(--wx-green);
  font-weight: 600;
}
.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--wx-green);
  border-radius: 2px;
}

/* ── 列表项 ── */
.list-item {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #f5f5f5;
}
.list-item:last-child { border-bottom: none; }
.list-item .avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .name { font-size: 15px; font-weight: 500; }
.list-item .desc { font-size: 12px; color: var(--wx-text-light); margin-top: 2px; }
.list-item .actions { flex-shrink: 0; margin-left: 8px; }

/* ── Toast 提示 ── */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  text-align: center;
  max-width: 260px;
}
.toast.show { opacity: 1; }

/* ── 加载动画 ── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--wx-text-lighter);
  font-size: 14px;
}
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--wx-border);
  border-top-color: var(--wx-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 统计卡片 ── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
  margin-top: 12px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .number { font-size: 28px; font-weight: 700; color: var(--wx-green); }
.stat-card .label { font-size: 12px; color: var(--wx-text-light); margin-top: 4px; }

/* ── 管理端表格 ── */
.admin-table { width: 100%; overflow-x: auto; }
.admin-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.admin-table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--wx-text-light);
  font-size: 12px;
}
.admin-table td { color: var(--wx-text); }

/* ── 套餐卡片 ── */
.plan-cards { padding: 0 16px; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.plan-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s;
}
.plan-card:hover { border-color: var(--wx-green-light); }
.plan-card.selected { border-color: var(--wx-green); }
.plan-card .plan-name { font-size: 18px; font-weight: 600; }
.plan-card .plan-price { font-size: 22px; font-weight: 700; color: var(--wx-green); margin: 4px 0; }
.plan-card .plan-desc { font-size: 13px; color: var(--wx-text-light); }

/* ── 搜索框 ── */
.search-bar {
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid var(--wx-border);
}
.search-bar input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--wx-border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: #f5f5f5;
}
.search-bar input:focus { border-color: var(--wx-green); background: white; }

/* ── 动画 ── */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── 日志时间线 ── */
.timeline-item {
  padding: 10px 16px;
  border-left: 2px solid var(--wx-border);
  margin-left: 12px;
  position: relative;
  margin-bottom: 4px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wx-green);
  border: 2px solid white;
}
.timeline-item .time { font-size: 11px; color: var(--wx-text-lighter); }
.timeline-item .action { font-size: 13px; color: var(--wx-text); }

/* ── 底部安全区 ── */
.safe-bottom { height: 40px; }
