/* ============================================================
   本草植物饮 H5 商城系统 · 公共样式
   移动端优先；管理后台复用（.admin- 前缀）
   ============================================================ */
:root {
  --primary: #2f7d5c;
  --primary-dark: #215943;
  --primary-light: #eaf4ee;
  --gold: #b98a2f;
  --gold-light: #f7efdc;
  --danger: #c0392b;
  --text: #24332b;
  --text-sub: #6b7a72;
  --bg: #f4f7f3;
  --card: #ffffff;
  --border: #e3ebe4;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(33, 89, 67, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- 移动端容器 ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 72px;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 16px 18px 14px;
  border-radius: 0 0 22px 22px;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.topbar .sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 9px 0 8px;
  font-size: 11px;
  color: var(--text-sub);
  text-decoration: none;
}
.bottom-nav a .ico { font-size: 20px; display: block; line-height: 1.2; }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 14px;
}
.card h3 { font-size: 15px; margin-bottom: 10px; }
.card .muted { font-size: 12px; color: var(--text-sub); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gold { background: var(--gold); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 14px; font-size: 13px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary); }
.tip { font-size: 12px; color: var(--text-sub); margin-top: 6px; }

/* ---------- 徽标 / 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.tag.green { background: var(--primary-light); color: var(--primary); }
.tag.gold { background: var(--gold-light); color: var(--gold); }
.tag.gray { background: #eef1ee; color: var(--text-sub); }
.tag.red { background: #fdecea; color: var(--danger); }

/* ---------- 金额 ---------- */
.money { color: var(--danger); font-weight: 700; }
.money.big { font-size: 22px; }
.money.plain { color: var(--primary); }

/* ---------- 列表 ---------- */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .l { font-size: 14px; }
.list-item .r { font-size: 14px; color: var(--text-sub); text-align: right; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--text-sub); padding: 34px 0; font-size: 13px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 32, 25, 0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999;
  display: none;
  max-width: 80%;
}
#toast.show { display: block; }

/* ---------- 阶梯 / 权益块 ---------- */
.tier-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 12px 14px;
  background: #fff;
}
.tier-card.hot { border-color: var(--gold); background: linear-gradient(180deg, #fffdf7, #fff); }
.tier-card .tier-name { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.tier-card.hot .tier-name { color: var(--gold); }
.tier-card ul { list-style: none; margin: 10px 0; }
.tier-card ul li { font-size: 13px; color: var(--text); padding: 4px 0 4px 20px; position: relative; }
.tier-card ul li::before { content: '✓'; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.tier-card.hot ul li::before { color: var(--gold); }

/* ---------- 分节 ---------- */
.section-title { font-size: 15px; font-weight: 700; margin: 18px 14px 2px; color: var(--text); }

/* ---------- 管理后台 ---------- */
.admin-shell { display: flex; min-height: 100vh; max-width: 1400px; margin: 0 auto; }
.admin-side {
  width: 220px;
  background: var(--primary-dark);
  color: #fff;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-side .brand { font-size: 16px; font-weight: 700; padding: 6px 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 10px; }
.admin-side a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
}
.admin-side a:hover, .admin-side a.active { background: rgba(255,255,255,0.14); color: #fff; }
.admin-main { flex: 1; padding: 20px 24px; max-width: calc(100% - 220px); }
.admin-main h2 { font-size: 20px; margin-bottom: 16px; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.admin-toolbar input, .admin-toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.admin-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table th { color: var(--text-sub); font-weight: 600; background: #fafcfa; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--primary-dark); }
.stat-card .label { font-size: 12px; color: var(--text-sub); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 820px) {
  .admin-side { width: 62px; padding: 12px 6px; }
  .admin-side .brand { font-size: 12px; padding: 6px 4px 14px; text-align: center; }
  .admin-side a { font-size: 12px; text-align: center; padding: 10px 2px; }
  .admin-main { max-width: none; padding: 14px; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- 登录分隔 ---------- */
.divider { text-align: center; color: var(--text-sub); font-size: 13px; margin: 16px 0; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--border); }
.divider::before { left: 0; }
.divider::after { right: 0; }

/* 链接 */
.link { color: var(--primary); text-decoration: none; font-size: 14px; }
.mt10 { margin-top: 10px; }
.mb8 { margin-bottom: 8px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }