:root {
  color-scheme: light;
  --bg: #edf1f4;
  --surface: #ffffff;
  --line: #dde3e8;
  --muted: #77818c;
  --text: #202932;
  --accent: #f2a22c;
  --accent-dark: #c97812;
  --danger: #d94848;
  --ok: #1c9b66;
  --teal: #197a85;
  --blue: #3267a8;
  --font-main: "HarmonyOS Sans SC", "Alibaba PuHuiTi", "Alibaba PuHuiTi 2.0", "Source Han Sans SC",
    "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  background: linear-gradient(135deg, #e9eef2 0%, #f7f4ef 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(280px, 360px);
  gap: 28px;
  align-items: start;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
}

.phone {
  position: relative;
  overflow: hidden;
  width: min(430px, 100%);
  height: 860px;
  background: #f7f8fa;
  border: 1px solid rgba(32, 41, 50, 0.14);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(24, 35, 48, 0.2);
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 64px;
  align-items: center;
  height: 62px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.icon-button,
.pill-button {
  border: 0;
  background: transparent;
  color: var(--text);
}

.icon-button {
  font-size: 32px;
  line-height: 1;
}

.pill-button {
  height: 32px;
  border-radius: 16px;
  background: #eef2f5;
  font-size: 14px;
}

.customer-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: #fff7e7;
  border-bottom: 1px solid #efd4a8;
  font-size: 13px;
}

.customer-strip label {
  color: var(--accent-dark);
  font-weight: 700;
}

.customer-strip select {
  min-width: 0;
  border: 1px solid #e4c68f;
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
}

#customerBadge {
  color: var(--muted);
  white-space: nowrap;
}

.view {
  display: none;
  height: calc(100% - 178px);
  overflow-y: auto;
  padding: 14px;
}

.view.active {
  display: block;
}

.search-row {
  display: grid;
  grid-template-columns: 42px 1fr 74px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.search-row.compact {
  grid-template-columns: 42px 1fr;
}

.scan-box {
  display: grid;
  place-items: center;
  height: 42px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.search-row input {
  width: 100%;
  height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: var(--surface);
}

.primary-small,
.primary-button,
.hero-panel button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-small {
  height: 42px;
  border-radius: 14px;
}

.service-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.service-row span {
  min-height: var(--service-tile-height, 36px);
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: var(--hero-height, 152px);
  padding: 18px;
  margin-bottom: 12px;
  background:
    linear-gradient(135deg, rgba(242, 162, 44, 0.9), rgba(25, 122, 133, 0.78)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0 8px, transparent 8px 18px);
  color: #fff;
}

.hero-panel.has-image {
  background:
    linear-gradient(135deg, rgba(20, 36, 44, 0.68), rgba(25, 122, 133, 0.42)),
    var(--hero-image),
    linear-gradient(135deg, rgba(242, 162, 44, 0.9), rgba(25, 122, 133, 0.78));
  background-size: cover;
  background-position: center;
}

.hero-panel p,
.hero-panel h2 {
  margin: 0 0 8px;
}

.hero-panel h2 {
  font-size: 24px;
  line-height: 1.25;
}

.hero-panel span {
  display: block;
  font-size: 13px;
  opacity: 0.92;
}

.hero-panel button {
  height: 42px;
  border-radius: 21px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.48);
}

.notice-line,
.plain-section,
.profile-head,
.admin-list {
  background: var(--surface);
  border: 1px solid var(--line);
}

.notice-line {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: var(--consult-height, 48px);
  padding: 12px;
  margin-bottom: 12px;
  color: var(--muted);
}

.notice-line strong {
  color: var(--text);
}

.category-grid,
.sub-grid,
.metric-grid,
.admin-dashboard {
  display: grid;
  grid-template-columns: repeat(var(--category-columns, 4), 1fr);
  gap: 10px;
}

.category-tile,
.sub-tile {
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: var(--category-tile-height, 86px);
  padding: 10px 8px;
  text-align: center;
}

.custom-block-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.custom-block {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: var(--block-height, 120px);
  padding: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(32, 41, 50, 0.58), rgba(25, 122, 133, 0.26)),
    var(--block-image),
    var(--surface);
  background-size: cover;
  background-position: center;
  color: #fff;
}

.custom-block.half {
  grid-column: span 1;
}

.custom-block.full {
  grid-column: 1 / -1;
}

.custom-block strong {
  font-size: 18px;
  line-height: 1.25;
}

.custom-block p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.92;
}

.custom-block button {
  justify-self: start;
  height: 34px;
  margin-top: 6px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.category-visual {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: #f7e8cf;
  color: var(--accent-dark);
  font-weight: 800;
}

.category-visual.has-image {
  background-image: var(--category-image);
  background-size: cover;
  background-position: center;
  color: transparent;
}

.category-tile span,
.sub-tile span {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 10px;
}

.section-title.compact-title {
  margin: 10px 0 8px;
}

.section-title.hidden {
  display: none;
}

.section-title h2,
.plain-section h2,
.sub-category-panel h2,
.admin-list h2 {
  margin: 0;
  font-size: 17px;
}

.section-title button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
}

.product-stack,
.product-list,
.cart-list {
  display: grid;
  gap: 10px;
}

.product-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 44px;
  gap: 10px;
  height: 154px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.product-art {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.42)),
    var(--art-color, #f2a22c);
  height: 132px;
}

.product-art.has-image {
  background-image: var(--product-image);
  background-size: cover;
  background-position: center;
}

.product-art.has-image::before,
.product-art.has-image::after {
  display: none;
}

.product-art::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(32, 41, 50, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.34);
}

.product-art::after {
  content: "可上传商品图";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  color: rgba(32, 41, 50, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.product-info h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.28;
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-info p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  min-height: 23px;
  overflow: hidden;
}

.tag-row span {
  border: 1px solid #e8b1b1;
  color: var(--danger);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 11px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-height: 28px;
}

.price-row strong {
  color: var(--danger);
  font-size: 17px;
  white-space: nowrap;
}

.add-button {
  align-self: end;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  line-height: 1;
}

.category-layout {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  min-height: 100%;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 4px;
}

.side-nav button {
  min-height: 52px;
  border: 0;
  border-left: 4px solid transparent;
  background: #e9edf1;
  text-align: left;
  padding: 0 8px;
  color: #38434e;
}

.side-nav button.active {
  border-left-color: var(--accent);
  background: var(--surface);
  font-weight: 700;
}

.sub-category-panel {
  background: var(--surface);
  padding: 12px;
  border: 1px solid var(--line);
}

.sub-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.quick-tabs,
.sort-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.quick-tabs {
  grid-template-columns: repeat(5, 1fr);
}

.sort-row {
  grid-template-columns: repeat(4, 1fr);
}

.quick-tabs button,
.sort-row button {
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.quick-tabs button.active,
.sort-row button.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 800;
}

.quick-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #17313d, #197a85);
  color: #fff;
}

.quick-hero span {
  font-size: 12px;
  opacity: 0.78;
}

.quick-hero h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.quick-hero button {
  flex: 0 0 auto;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
  display: none;
}

.category-chips button {
  flex: 0 0 auto;
  min-width: 76px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: #38434e;
}

.category-chips button.active {
  border-color: var(--accent);
  background: #fff5df;
  color: var(--accent-dark);
  font-weight: 800;
}

.cart-empty {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--muted);
  text-align: center;
}

.catalog-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 24px;
  border: 1px dashed var(--line);
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.catalog-empty strong {
  color: var(--ink);
}

.catalog-empty p {
  margin: 0;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.cart-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.qty-control {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qty-control button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: #f4f6f8;
}

.cart-summary,
.checkout-bottom {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 14px -14px -14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.primary-button {
  min-width: 132px;
  height: 46px;
  border-radius: 23px;
}

.plain-section,
.profile-head,
.admin-list {
  padding: 14px;
  margin-bottom: 12px;
}

.plain-section p,
.plain-section span,
.profile-head p {
  color: var(--muted);
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.payment-options button {
  height: 42px;
  border: 1px solid var(--line);
  background: #f5f7f9;
}

.payment-options button.active {
  border-color: var(--accent);
  background: #fff5df;
  color: var(--accent-dark);
  font-weight: 800;
}

.payment-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-lines,
.risk-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.summary-lines div,
.risk-panel div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.risk-panel.ok {
  color: var(--ok);
}

.risk-panel.danger {
  color: var(--danger);
}

.internal-check-section {
  display: none;
}

.profile-head {
  background: linear-gradient(135deg, #18313f, #197a85);
  color: #fff;
}

.stored-head {
  background: linear-gradient(135deg, #7b4c13, #197a85);
}

.profile-head p {
  color: rgba(255, 255, 255, 0.8);
}

.metric-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 12px;
}

.metric-grid article,
.admin-dashboard article {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric-grid span,
.admin-dashboard span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-grid strong,
.admin-dashboard strong {
  font-size: 20px;
}

.menu-list,
.admin-list {
  display: grid;
  gap: 8px;
}

.menu-list button,
.admin-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
  text-align: left;
}

.admin-dashboard {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 12px;
}

.recharge-list {
  display: grid;
  gap: 12px;
}

.recharge-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.recharge-card.featured {
  border-color: var(--accent);
  background: #fff8eb;
}

.recharge-card span {
  display: inline-block;
  padding: 3px 8px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.recharge-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.recharge-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--danger);
  font-size: 18px;
}

.recharge-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.recharge-card button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 21px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.tabbar button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tabbar button.active {
  color: var(--accent-dark);
  font-weight: 800;
}

#cartCount {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
}

.guide-panel {
  padding: 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(32, 41, 50, 0.12);
  box-shadow: 0 16px 40px rgba(24, 35, 48, 0.12);
}

.guide-panel h2 {
  margin: 0 0 12px;
}

.guide-panel p,
.guide-panel li {
  color: #53606b;
  line-height: 1.7;
}

.guide-note {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.guide-admin-button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 21px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .phone {
    height: 820px;
    border-radius: 18px;
  }

  .guide-panel {
    order: -1;
  }
}

html.wechat-embed,
html.wechat-embed body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html.wechat-embed body {
  background: #f7f8fa;
}

html.wechat-embed .shell {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0;
}

html.wechat-embed .phone {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

html.wechat-embed .topbar,
html.wechat-embed .guide-panel {
  display: none;
}

html.wechat-embed .view {
  height: calc(100% - 116px);
}

.wechat-session-error {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 32px;
  background: #eef3f5;
}

.wechat-session-error > div {
  width: 100%;
  padding: 28px 24px;
  border: 1px solid var(--line);
  background: #fff;
}

.wechat-session-error h1 {
  margin: 0 0 12px;
  font-size: 22px;
}

.wechat-session-error p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.6;
}
