/* ============================================================
   配件图录 · 样式
   移动端优先，桌面上居中成一条窄栏
   ============================================================ */

:root {
  --bg: #f6f5f3;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-2: #5e5e5e;
  --text-3: #9c9c9c;
  --line: #ece9e4;
  --line-strong: #ddd9d2;
  --danger: #c0392b;
  --radius: 16px;
  --bar-h: 62px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: env(safe-area-inset-bottom);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* ---------- 顶部 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(246, 245, 243, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
}

.topbar.solid {
  border-bottom-color: var(--line);
}

.topbar .back {
  font-size: 22px;
  line-height: 1;
  width: 28px;
  margin-left: -6px;
  color: var(--text);
}

.topbar .tb-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- 店铺头 ---------- */

.shop-head {
  padding: 10px 20px 4px;
}

.shop-name {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: 0.5px;
  line-height: 1.3;
  user-select: none;
}

.shop-slogan {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.3px;
}

.notice {
  display: flex;
  gap: 8px;
  margin: 14px 20px 0;
  padding: 11px 14px;
  background: #fffdf6;
  border: 1px solid #f0e8d4;
  border-radius: 12px;
  font-size: 13px;
  color: #8a7440;
  line-height: 1.55;
}

/* ---------- 搜索 ---------- */

.search-wrap {
  padding: 16px 20px 0;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
}

.search input::placeholder {
  color: #b5b1aa;
}

.search .ico {
  color: var(--text-3);
  font-size: 15px;
}

/* ---------- 分类标签 ---------- */

.tags {
  display: flex;
  gap: 8px;
  padding: 14px 20px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tags::-webkit-scrollbar {
  display: none;
}

.tag {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}

.tag.on {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* ---------- 商品网格 ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 20px 28px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.card .cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #efedea;
  overflow: hidden;
}

.card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .cover .ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c9c5be;
  font-size: 24px;
}

.card .cbody {
  padding: 10px 12px 13px;
}

.card .ctitle {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.card .csub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 详情 ---------- */

.gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: #efedea;
}

.gallery::-webkit-scrollbar {
  display: none;
}

.gallery .slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 1 / 1;
}

.gallery .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding: 10px 0 0;
  background: #fff;
}

.dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d8d4cd;
  display: block;
}

.dots i.on {
  background: var(--text);
  width: 14px;
  border-radius: 3px;
}

.dinfo {
  background: var(--card);
  padding: 18px 20px 22px;
}

.dinfo h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
}

.spec {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.spec-row {
  display: flex;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.spec-row .k {
  flex: 0 0 72px;
  color: var(--text-3);
}

.spec-row .v {
  flex: 1;
  color: var(--text);
  word-break: break-word;
}

.section {
  background: var(--card);
  margin-top: 10px;
  padding: 18px 20px 24px;
}

.section h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 1px;
}

.section .desc {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-2);
}

/* ---------- 底部联系栏 ---------- */

.bottom-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 680px;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 30;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 9px;
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.grow {
  flex: 1;
}

/* ---------- 联系页 ---------- */

.contact-card {
  margin: 12px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.contact-row:last-child {
  border-bottom: none;
}

.contact-row .ci {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: #f4f2ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.contact-row .cmain {
  flex: 1;
  min-width: 0;
}

.contact-row .cl {
  font-size: 12px;
  color: var(--text-3);
}

.contact-row .cv {
  font-size: 15px;
  color: var(--text);
  margin-top: 2px;
  word-break: break-all;
}

.qr-box {
  margin: 12px 20px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.qr-box img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 8px;
}

.qr-box .qt {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- 管理 ---------- */

.admin-wrap {
  padding: 16px 20px 40px;
}

.stats {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 0;
  margin-bottom: 16px;
}

.stat {
  flex: 1;
  text-align: center;
}

.stat .n {
  font-size: 22px;
  font-weight: 600;
}

.stat .l {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.row-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.row-btns .btn {
  flex: 1;
}

.admin-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.admin-item .thumb {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 10px;
  background: #efedea;
  overflow: hidden;
}

.admin-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-item .amain {
  flex: 1;
  min-width: 0;
}

.admin-item .atitle {
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.admin-item .ameta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
}

.admin-item .aops {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-2);
}

.admin-item .aops .danger {
  color: var(--danger);
}

.admin-item .off {
  opacity: 0.5;
}

/* ---------- 表单 ---------- */

.field {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin-bottom: 12px;
}

.field + .field {
  margin-top: 0;
}

.field-label {
  font-size: 12px;
  color: var(--text-3);
  padding-top: 12px;
}

.field input,
.field textarea {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 8px 0 12px;
  resize: none;
}

.field textarea {
  min-height: 92px;
  line-height: 1.7;
}

.field input[type='checkbox'] {
  width: 20px;
  height: 20px;
  padding: 0;
  flex: 0 0 auto;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #bcb8b1;
}

.uploader {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.uploader .u-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #efedea;
}

.uploader .u-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uploader .u-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.uploader .u-add {
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 22px;
  background: #fbfaf8;
}

.uploader .u-item .prog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.12);
}

.uploader .u-item .prog i {
  display: block;
  height: 100%;
  background: var(--text);
}

.hint {
  font-size: 12px;
  color: var(--text-3);
  padding: 2px 4px 14px;
  line-height: 1.6;
}

/* ---------- 空状态 / 加载 ---------- */

.empty {
  padding: 70px 30px;
  text-align: center;
  color: var(--text-3);
}

.empty .ei {
  font-size: 34px;
  color: #d6d2cb;
  margin-bottom: 12px;
}

.empty .et {
  font-size: 14px;
  line-height: 1.7;
}

.skeleton {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.skeleton i {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: linear-gradient(100deg, #efedea 30%, #f7f5f2 50%, #efedea 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(10px);
  max-width: 80vw;
  padding: 10px 18px;
  background: rgba(26, 26, 26, 0.92);
  color: #fff;
  font-size: 13px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.banner {
  margin: 12px 20px;
  padding: 14px 16px;
  background: #fff8e6;
  border: 1px solid #f0e0b8;
  border-radius: 12px;
  font-size: 13px;
  color: #8a6d2f;
  line-height: 1.7;
}

.banner b {
  color: #6b531f;
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: #b5b1aa;
  padding: 0 20px 30px;
}

/* ---------- 登录 ---------- */

.login {
  padding: 60px 28px;
}

.login h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
}

.login p {
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 26px;
}

/* ---------- 大图查看 ---------- */

.viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer .close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
