:root {
  --primary: #ff5a1f;
  --primary-dark: #e04a13;
  --primary-soft: #fff1eb;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #e8eaed;
  --bg: #f5f6f8;
  --white: #fff;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #ff7a45, #ff3b1f);
  color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
.search-form { flex: 1; display: flex; align-items: center; gap: 8px; max-width: 520px; }
.search-form input {
  flex: 1; height: 38px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--white); outline: none; transition: border-color .18s, box-shadow .18s;
}
.search-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: 999px; color: var(--text-2); border: 1px solid transparent; background: none;
  cursor: pointer; transition: background .18s, color .18s;
}
.link-btn:hover { background: #f0f1f3; color: var(--text); }
.cart-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; line-height: 1;
}
.cart-badge[data-count="0"] { display: none; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform .12s, background .18s, border-color .18s, box-shadow .18s;
}
.btn:hover { border-color: #d4d7dc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-link { height: auto; padding: 0; border: 0; background: none; color: var(--primary); font-weight: 600; cursor: pointer; }

/* ---------- 首页头部区 ---------- */
.hero {
  margin: 20px 0 16px; padding: 28px 28px; border-radius: 16px; color: #fff;
  background: radial-gradient(120% 120% at 0% 0%, #ff8a5c 0%, #ff5a1f 45%, #e8380d 100%);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.hero h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.3; }
.hero p { margin: 0; opacity: .9; }
.hero .badge-line { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.hero .badge-line span { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 12px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--white); color: var(--text-2); cursor: pointer; transition: all .18s; white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.toolbar .result { color: var(--text-3); font-size: 13px; }
.sort-group { display: flex; gap: 6px; margin-left: auto; }
.sort-group button {
  height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--white); color: var(--text-2); cursor: pointer; font-size: 13px;
}
.sort-group button.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------- 商品卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #dfe2e6; }
.thumb { position: relative; aspect-ratio: 1 / 1; background: #f0f1f3; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: linear-gradient(135deg, #f7f8fa, #e9ebef); color: #b9bfc8;
  font-size: 34px; font-weight: 800; letter-spacing: 2px;
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { color: var(--text-3); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price { color: var(--primary); font-weight: 800; font-size: 17px; }
.price::before { content: "¥"; font-size: 12px; margin-right: 1px; }
.price-old { color: var(--text-3); font-size: 12px; text-decoration: line-through; }
.price-old::before { content: "¥"; }
.stock-tip { font-size: 12px; color: var(--text-3); }

/* ---------- 空态 / 分页 ---------- */
.empty { padding: 60px 20px; text-align: center; color: var(--text-3); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 28px 0 8px; flex-wrap: wrap; }
.pager button {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--white); cursor: pointer; color: var(--text-2);
}
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager .info { color: var(--text-3); margin-left: 8px; font-size: 13px; }

/* ---------- 详情页 ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding: 28px 0; }
.gallery-main { aspect-ratio: 1 / 1; border-radius: 16px; overflow: hidden; background: var(--white); border: 1px solid var(--line); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs button { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: none; cursor: pointer; }
.gallery-thumbs button.active { border-color: var(--primary); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { margin: 0 0 8px; font-size: 22px; line-height: 1.35; }
.detail-sub { color: var(--text-2); margin-bottom: 14px; }
.price-panel { background: var(--primary-soft); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.price-panel .price { font-size: 28px; }
.meta-list { display: grid; gap: 8px; color: var(--text-2); font-size: 13px; margin-bottom: 18px; }
.qty-box { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.qty-box button { width: 38px; height: 38px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--text-2); }
.qty-box button:hover { background: #f5f6f8; }
.qty-box input { width: 52px; height: 38px; border: 0; text-align: center; outline: none; }
.buy-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.desc-block { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; white-space: pre-wrap; color: var(--text-2); }

/* ---------- 表格 / 列表 ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-body { padding: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--text-3); font-weight: 600; font-size: 13px; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.cart-item { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-thumb { width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: #f0f1f3; flex: 0 0 auto; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-main { flex: 1; min-width: 0; }
.cart-line-total { font-weight: 700; color: var(--primary); white-space: nowrap; }
.summary { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.summary .total { font-size: 15px; color: var(--text-2); }
.summary .amount { color: var(--primary); font-size: 22px; font-weight: 800; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 84px; }
.field .hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-narrow { max-width: 460px; margin: 0 auto; }

.auth-wrap { max-width: 420px; margin: 48px auto; }
.auth-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.auth-tabs { display: flex; gap: 6px; background: #f0f1f3; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; font-weight: 600; }
.auth-tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* ---------- 状态标签 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-pending_payment { background: #fff7e6; color: var(--warn); }
.badge-paid { background: #e8f3ff; color: #1d6fd8; }
.badge-shipped { background: #eef2ff; color: #4f46e5; }
.badge-completed { background: #e9f8ef; color: var(--success); }
.badge-cancelled { background: #f2f3f5; color: var(--text-3); }
.badge-on { background: #e9f8ef; color: var(--success); }
.badge-off { background: #f2f3f5; color: var(--text-3); }

.order-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.order-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.order-head .no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); font-weight: 600; }
.order-head .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.order-body { padding: 12px 16px; }
.order-item-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.order-item-row .thumb-sm { width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: #f0f1f3; flex: 0 0 auto; }
.order-item-row .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.order-foot { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 12px);
  background: rgba(31, 35, 41, .94); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(190, 30, 30, .95); }

.notice { padding: 12px 14px; border-radius: 10px; background: #fff7e6; color: #92400e; font-size: 13px; margin-bottom: 16px; }
.notice-soft { background: var(--primary-soft); color: #b4400f; }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 48px; padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.site-footer .rows { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; align-items: center; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 20, 28, .45); display: none;
  align-items: center; justify-content: center; padding: 20px; z-index: 150;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; max-height: 88vh; overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; gap: 20px; }
  .header-inner { gap: 12px; height: auto; padding: 10px 0; flex-wrap: wrap; }
  .search-form { order: 3; max-width: none; width: 100%; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
