:root {
  --primary: #2f6df0;
  --primary-dark: #1f54c4;
  --accent: #ff7a1a;
  --ok: #1aa260;
  --err: #e23b3b;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2530;
  --muted: #8a93a3;
  --border: #e6e9ef;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(20, 30, 60, .06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* 顶部导航 */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  height: 60px; display: flex; align-items: center; gap: 20px;
}
.logo { font-weight: 800; font-size: 18px; color: var(--primary); white-space: nowrap; }
.logo small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: var(--text); font-weight: 500; }
.nav a:hover { color: var(--primary); text-decoration: none; }
.topbar .right { display: flex; gap: 12px; align-items: center; }

/* 容器 */
.container { max-width: 1200px; margin: 20px auto; padding: 0 16px; }
.container-narrow { max-width: 720px; margin: 30px auto; padding: 0 16px; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2, .card h3 { margin: 0 0 14px; font-size: 16px; }

/* 栅格 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* 商品卡 */
.product {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: .15s; display: flex; flex-direction: column;
}
.product:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product .cover {
  aspect-ratio: 1/1; background: #eef1f6 center/cover no-repeat; display: block;
}
.product .body { padding: 12px; }
.product .title { font-weight: 600; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .price { color: var(--accent); font-weight: 800; font-size: 18px; }
.product .price small { color: var(--muted); font-weight: 500; font-size: 12px; }
.product .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-size: 14px; font-weight: 600;
  transition: .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: #fff; border-color: var(--err); color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 表单 */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-weight: 600; margin-bottom: 6px; }
.form-item .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=tel],
select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { min-height: 110px; resize: vertical; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { background: #f7f9fc; font-weight: 600; color: #465062; white-space: nowrap; }
.table tr:hover td { background: #fafbfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* 标签 */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.8; }
.tag-gray { background: #eef1f6; color: #6b7486; }
.tag-blue { background: #e6f0ff; color: var(--primary); }
.tag-green { background: #e3f6ec; color: var(--ok); }
.tag-orange { background: #fff0e2; color: var(--accent); }
.tag-red { background: #fde6e6; color: var(--err); }
.tag-yellow { background: #fff7df; color: #b88900; }

/* 统计卡 */
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.stat .value.accent { color: var(--accent); }
.stat .value.primary { color: var(--primary); }
.stat .value.ok { color: var(--ok); }

/* 登录/注册专用 */
.auth-wrap { max-width: 420px; margin: 50px auto; }
.auth-wrap .card { padding: 28px; }
.auth-wrap h1 { font-size: 20px; text-align: center; margin: 0 0 6px; }
.auth-wrap .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }

/* 侧边布局（后台/商家） */
.layout { display: flex; min-height: calc(100dvh - 60px); }
.sidebar { width: 210px; background: #0f1b34; color: #cdd6e6; flex-shrink: 0; padding: 16px 0; }
.sidebar .brand { padding: 0 18px 14px; font-weight: 800; color: #fff; border-bottom: 1px solid #22324f; margin-bottom: 10px; }
.sidebar a { display: block; padding: 10px 18px; color: #cdd6e6; border-left: 3px solid transparent; }
.sidebar a:hover, .sidebar a.active { background: #16264a; color: #fff; text-decoration: none; border-left-color: var(--primary); }
.sidebar .spacer { flex: 1; }
.main { flex: 1; padding: 20px 24px; overflow: auto; }
@media (max-width: 760px){ .layout{ flex-direction: column; } .sidebar{ width:100%; display:flex; overflow-x:auto; } .sidebar .brand{ display:none; } }

/* 面包屑 / 页头 */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 20px; margin: 0; }

/* 工具类 */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 跳转页 */
.jump-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }

/* 兼容：兜底宽高，避免 aspect-ratio 在老内核下塌缩 */
.product .cover { width: 100%; height: 220px; }
.product .title { min-height: 38px; }

/* 分页 */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 6px; list-style: none; padding: 16px 0; margin: 16px 0 0;
  flex-wrap: wrap;
}
.pagination li { list-style: none; }
.pagination li span,
.pagination li a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 14px; text-decoration: none;
}
.pagination li a:hover { border-color: var(--primary); color: var(--primary); }
.pagination li.active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination li.disabled span { color: var(--muted); background: #f5f6f8; cursor: not-allowed; }

/* 分类筛选的 select 样式（让下拉不那么朴素） */
.page-head select,
.page-head input[type="text"] {
  height: 36px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; font-size: 14px;
}
.page-head .btn { height: 36px; }
.jump-box { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 36px 48px; text-align: center; box-shadow: var(--shadow); }
.jump-icon { width: 64px; height: 64px; border-radius: 50%; line-height: 64px; font-size: 34px; margin: 0 auto 16px; color: #fff; }
.jump-icon.is-ok { background: var(--ok); }
.jump-icon.is-err { background: var(--err); }
.jump-msg { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.jump-tip { color: var(--muted); margin: 0; font-size: 13px; }

/* 详情页 */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px){ .detail { grid-template-columns: 1fr; } }
.detail .gallery { background: #eef1f6; border-radius: var(--radius); min-height: 320px; background-size: cover; background-position: center; }
/* 商品图集缩略图 */
.thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.thumbs .thumb { width: 74px; height: 74px; border-radius: 8px; background-size: cover; background-position: center; cursor: pointer; border: 2px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: transform .15s, border-color .15s; }
.thumbs .thumb:hover { transform: translateY(-2px); border-color: var(--accent, #ff6a00); }
.price-lg { color: var(--accent); font-size: 28px; font-weight: 800; }
