* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: #eceff3; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1b1f24;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 40px rgba(20, 30, 50, .06);
}

body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

a { color: inherit; }

button { font-family: inherit; cursor: pointer; }

:root {
  --brand: #1677ff;
  --price: #ff3b30;
  --text: #1b1f24;
  --sub: #7a828c;
  --line: #eceef1;
  --bg: #f5f6f8;
  --card: #fff;
  --radius: 14px;
}

.home-head {
  background: linear-gradient(158deg, #377dff 0%, #1677ff 55%, #0d5fe0 100%);
  padding: calc(20px + env(safe-area-inset-top)) 16px 20px;
  color: #fff;
  border-radius: 0 0 22px 22px;
}

.shop-name { font-size: 21px; font-weight: 700; letter-spacing: .5px; }

.shop-sub { margin-top: 4px; font-size: 12px; opacity: .78; }

.search {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 0 14px;
  height: 42px;
  box-shadow: 0 8px 20px rgba(8, 48, 130, .18);
}

.search-ico { display: flex; color: #9aa3ad; }
.search-ico svg { width: 16px; height: 16px; }

.search input {
  border: 0;
  outline: 0;
  flex: 1;
  font-size: 14px;
  background: transparent;
  color: var(--text);
  height: 100%;
}

.notice {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
  padding: 5px 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 15px 14px 9px;
}

.section-head h2 { font-size: 15.5px; margin: 0; }

.section-head span { font-size: 12px; color: var(--sub); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 12px 22px;
}

.card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card:active { opacity: .92; }

.thumb { position: relative; aspect-ratio: 1 / 1; background: #f2f3f5; }

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.badge-soldout {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 2px;
}

.card .info { padding: 9px 10px 11px; }

.card .name {
  font-size: 13px;
  line-height: 1.45;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.price-row { margin-top: 7px; display: flex; align-items: baseline; gap: 6px; }

.price { color: var(--price); font-weight: 700; font-size: 17px; }
.price .yen { font-size: 11px; margin-right: 1px; }

.orig { color: #a7adb5; font-size: 11px; text-decoration: line-through; }

.meta { margin-top: 4px; font-size: 11px; color: var(--sub); }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-width: 640px;
  margin: 0 auto;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  text-decoration: none;
  color: #8a919b;
  font-size: 10.5px;
  position: relative;
}

.tabbar a.active { color: var(--brand); }

.tabbar svg { width: 22px; height: 22px; }

.tab-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  background: var(--price);
  color: #fff;
  font-size: 9px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 999px;
  min-width: 9px;
  text-align: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  min-height: 48px;
}

.topbar .back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
}

.topbar .back:active { background: #f0f2f5; }
.topbar .back svg { width: 20px; height: 20px; }

.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }

.topbar .topbar-note { margin-left: auto; font-size: 12px; color: var(--sub); }

.detail-img { width: 100%; aspect-ratio: 1 / 1; background: #fff; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.detail-card { background: #fff; padding: 14px 16px 16px; }

.detail-price { display: flex; align-items: baseline; gap: 8px; color: var(--price); }

.detail-price .now { font-size: 27px; font-weight: 800; }
.detail-price .now .yen { font-size: 14px; font-weight: 600; }

.detail-title { margin: 8px 0 0; font-size: 16.5px; font-weight: 600; line-height: 1.45; }

.detail-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--sub);
  font-size: 12px;
}

.qty-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
}

.qty-label { font-size: 13.5px; color: #3c434c; }

.qty-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.qty-stepper button {
  width: 34px;
  height: 30px;
  border: 0;
  background: #f7f8fa;
  font-size: 16px;
  color: var(--text);
  line-height: 1;
}

.qty-stepper button:disabled { color: #c6cbd2; }

.qty-stepper span { width: 40px; text-align: center; font-size: 14px; }

.desc-card { margin-top: 10px; background: #fff; padding: 14px 16px 18px; }

.desc-card h3 { font-size: 14px; margin: 0 0 8px; }

.desc { white-space: pre-line; color: #3c434c; font-size: 13.5px; line-height: 1.8; }

.detail-pad { height: 96px; }

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-width: 640px;
  margin: 0 auto;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.btn {
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  height: 44px;
  flex: 1;
}

.btn-cart { background: #eaf2ff; color: var(--brand); }

.btn-buy {
  background: linear-gradient(135deg, #2f7bff, #1677ff);
  color: #fff;
  box-shadow: 0 6px 16px rgba(22, 119, 255, .28);
}

.btn[disabled] { opacity: .5; }

.action-bar .settle-total { flex: none; font-size: 13px; color: #3c434c; padding-right: 4px; }
.action-bar .settle-total b { color: var(--price); font-size: 18px; }

.cart-list {
  padding: 12px 12px 130px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item { background: #fff; border-radius: var(--radius); padding: 10px; display: flex; gap: 10px; }

.cart-item .thumb { width: 80px; height: 80px; border-radius: 10px; overflow: hidden; flex: none; }

.cart-item .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.cart-item .name {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.cart-item .p { color: var(--price); font-weight: 600; font-size: 15px; margin-top: 5px; }

.cart-item .bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn { border: 0; background: none; color: #c2c8d0; padding: 6px; display: flex; }
.icon-btn svg { width: 18px; height: 18px; }

.settle-bar {
  position: fixed;
  bottom: calc(54px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  z-index: 40;
}

.settle-bar .settle-total { flex: 1; font-size: 13px; color: #3c434c; }
.settle-bar .settle-total b { color: var(--price); font-size: 19px; }

.settle-bar .settle-btn { flex: none; width: 132px; height: 42px; }

.form-card { margin: 12px; background: #fff; border-radius: var(--radius); padding: 2px 14px; }

.field { display: flex; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); }

.field:last-child { border-bottom: 0; }

.field label { width: 74px; flex: none; font-size: 13.5px; color: var(--text); padding-top: 2px; }

.field input, .field textarea {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  resize: none;
  color: var(--text);
  line-height: 1.5;
}

.field textarea { min-height: 52px; }

.order-items { margin: 12px; background: #fff; border-radius: var(--radius); overflow: hidden; }

.order-line {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.order-line:last-child { border-bottom: 0; }

.order-line img { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #f2f3f5; flex: none; }

.order-line .g-name {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.order-line .g-side { text-align: right; flex: none; }
.order-line .g-price { font-size: 13px; color: #3c434c; }
.order-line .g-qty { font-size: 11.5px; color: var(--sub); margin-top: 3px; }

.summary { margin: 12px; background: #fff; border-radius: var(--radius); padding: 2px 14px; }

.summary .row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}

.summary .row:last-child { border-bottom: 0; }

.sum-total { color: var(--price); font-weight: 700; font-size: 16px; }

.checkout-note { margin: 14px 16px 96px; color: var(--sub); font-size: 12px; line-height: 1.7; }

.lookup { display: flex; gap: 8px; padding: 12px 12px 0; }

.lookup input {
  flex: 1;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  background: #fff;
  min-width: 0;
}

.lookup button {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  flex: none;
}

.order-card { margin: 12px; background: #fff; border-radius: var(--radius); overflow: hidden; }

.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--sub);
}

.status { font-size: 12.5px; font-weight: 600; }
.status.pending { color: #ff9500; }
.status.shipped { color: var(--brand); }
.status.done { color: #00a870; }
.status.canceled { color: #98a2ae; }

.order-goods { padding: 4px 14px; }

.order-good { display: flex; gap: 10px; padding: 9px 0; align-items: center; }

.order-good img { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #f2f3f5; flex: none; }

.order-good .g-name {
  font-size: 13px;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.order-good .g-qty { color: var(--sub); font-size: 12px; flex: none; }

.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 12px;
  border-top: 1px dashed var(--line);
  gap: 10px;
  flex-wrap: wrap;
}

.order-foot .total { font-size: 13px; color: #3c434c; }
.order-foot .total b { color: var(--price); font-size: 16px; }

.order-actions { display: flex; gap: 8px; }

.btn-sm {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12.5px;
  color: var(--text);
}

.btn-sm.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-sm.danger { color: #e5484d; border-color: #f0c6c8; }

.me-head {
  background: linear-gradient(158deg, #377dff, #1677ff);
  padding: calc(30px + env(safe-area-inset-top)) 18px 34px;
  color: #fff;
  border-radius: 0 0 22px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex: none;
}

.me-name { font-size: 18px; font-weight: 700; }
.me-sub { font-size: 12px; opacity: .8; margin-top: 4px; }

.me-cells {
  margin: -18px 12px 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 5px 16px rgba(16, 24, 40, .06);
}

.me-cells + .me-cells,
.me-card + .me-card { margin-top: 12px; }

.me-card { margin: 12px; background: #fff; border-radius: var(--radius); padding: 14px 16px; }

.cell {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
}

.cell:last-child { border-bottom: 0; }

.cell .cell-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.cell .cell-ico svg { width: 18px; height: 18px; }
.cell .cell-title { font-size: 14px; }
.cell .chev { margin-left: auto; color: #c3c9d1; display: flex; }
.cell .chev svg { width: 16px; height: 16px; }

.me-card h3 { font-size: 13.5px; margin: 0 0 10px; color: var(--sub); font-weight: 500; }

.wechat-row { display: flex; align-items: center; gap: 10px; }
.wechat-id { flex: 1; font-size: 15px; font-weight: 600; word-break: break-all; }
.wechat-id.empty { font-weight: 400; color: var(--sub); font-size: 13px; }

.site-foot { text-align: center; color: #a9b0b9; font-size: 11px; padding: 20px 0 28px; line-height: 1.7; }

.empty { padding: 70px 20px 90px; text-align: center; color: var(--sub); font-size: 13px; }

.empty svg { width: 60px; height: 60px; color: #d3d8df; margin-bottom: 12px; }

.empty .btn {
  margin-top: 18px;
  display: inline-block;
  padding: 0 30px;
  height: 40px;
  line-height: 40px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 130px;
  transform: translateX(-50%);
  background: rgba(20, 24, 30, .86);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  max-width: 76vw;
  text-align: center;
  line-height: 1.5;
}

#toast.show { opacity: 1; }

.admin-body { padding-bottom: 40px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 18px;
  padding: 30px 24px;
  box-shadow: 0 12px 44px rgba(16, 24, 40, .08);
}

.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card p { color: var(--sub); font-size: 13px; margin: 0 0 20px; }

.input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 12px;
  background: #fafbfc;
  color: var(--text);
}

.input:focus { border-color: var(--brand); background: #fff; }

.input.textarea { height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.65; font-family: inherit; }

select.input { appearance: none; -webkit-appearance: none; background: #fafbfc; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 10px;
  height: 44px;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
}

.btn-primary:disabled { opacity: .55; }

.btn-block { display: block; width: 100%; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.admin-head .title { font-size: 17px; font-weight: 700; }

.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--sub);
  margin-left: 6px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  position: sticky;
  top: 57px;
  background: #f5f6f8;
  z-index: 29;
}

.admin-tabs button {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  color: var(--sub);
}

.admin-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.tab-panel { padding: 0 16px 30px; }

.adm-prod { background: #fff; border-radius: 12px; padding: 10px; margin-bottom: 10px; }

.adm-prod .top { display: flex; gap: 10px; align-items: flex-start; }

.adm-prod img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #f2f3f5; flex: none; }

.adm-prod .p-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.adm-prod .p-sub { margin-top: 5px; font-size: 12px; color: var(--sub); }

.adm-prod .p-acts { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; flex-wrap: wrap; }

.tag { display: inline-block; font-size: 10.5px; padding: 1.5px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.tag.on { background: #e6f7ee; color: #00a870; }
.tag.off { background: #f2f3f5; color: #98a2ae; }

.status-filter { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }

.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--sub);
}

.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.adm-order .cust {
  padding: 10px 14px;
  background: #fafbfc;
  font-size: 12.5px;
  color: #3c434c;
  line-height: 1.7;
  border-bottom: 1px solid var(--line);
}

.adm-order .cust .row1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.adm-order .cust .nm { font-weight: 600; color: var(--text); font-size: 13.5px; }
.adm-order .cust .ph { color: var(--sub); }
.adm-order .cust .addr { word-break: break-all; }
.adm-order .cust .remark { color: #b0821c; }
.adm-order .goods { padding: 6px 14px; }
.adm-order .goods .order-good { padding: 7px 0; }
.adm-order .goods img { width: 44px; height: 44px; }

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, .45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-head h2 { font-size: 16px; margin: 0; }

.sheet .close { background: none; border: 0; font-size: 22px; color: var(--sub); padding: 4px 10px; line-height: 1; }

.form-label { font-size: 12.5px; color: var(--sub); margin: 12px 0 6px; }

.form-label:first-child { margin-top: 0; }

.img-picker { display: flex; gap: 10px; align-items: center; }

.img-preview {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 12px;
  border: 1px dashed #cfd6df;
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa3ad;
  font-size: 12px;
  overflow: hidden;
  flex: none;
}

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

.img-url { flex: 1; min-width: 0; }
.img-url .input { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.set-card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 14px; }

.set-card .form-label:first-child { margin-top: 0; }

.admin-tip { text-align: center; color: #b0b7c0; font-size: 11.5px; padding: 8px 0 0; }