:root {
  --primary: #0f766e;
  --primary-strong: #0a544f;
  --primary-soft: #e8f3f0;
  --accent: #f26b3a;
  --bg: #f2f4f5;
  --surface: #fff;
  --surface-soft: #f7f8fa;
  --ink: #17232d;
  --text: #42535f;
  --text-light: #79888f;
  --border: #e5e9ec;
  --border-strong: #d8dee2;
  --danger: #d93f32;
  --success: #148762;
  --warning: #b76a04;
  --radius-sm: 6px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(23, 35, 45, .04), 0 10px 24px rgba(23, 35, 45, .05);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }

/* Layout */
.page { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 72px; }
.container { padding: 16px; }
.hero-follow { padding-top: 0; }

/* Header */
.navbar {
  display: flex; align-items: center; height: 52px; padding: 0 14px;
  background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 90; max-width: 480px; margin: 0 auto;
  backdrop-filter: blur(14px);
}
.navbar .back {
  width: 34px; height: 34px; margin: 0 8px 0 -6px; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
  text-decoration: none; color: var(--ink); background: var(--surface-soft);
}
.navbar .title { font-size: 17px; font-weight: 700; color: var(--ink); flex: 1; }

.page-hero {
  position: relative; padding: 26px 20px 56px; color: #fff; overflow: hidden;
  background: linear-gradient(120deg, #123f3b, #0f766e 52%, #177064);
}
.page-hero::after {
  content: ""; position: absolute; right: -20px; top: -54px; width: 140px; height: 140px;
  border: 22px solid rgba(255,255,255,.07); transform: rotate(18deg);
}
.hero-kicker {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px;
  border-radius: 999px; background: rgba(255,255,255,.14); color: #f7faf9;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.page-hero h1 { margin-top: 10px; font-size: 27px; line-height: 1.2; font-weight: 800; color: #fff; }
.hero-text { margin-top: 7px; max-width: 320px; font-size: 13px; line-height: 1.55; color: rgba(255,255,255,.82); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 18px 0 10px; }
.section-head h2 { color: var(--ink); font-size: 18px; line-height: 1.3; font-weight: 800; }
.section-head span { font-size: 12px; color: var(--text-light); white-space: nowrap; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: rgba(255,255,255,.97);
  border-top: 1px solid var(--border); display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(14px);
}
.tabbar-item {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 7px; text-decoration: none; color: var(--text-light); font-size: 11px; font-weight: 600;
}
.tabbar-item.active { color: var(--primary); }
.tabbar-item.active::before {
  content: ""; position: absolute; top: 0; width: 20px; height: 2px; border-radius: 2px; background: var(--primary);
}
.tabbar-item .icon { display: grid; place-items: center; width: 32px; height: 24px; margin-bottom: 2px; font-size: 20px; line-height: 1; }
.tabbar-item.active .icon { background: var(--primary-soft); border-radius: 999px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid rgba(216,222,226,.74);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 13px; color: var(--ink); font-size: 15px; font-weight: 700;
}
.panel-head span:last-child { color: var(--text-light); font-size: 12px; font-weight: 500; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 11px 22px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 15px; line-height: 1.2; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(15,118,110,.16); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-outline { background: #fff; border-color: #bccfc9; color: var(--primary); }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { min-height: 50px; padding: 15px 32px; font-size: 17px; border-radius: 999px; }
.btn[disabled] { opacity: .45; pointer-events: none; box-shadow: none; }

/* Forms */
.form-group { margin-bottom: 15px; }
.form-label { display: block; margin-bottom: 7px; font-size: 13px; color: var(--ink); font-weight: 700; }
.form-input {
  width: 100%; min-height: 44px; padding: 11px 13px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 15px; outline: none; background: #fff; color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
textarea.form-input { min-height: 104px; resize: vertical; line-height: 1.5; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
input[type="file"].form-input { padding: 9px; color: var(--text-light); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-success { background: #e5f4ed; color: var(--success); }
.badge-danger { background: #fdeae7; color: var(--danger); }
.badge-warning { background: #fdf0de; color: var(--warning); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

/* Toast and loading */
.toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%); z-index: 9999;
  min-width: 96px; max-width: min(86vw, 380px); padding: 11px 18px; text-align: center;
  background: rgba(23,35,45,.92); color: #fff; border-radius: var(--radius);
  font-size: 14px; line-height: 1.4; pointer-events: none; animation: toastIn .18s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.loading-overlay {
  position: fixed; inset: 0; z-index: 9998; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; background: rgba(242,244,245,.84);
}
.spinner {
  width: 30px; height: 30px; border: 3px solid rgba(15,118,110,.16);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty */
.empty { text-align: center; padding: 52px 20px; }
.empty .icon {
  display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 13px;
  background: #fff; border: 1px solid var(--border); border-radius: 50%; font-size: 26px;
}
.empty p { font-size: 14px; color: var(--text-light); }
.empty .btn { margin-top: 15px; }

/* Goods grid */
.goods-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.goods-card {
  overflow: hidden; background: var(--surface); border: 1px solid rgba(216,222,226,.74);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  transition: transform .16s ease, box-shadow .16s ease;
}
.goods-card:active { transform: translateY(1px); }
.goods-card .img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #eceff1; }
.goods-card .info { padding: 10px 11px 12px; }
.goods-card .name {
  min-height: 38px; font-size: 13px; line-height: 1.45; color: var(--ink); font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.goods-card .price-row { display: flex; align-items: end; justify-content: space-between; gap: 6px; margin-top: 10px; }
.goods-card .price { color: var(--danger); font-weight: 800; font-size: 19px; line-height: 1; }
.goods-card .price::before { content: '\A5'; margin-right: 1px; font-size: 12px; }
.goods-card .stock {
  max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px; color: var(--text-light);
}

/* Order list */
.order-item {
  background: var(--surface); border: 1px solid rgba(216,222,226,.74); border-radius: var(--radius);
  margin-bottom: 11px; padding: 14px; box-shadow: var(--shadow);
}
.order-item .head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border);
}
.order-item .no { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-light); }
.order-item .amount { flex: 0 0 auto; font-size: 16px; font-weight: 800; color: var(--ink); }
.order-item .status { font-size: 12px; font-weight: 700; }
.order-item .actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 12px; }
.order-item .actions .btn { padding: 6px 10px; }

/* Cart */
.cart-list { display: grid; gap: 10px; }
.cart-item {
  display: flex; align-items: center; padding: 11px; background: var(--surface);
  border: 1px solid rgba(216,222,226,.74); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cart-item .img { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; margin-right: 11px; background: #eceff1; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14px; color: var(--ink); font-weight: 600; }
.cart-item .price { margin-top: 5px; color: var(--danger); font-size: 16px; font-weight: 800; }
.cart-item .qty-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cart-item .qty-btn {
  width: 28px; height: 28px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-soft); color: var(--ink); font-size: 16px; line-height: 26px; text-align: center; cursor: pointer;
}
.cart-item .qty-num { min-width: 24px; text-align: center; font-size: 14px; font-weight: 700; color: var(--ink); }

/* Category and management */
.category-layout { display: flex; gap: 11px; padding: 14px 16px 0; }
.category-side {
  flex: 0 0 86px; align-self: flex-start; overflow: hidden; background: var(--surface);
  border: 1px solid rgba(216,222,226,.74); border-radius: var(--radius); box-shadow: var(--shadow);
}
.category-item {
  display: block; position: relative; padding: 14px 9px; text-align: center;
  font-size: 13px; color: var(--text); text-decoration: none; border-left: 3px solid transparent;
}
.category-item + .category-item { border-top: 1px solid var(--border); }
.category-item.active { border-left-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.category-goods { flex: 1; min-width: 0; }
.list-card {
  background: var(--surface); border: 1px solid rgba(216,222,226,.74); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.manage-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.manage-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 15px; font-weight: 700; }
.manage-meta { margin-top: 7px; font-size: 12px; color: var(--text-light); }

.profile-card {
  position: relative; overflow: hidden; padding: 20px 16px 17px; margin-bottom: 12px;
  background: linear-gradient(120deg, #123f3b, #0f766e 72%); color: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.profile-top { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.68); background: rgba(255,255,255,.2);
}
.profile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; font-weight: 800; }
.profile-role {
  display: inline-flex; margin-top: 7px; padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,.16); font-size: 11px; font-weight: 700;
}
.asset-strip {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 12px; background: #fff;
  border: 1px solid rgba(216,222,226,.74); border-radius: var(--radius); box-shadow: var(--shadow);
}
.asset-label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--text-light); }
.asset-value { color: var(--danger); font-size: 23px; line-height: 1; font-weight: 800; }
.menu-card {
  overflow: hidden; background: var(--surface); border: 1px solid rgba(216,222,226,.74);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px;
}
.menu-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 0 14px; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600;
}
.menu-link + .menu-link { border-top: 1px solid var(--border); }
.menu-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-icon {
  display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px;
  border-radius: 50%; background: var(--surface-soft); font-size: 15px;
}
.menu-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-arrow { color: var(--border-strong); font-size: 18px; line-height: 1; }
.menu-link.quiet { color: var(--danger); }

/* Fixed action bar */
.page-action-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 95;
  width: 100%; max-width: 480px; display: flex; gap: 9px; padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97); border-top: 1px solid var(--border); backdrop-filter: blur(14px);
}
.page-action-bar .btn { flex: 1; }
.cart-action-bar { bottom: 58px; justify-content: space-between; align-items: center; }
.cart-total-label { display: block; margin-bottom: 3px; font-size: 11px; color: var(--text-light); }
.cart-total { color: var(--danger); font-size: 20px; line-height: 1; font-weight: 800; }
.cart-action-bar .btn { flex: 0 0 auto; min-width: 116px; }

/* Payment method selection */
.amount-panel {
  padding: 20px 16px 18px; margin-bottom: 14px; text-align: center; color: #fff;
  background: linear-gradient(120deg, #123f3b, #0f766e 72%); border-radius: var(--radius); box-shadow: var(--shadow);
}
.amount-label { display: block; font-size: 12px; color: rgba(255,255,255,.76); }
.amount-value { display: block; margin-top: 7px; font-size: 42px; line-height: 1.05; font-weight: 800; }
.amount-order { display: block; overflow: hidden; margin-top: 9px; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: rgba(255,255,255,.64); }
.method-option {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 66px; padding: 12px 13px;
  margin-bottom: 9px; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
  cursor: pointer; transition: border-color .16s, background .16s, box-shadow .16s;
}
.method-option.active { border-color: var(--primary); background: #f7fbfa; box-shadow: inset 3px 0 0 var(--primary); }
.method-icon {
  display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px;
  border-radius: var(--radius-sm); background: var(--surface-soft); font-size: 21px;
}
.method-option.active .method-icon { background: var(--primary-soft); }
.method-body { flex: 1; min-width: 0; }
.method-title { font-size: 15px; line-height: 1.3; font-weight: 700; color: var(--ink); }
.method-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; font-size: 12px; color: var(--text-light); }
.method-check {
  flex: 0 0 auto; display: grid; place-items: center; width: 21px; height: 21px;
  border: 2px solid var(--border-strong); border-radius: 50%; color: #fff; font-size: 11px;
}
.method-option.active .method-check { border-color: var(--primary); background: var(--primary); }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.method-grid .method-option { min-height: 74px; margin-bottom: 0; align-items: center; }
.pay-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 95; margin: 0 auto; max-width: 480px;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97); border-top: 1px solid var(--border); backdrop-filter: blur(14px);
}

/* Login */
.login-page {
  max-width: 420px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; padding: 30px;
}
.login-icon {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px;
  background: var(--primary-soft); border-radius: var(--radius); font-size: 30px;
}
.login-title { text-align: center; font-size: 23px; font-weight: 800; color: var(--ink); margin-bottom: 7px; }
.login-sub { text-align: center; margin-bottom: 30px; font-size: 14px; line-height: 1.6; color: var(--text-light); }

/* Records */
.record-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 11px 0; font-size: 13px; color: var(--text-light);
}
.record-row + .record-row { border-top: 1px solid var(--border); }
.record-amount { min-width: 68px; text-align: right; color: var(--ink); font-weight: 800; }
.record-state { color: var(--ink); font-weight: 600; }

/* Utility */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-light { color: var(--text-light); }
.text-bold { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-24 { font-size: 24px; }
.pre-wrap { white-space: pre-wrap; }

@media (max-width: 360px) {
  .container { padding: 14px; }
  .goods-grid { gap: 9px; }
  .goods-card .price { font-size: 17px; }
  .method-grid { grid-template-columns: 1fr; }
  .page-hero h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* 微信内转发引导浮层：H5 无法直接拉起好友面板，只能引导用户点右上角 */
#wx-share-guide {
  position: fixed; inset: 0; z-index: 4000; padding: 14px 18px;
  background: rgba(0,0,0,.78); color: #fff; animation: wxGuideIn .18s ease-out;
}
#wx-share-guide .wx-guide-arrow { text-align: right; font-size: 40px; line-height: 1; }
#wx-share-guide .wx-guide-text { text-align: right; margin-top: 6px; font-size: 16px; line-height: 1.7; }
#wx-share-guide .wx-guide-text b { color: #ffd166; }
@keyframes wxGuideIn { from { opacity: 0 } to { opacity: 1 } }
