/* 通用组件 */
/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 44px; padding: 0 20px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; white-space: nowrap; transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost-primary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost-accent { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-gold { background: linear-gradient(90deg, #F3D9A6, #E8C48A); color: #3A2A10; }
.btn-sm { min-height: 30px; height: 30px; padding: 0 14px; font-size: 13px; font-weight: 500; }
.btn-xs { min-height: 26px; height: 26px; padding: 0 10px; font-size: 12px; font-weight: 500; }
.btn-block { width: 100%; }
.btn.disabled, .btn:disabled, .btn.is-off { opacity: .45; }
.btn.is-off { pointer-events: auto; }

/* 标签 / 胶囊 */
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 14px; border-radius: var(--r-pill);
  background: #fff; border: 1px solid var(--border); color: var(--text-2); font-size: 13px; white-space: nowrap;
  cursor: pointer; transition: all .15s;
}
.chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip.disabled { color: var(--text-3); background: #F5F5F5; border-color: var(--divider); pointer-events: none; }
.chip-accent.on { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 4px;
  font-size: 10px; line-height: 1; color: var(--primary); background: var(--primary-light); white-space: nowrap;
}
.tag-orange { color: var(--accent); background: var(--accent-light); }
.tag-grey { color: var(--text-2); background: #F2F2F2; }
.pill-plus {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px;
  background: linear-gradient(90deg, var(--plus-from), var(--plus-to)); color: var(--gold);
  font-size: 10px; font-weight: 600; white-space: nowrap; line-height: 1;
}
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--error); color: #fff; font-size: 10px; font-weight: 600;
  border: 1.5px solid #fff; box-sizing: content-box; line-height: 16px;
}

/* 卡片与分区 */
.card { background: #fff; border-radius: var(--r-md); margin: 8px 12px; overflow: hidden; }
.card-flat { background: #fff; margin-top: 8px; padding: 12px; }
.section-hd {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px;
}
.section-hd h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.section-hd h3 em { font-style: normal; font-size: 12px; color: var(--text-3); font-weight: 400; }
.section-hd a, .section-hd .more { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; cursor: pointer; }
.divider { height: 1px; background: var(--divider); margin: 0 12px; }
.cell {
  display: flex; align-items: center; gap: 8px; padding: 12px; background: #fff; cursor: pointer;
}
.cell + .cell { border-top: 1px solid var(--divider); }
.cell-label { color: var(--text-2); width: 64px; flex: none; }
.cell-value { flex: 1; text-align: right; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cell .ic { color: var(--text-3); width: 16px; height: 16px; }

/* 商品卡片（网格） */
.pcard { background: #fff; border-radius: var(--r-md); overflow: hidden; cursor: pointer; break-inside: avoid; }
.pcard-img { position: relative; aspect-ratio: 1; background: var(--bg); }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-badge {
  position: absolute; left: 0; top: 8px; background: var(--accent); color: #fff; font-size: 10px;
  padding: 2px 7px 2px 6px; border-radius: 0 var(--r-pill) var(--r-pill) 0; font-weight: 600;
}
.pcard-badge.green { background: var(--primary); }
.pcard-bd { padding: 8px 8px 10px; }
.pcard-title { font-size: 14px; font-weight: 500; line-height: 1.35; min-height: 38px; }
.pcard-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.pcard-tags { display: flex; gap: 4px; margin-top: 5px; overflow: hidden; height: 18px; }
.pcard-foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 8px; }
.pcard-price { display: flex; flex-direction: column; gap: 3px; }
.pcard-price s { font-size: 11px; color: var(--text-3); }
.pcard-price .price { font-size: 18px; }
.pcard-sales { font-size: 10px; color: var(--text-3); margin-top: 6px; }
.pcard-plus { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 6px; }
.pcard-plus .pcard-sales { margin-top: 0; }
.add-btn {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.add-btn .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.add-btn.accent { background: var(--accent); }
.add-btn:active { transform: scale(.9); }

/* 商品行 */
.prow {
  display: flex; gap: 10px; padding: 10px 12px; background: #fff; cursor: pointer; align-items: center;
}
.prow + .prow { border-top: 1px solid var(--divider); }
.prow img { width: 80px; height: 80px; border-radius: var(--r-sm); object-fit: cover; flex: none; background: var(--bg); }
.prow-bd { flex: 1; min-width: 0; }
.prow-title { font-size: 14px; font-weight: 500; line-height: 1.3; }
.prow-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.prow-foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 6px; }
.prow-price { display: flex; align-items: baseline; gap: 6px; }
.prow-price .price { font-size: 17px; }
.prow-price s { font-size: 11px; color: var(--text-3); }

/* 步进器 */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; height: 28px; }
.stepper button { width: 28px; height: 100%; display: flex; align-items: center; justify-content: center; background: #FAFAFA; color: var(--text-2); }
.stepper button .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.stepper button.disabled { color: #CCC; pointer-events: none; }
.stepper span { min-width: 34px; text-align: center; font-size: 13px; font-weight: 600; }
.stepper.lg { height: 34px; }
.stepper.lg button { width: 34px; }
.stepper.lg span { min-width: 44px; font-size: 15px; }

/* 选择控件 */
.checkbox {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #CCC; flex: none;
  display: inline-flex; align-items: center; justify-content: center; background: #fff; cursor: pointer;
  transition: all .15s;
}
.checkbox .ic { width: 12px; height: 12px; stroke-width: 3; color: #fff; opacity: 0; }
.checkbox.on { background: var(--primary); border-color: var(--primary); }
.checkbox.on .ic { opacity: 1; }
.radio {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #CCC; flex: none; position: relative;
  background: #fff; cursor: pointer; transition: border-color .15s;
}
.radio.on { border-color: var(--primary); }
.radio.on::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--primary);
}
.switch {
  width: 44px; height: 26px; border-radius: var(--r-pill); background: #DDD; position: relative; flex: none;
  cursor: pointer; transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(18px); }

/* 页内 Tab */
.tabs {
  display: flex; background: #fff; border-bottom: 1px solid var(--divider); overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 9; flex: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs span {
  padding: 11px 14px; font-size: 14px; color: var(--text-2); white-space: nowrap; position: relative; cursor: pointer;
}
.tabs span.on { color: var(--text); font-weight: 700; }
.tabs span.on::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 20px; height: 3px; margin-left: -10px;
  border-radius: 2px; background: var(--primary);
}
.tabs.accent span.on::after { background: var(--accent); }
.tabs.nostick { position: static; }

/* 进度条 */
.progress { height: 6px; background: #EEE; border-radius: 3px; overflow: hidden; }
.progress b { display: block; height: 100%; background: linear-gradient(90deg, #FFB17A, var(--accent)); border-radius: 3px; }
.progress.green b { background: var(--primary); }

/* 评分 */
.stars { display: inline-flex; gap: 1px; color: #FFB800; }
.stars .ic { width: 14px; height: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg); flex: none; }

/* 输入 */
.input-box {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 12px;
  font-size: 14px; outline: none; background: #fff;
}
.input-box:focus { border-color: var(--primary); }
.textarea {
  width: 100%; min-height: 88px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 14px; resize: none; outline: none; background: #fff; font-family: inherit;
}
.textarea:focus { border-color: var(--primary); }

/* 空状态 */
.empty { padding: 56px 0 40px; text-align: center; color: var(--text-3); }
.empty .ic { width: 64px; height: 64px; color: #D5D8DC; stroke-width: 1.2; margin: 0 auto 12px; display: block; }
.empty p { font-size: 14px; margin-bottom: 16px; }

/* Toast */
.toast-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 300; }
.toast {
  background: rgba(26, 26, 26, .86); color: #fff; padding: 11px 18px; border-radius: var(--r-sm); font-size: 14px;
  max-width: 260px; text-align: center; line-height: 1.4; animation: toastIn .2s ease-out;
}
.toast.out { animation: toastOut .2s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: scale(.95); } }

/* 底部弹层 */
.sheet-mask {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .45); z-index: 200; animation: fadeIn .2s ease-out;
}
.sheet-mask.out { animation: fadeOut .25s ease-in forwards; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: var(--r-lg) var(--r-lg) 0 0;
  z-index: 201; transform: translateY(0); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: env(safe-area-inset-bottom); max-height: 86%; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sheet);
}
.sheet.enter { transform: translateY(100%); }
.sheet.out { transform: translateY(100%); }
.sheet-hd {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; flex: none;
}
.sheet-hd h3 { font-size: 16px; font-weight: 700; }
.sheet-hd .ic { width: 20px; height: 20px; color: var(--text-3); }
.sheet-bd { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 16px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }

/* 居中确认框 */
.dialog-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); z-index: 210; display: flex; align-items: center; justify-content: center; animation: fadeIn .2s; }
.dialog {
  width: 300px; background: #fff; border-radius: var(--r-lg); padding: 24px 20px 0; text-align: center;
  animation: toastIn .2s ease-out;
}
.dialog h3 { font-size: 17px; margin-bottom: 8px; }
.dialog p { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.dialog-btns { display: flex; margin-top: 20px; border-top: 1px solid var(--divider); }
.dialog-btns button { flex: 1; height: 48px; font-size: 16px; color: var(--text-2); }
.dialog-btns button + button { border-left: 1px solid var(--divider); color: var(--primary); font-weight: 600; }

/* 弹层关闭按钮与表单字段 */
.sku-close {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--text-3); cursor: pointer; z-index: 2;
  background: rgba(0, 0, 0, .04);
}
.sku-close .ic { width: 16px; height: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
