/* ============================================================
   云商汇 · 全球多商户商城  设计系统
   金色华商美学 · 象牙白底 · 玻璃拟态
   ============================================================ */
:root {
  --gold: #C9A25B;
  --gold-bright: #E2B86C;
  --gold-deep: #A8843F;
  --gold-pale: #F6EBD6;
  --bg: #FAF7F2;
  --bg-soft: #F3EEE5;
  --card: #FFFFFF;
  --ink: #241E15;
  --ink-soft: #6B5D4A;
  --line: #EDE4D3;
  --pink: #C44D8C;
  --green: #3E8E6E;
  --red: #C0524E;
  --blue: #4A7FA5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(168, 132, 63, 0.08), 0 1px 2px rgba(168, 132, 63, 0.04);
  --shadow-md: 0 8px 28px rgba(168, 132, 63, 0.12);
  --shadow-lg: 0 20px 50px rgba(168, 132, 63, 0.18);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }

::selection { background: var(--gold-pale); color: var(--gold-deep); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D8C9A8; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all .2s ease; white-space: nowrap; line-height: 1.2;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: #fff; box-shadow: 0 4px 14px rgba(168, 132, 63, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(168, 132, 63, 0.45); }
.btn-outline { border: 1px solid var(--gold); color: var(--gold-deep); background: #fff; }
.btn-outline:hover { background: var(--gold-pale); }
.btn-ghost { color: var(--ink-soft); background: var(--bg-soft); }
.btn-ghost:hover { background: var(--gold-pale); }
.btn-danger { background: #FBECEA; color: var(--red); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); outline: none; transition: border .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 91, 0.15);
}
.textarea { min-height: 90px; resize: vertical; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 247, 242, 0.86); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; height: 64px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.brand .logo-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.brand .logo-mark svg { width: 20px; height: 20px; }
.topbar-nav { display: flex; gap: 4px; flex: 1; }
.topbar-nav a, .topbar-nav span {
  padding: 8px 14px; border-radius: 8px; color: var(--ink-soft); font-weight: 500;
  cursor: pointer; transition: all .2s; font-size: 14px;
}
.topbar-nav a:hover, .topbar-nav span:hover, .topbar-nav .active { color: var(--gold-deep); background: var(--gold-pale); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-gold { background: var(--gold-pale); color: var(--gold-deep); }
.badge-green { background: #E4F2EC; color: var(--green); }
.badge-red { background: #FBECEA; color: var(--red); }
.badge-gray { background: var(--bg-soft); color: var(--ink-soft); }
.badge-blue { background: #E8F0F6; color: var(--blue); }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  background: linear-gradient(160deg, #fff, #FDFAF3);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(226, 184, 108, 0.15), transparent 70%); border-radius: 50%;
}
.stat-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--gold-deep); margin-top: 6px; letter-spacing: .5px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line); }
th { background: var(--bg-soft); color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FCF9F2; }

/* ---------- 商品网格 ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.product-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all .25s ease; position: relative;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--gold-bright); }
.product-card .thumb { aspect-ratio: 1/1; overflow: hidden; background: var(--bg-soft); position: relative; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--gold); }
.product-card .body { padding: 14px; }
.product-card .name { font-size: 14px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 40px; }
.product-card .shop { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.product-card .price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.product-card .price { font-size: 18px; font-weight: 800; color: var(--gold-deep); }
.product-card .price .sym { font-size: 12px; }
.product-card .market { font-size: 12px; color: var(--ink-soft); text-decoration: line-through; }
.product-card .points-tag { position: absolute; top: 10px; left: 10px; }

/* ---------- 店铺卡片 ---------- */
.shop-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: all .25s; display: flex; gap: 16px; align-items: center;
}
.shop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--gold-bright); }
.shop-avatar { width: 60px; height: 60px; border-radius: 14px; overflow: hidden; background: var(--gold-pale); flex: none; display: flex; align-items: center; justify-content: center; color: var(--gold-deep); font-weight: 800; font-size: 22px; }
.shop-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(36, 30, 21, 0.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: #fff; border-radius: 18px; padding: 28px; width: 100%; max-width: 520px;
  max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  padding: 12px 22px; border-radius: 10px; color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-md); animation: toastIn .3s ease; background: var(--ink);
}
.toast.success { background: linear-gradient(135deg, #3E8E6E, #2E6B53); }
.toast.error { background: linear-gradient(135deg, #C0524E, #963C39); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty svg { width: 64px; height: 64px; color: #D8C9A8; margin-bottom: 12px; }
.empty .t { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 50% 0%, var(--gold-pale), var(--bg) 60%); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; margin-bottom: 8px; }
.auth-card .sub { text-align: center; color: var(--ink-soft); margin-bottom: 24px; font-size: 13px; }
.auth-vision { text-align: center; margin: -8px 0 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(160deg, #fff, var(--gold-pale)); }
.auth-vision .av-role { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--gold-deep); margin-bottom: 4px; }
.auth-vision .av-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.auth-vision .av-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.auth-vision .av-tags span { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--gold-pale); color: var(--gold-deep); font-weight: 600; }
.tab-switch { display: flex; background: var(--bg-soft); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab-switch span { flex: 1; text-align: center; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--ink-soft); font-weight: 600; transition: all .2s; }
.tab-switch span.active { background: #fff; color: var(--gold-deep); box-shadow: var(--shadow-sm); }

/* ---------- 侧边栏后台 ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #241E15; color: #E8DFCE; flex: none;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { color: #fff; padding: 20px 22px; font-size: 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.sidebar-nav .group-label { font-size: 11px; color: #8A7D66; padding: 12px 10px 6px; letter-spacing: 1px; }
.sidebar-nav .item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: #C9BEA8; cursor: pointer; margin-bottom: 2px; font-size: 14px; transition: all .2s;
}
.sidebar-nav .item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav .item.active { background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #fff; font-weight: 600; }
.sidebar-nav .item svg { width: 17px; height: 17px; flex: none; }
.admin-main { flex: 1; min-width: 0; padding: 28px 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h2 { font-size: 22px; font-weight: 800; }
.page-head .desc { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 20px; }
.pager button { padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-weight: 600; }
.pager button:disabled { opacity: .4; }
.pager .cur { background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }

/* ---------- 移动端底部导航 ---------- */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 120;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(168, 132, 63, 0.08);
}
.mobile-nav div {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; cursor: pointer; color: var(--ink-soft); font-size: 11px;
  transition: color .2s;
}
.mobile-nav div svg { width: 20px; height: 20px; }
.mobile-nav div.active { color: var(--gold-deep); font-weight: 700; }

/* ---------- 消息中心 ---------- */
.msg-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.msg-tabs span { padding: 7px 16px; border-radius: 9px; cursor: pointer; color: var(--ink-soft); font-weight: 600; font-size: 13px; background: var(--bg-soft); transition: all .2s; }
.msg-tabs span.active { background: var(--gold-deep); color: #fff; }
.msg-item {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px;
  cursor: pointer; transition: all .2s;
}
.msg-item:hover { border-color: var(--gold-bright); box-shadow: var(--shadow-sm); }
.msg-item.unread { background: #FDF9EF; border-color: var(--gold-pale); }
.msg-item.unread .msg-title { font-weight: 800; }
.msg-ico {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-pale); color: var(--gold-deep);
}
.msg-item.unread .msg-ico { background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #fff; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-title { font-size: 15px; font-weight: 600; }
.msg-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--ink-soft); flex: none; }
.msg-content { font-size: 13px; color: var(--ink-soft); margin-top: 4px; line-height: 1.5; }
.msg-time { font-size: 11px; color: #B3A588; margin-top: 6px; }
.msg-del { flex: none; align-self: center; }

/* ---------- 会员等级 ---------- */
.level-card {
  display: flex; align-items: center; gap: 16px; padding: 18px;
  border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px;
  background: #fff; transition: all .2s;
}
.level-card.cur { background: linear-gradient(160deg, #fff, #FDF9EF); }
.level-ico {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.level-body { flex: 1; min-width: 0; }
.level-name { font-size: 16px; font-weight: 800; display: flex; align-items: center; }
.level-growth { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.level-benefits { font-size: 13px; color: var(--ink-soft); margin-top: 6px; line-height: 1.5; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -230px; transition: left .25s; z-index: 150; }
  .sidebar.open { left: 0; }
  .admin-main { padding: 20px 16px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .topbar-nav { display: none; }
  .mobile-nav { display: flex; }
  .container { padding: 0 14px; }
  .topbar-inner { height: 56px; }
  .brand { font-size: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 20px; }
  .card { padding: 16px; }
  .coupon-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .coupon-card .cc-left { width: 90px; }
  .coupon-card .cc-amt { font-size: 24px; }
  .modal { padding: 20px; margin: 12px; }
  .page-head h2 { font-size: 18px; }
  .page-head { margin-bottom: 16px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card .name { font-size: 13px; min-height: 36px; }
  .shop-grid { grid-template-columns: 1fr; }
  .pd-grid, .uc-grid, .rp-grid { grid-template-columns: 1fr !important; }
  .bar-chart { gap: 4px; }
  .bar-label { font-size: 9px; }
}
@media (max-width: 480px) {
  .coupon-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 10px 10px; font-size: 12px; }
}
