/* 赠品活动计算系统 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8; color: #333; font-size: 14px; line-height: 1.6;
}
#app { max-width: 640px; margin: 0 auto; padding: 12px 12px 60px; transition: max-width 0.2s; }
#app.wide { max-width: 1080px; }
a { color: #ff6b2b; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }

/* 导航 */
.nav { display: flex; background: #fff; border-radius: 12px; padding: 4px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); position: sticky; top: 8px; z-index: 50; }
.nav-item { flex: 1; text-align: center; font-size: 14px; color: #666; padding: 10px 0; border-radius: 8px; cursor: pointer; }
.nav-item.active { background: #ff6b2b; color: #fff; font-weight: 600; }
.nav-admin { flex: 0 0 auto; padding: 10px 16px; }

/* 卡片 */
.card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.card-title.no-margin { margin-bottom: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.tip-text { font-size: 13px; color: #888; margin-top: 10px; }
.empty-tip { color: #999; font-size: 13px; padding: 12px 0; }

/* SKU */
.sku-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sku-item { width: 130px; border: 1px solid #eee; border-radius: 8px; padding: 10px; text-align: center; cursor: pointer; }
.sku-item.selected { border-color: #ff6b2b; background: #fff7f2; }
.sku-name { font-size: 15px; font-weight: 600; }
.sku-price { font-size: 14px; color: #ff6b2b; margin-top: 2px; }
.sku-code { font-size: 11px; color: #999; }

/* 数量 */
.count-row { display: flex; align-items: center; }
.step-btn { width: 38px; height: 38px; line-height: 36px; text-align: center; border: 1px solid #ddd; border-radius: 8px; font-size: 20px; cursor: pointer; user-select: none; }
.count-input { width: 100px; height: 38px; text-align: center; font-size: 18px; font-weight: 600; margin: 0 8px; border: none; border-bottom: 2px solid #ff6b2b; outline: none; }
.count-unit { margin-left: 6px; color: #666; }
.quick-row { margin-top: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.quick-label { color: #999; font-size: 13px; }
.quick-btn { font-size: 13px; color: #ff6b2b; background: #fff1e6; border-radius: 12px; padding: 3px 12px; cursor: pointer; }

/* switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch.small { width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 20px; transition: 0.2s; }
.slider:before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.switch.small .slider:before { height: 16px; width: 16px; left: 3px; bottom: 3px; }
.switch input:checked + .slider { background: #ff6b2b; }
.switch input:checked + .slider:before { transform: translateX(20px); }
.switch.small input:checked + .slider:before { transform: translateX(16px); }

/* 膨胀金 */
.infl-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.infl-opt { width: 128px; border: 1px solid #eee; border-radius: 8px; padding: 8px 10px; text-align: center; cursor: pointer; }
.infl-opt.on { border-color: #ff6b2b; background: #fff7f2; }
.infl-opt-name { font-size: 13px; font-weight: 600; }
.infl-opt-pay { font-size: 12px; color: #ff6b2b; }
.infl-opt-tag { font-size: 11px; color: #12b76a; }
.infl-opt-tag.diff { color: #bbb; }
.infl-main { margin-top: 12px; }
.infl-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; background: #fff7f2; border-radius: 8px; padding: 10px 12px; }
.infl-bonus { font-size: 13px; font-weight: 600; }
.infl-discount { font-size: 12px; color: #fff; background: #ff6b2b; border-radius: 12px; padding: 2px 8px; }
.infl-detail { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #666; margin-top: 8px; }
.infl-note { font-size: 12px; color: #aaa; margin-top: 8px; }

/* 金额汇总 */
.summary .sum-row { display: flex; justify-content: space-between; font-size: 14px; color: #666; padding: 5px 0; }
.strong { color: #333; font-weight: 600; }
.cut { color: #12b76a; font-weight: 600; }
.sum-row.pay { border-top: 1px dashed #eee; margin-top: 4px; padding-top: 10px; }
.pay-num { color: #ff3b30; font-size: 20px; font-weight: 700; }

/* 赠品分类 */
.act-group { border: 1px solid #f0f0f0; border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.act-head { display: flex; align-items: center; }
.act-name { font-size: 15px; font-weight: 600; margin-right: 8px; }
.act-type { font-size: 11px; color: #ff6b2b; background: #fff1e6; padding: 1px 8px; border-radius: 10px; }
.act-note { font-size: 12px; color: #999; margin: 4px 0 8px; }
.tier-row { display: flex; align-items: flex-start; margin-bottom: 6px; }
.tier-cond { flex-shrink: 0; font-size: 12px; color: #ff6b2b; font-weight: 600; background: #fff1e6; border-radius: 6px; padding: 4px 8px; margin-right: 8px; }
.gift-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gift-chip { display: flex; align-items: center; background: #fafafa; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.gift-name { font-size: 13px; }
.gift-value { font-size: 11px; color: #999; margin-left: 6px; }
.gift-arrow { color: #ccc; margin-left: 4px; }

.bottom-tip { text-align: center; font-size: 12px; color: #bbb; margin-top: 6px; }

/* 推荐 */
.plan { border: 1px solid #ffe3d1; }
.plan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.plan-count { font-size: 15px; font-weight: 600; }
.plan-count .num { color: #ff6b2b; font-size: 24px; }
.plan-rate { font-size: 12px; color: #fff; background: #ff6b2b; border-radius: 12px; padding: 3px 10px; }
.plan-money { display: flex; margin-bottom: 10px; }
.money-item { flex: 1; }
.money-label { font-size: 12px; color: #999; }
.money-val { font-size: 15px; font-weight: 600; margin-top: 2px; }
.money-val.cut { color: #12b76a; }
.money-val.pay { color: #ff3b30; }
.plan-gifts { background: #fafafa; border-radius: 8px; padding: 8px 10px; }
.gift-group { margin-bottom: 4px; }
.gift-group-type { display: inline-block; font-size: 11px; color: #ff6b2b; background: #fff1e6; border-radius: 6px; padding: 1px 8px; margin-right: 6px; }
.gift-group-items { font-size: 12px; color: #555; margin-right: 8px; }
.gift-value { font-size: 11px; color: #999; margin-top: 4px; }

/* 后台 */
.head-title { font-size: 17px; font-weight: 700; }
.head-sub { font-size: 12px; color: #999; margin: 4px 0 12px; }
.head-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.seg-tab { font-size: 13px; padding: 6px 16px; border-radius: 8px; background: #f5f5f5; color: #666; cursor: pointer; }
.seg-tab.on { background: #ff6b2b; color: #fff; font-weight: 600; }
.btn { font-size: 13px; padding: 8px 16px; border-radius: 8px; background: #f5f5f5; color: #333; cursor: pointer; display: inline-block; }
.btn-primary { background: #ff6b2b; color: #fff; font-weight: 600; }
.btn-plain { background: #fff; border: 1px solid #ddd; color: #999; }
.btn-small { font-size: 12px; padding: 5px 14px; }
.btn-danger { color: #ff3b30; background: #ffecec; }
.btn-add { text-align: center; font-size: 13px; color: #ff6b2b; border: 1px dashed #ff6b2b; border-radius: 8px; padding: 10px 0; cursor: pointer; margin-top: 8px; }

.act { position: relative; }
.act-row1 { display: flex; justify-content: space-between; align-items: center; }
.act-name { font-size: 15px; font-weight: 600; margin-right: 8px; }
.act-type { font-size: 11px; color: #ff6b2b; background: #fff1e6; padding: 1px 8px; border-radius: 10px; }
.switch-wrap { display: flex; align-items: center; }
.switch-label { font-size: 12px; color: #999; margin-right: 4px; }
.act-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #888; margin: 8px 0; }
.tier-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tier-item { font-size: 12px; background: #fafafa; border-radius: 6px; padding: 4px 8px; }
.tier-cond { color: #ff6b2b; font-weight: 600; margin-right: 4px; }
.tier-gift { color: #555; }
.act-btns { display: flex; gap: 8px; }

.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sec-title { font-size: 16px; font-weight: 600; }
.hint { font-size: 12px; color: #f0a020; margin-bottom: 8px; }
.data-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f7f7f7; flex-wrap: wrap; }
.cell { display: flex; align-items: center; font-size: 13px; color: #666; }
.in-input { background: #f7f8fa; border: none; border-radius: 6px; padding: 6px 10px; font-size: 13px; outline: none; }
.in-input:focus { box-shadow: 0 0 0 1px #ff6b2b; }
.w-name { width: 180px; }
.w-price { width: 80px; text-align: center; }
.w-code { width: 130px; }
.w-cat { width: 110px; }
.cat-chip { color: #185FA5; background: #E6F1FB; }
.cat-chip.on { color: #fff; background: #185FA5; border-color: #185FA5; }
.del-link { font-size: 12px; color: #ff3b30; background: #ffecec; border-radius: 6px; padding: 4px 10px; cursor: pointer; margin-left: auto; }
.ratio-tag { font-size: 11px; color: #0F6E56; background: #E1F5EE; border-radius: 6px; padding: 4px 8px; }
.save-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.field { margin-bottom: 14px; }
.label { font-size: 13px; color: #666; margin-bottom: 6px; }
.date-row { display: flex; align-items: center; gap: 8px; }
.date-sep { color: #999; }
.textarea { background: #f7f8fa; border: none; border-radius: 8px; padding: 8px 10px; font-size: 13px; width: 100%; min-height: 80px; outline: none; resize: vertical; }

/* 弹窗 */
.popup-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; display: flex; align-items: center; justify-content: center; }
.popup-box { width: 90%; max-width: 480px; max-height: 75vh; overflow-y: auto; background: #fff; border-radius: 12px; padding: 20px 16px; position: relative; }
.popup-close { position: absolute; right: 14px; top: 8px; font-size: 24px; color: #999; cursor: pointer; }
.popup-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; padding-right: 30px; }
.popup-tags { margin-bottom: 12px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 12px; margin-right: 6px; }
.tag-type { background: #fff1e6; color: #ff6b2b; }
.tag-on { background: #e8f7ee; color: #12b76a; }
.tag-off { background: #f2f3f5; color: #999; }
.sec { margin-bottom: 14px; }
.sec-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.rule-row { display: flex; align-items: center; background: #fafafa; border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; }
.rule-cond { color: #ff6b2b; font-weight: 600; font-size: 13px; margin-right: 10px; flex-shrink: 0; }
.rule-gifts { font-size: 13px; }
.rule-note { color: #888; font-size: 12px; margin-top: 4px; }
.detail-text { color: #555; font-size: 13px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: #fff; font-size: 13px; padding: 8px 16px; border-radius: 8px; z-index: 1000; }

/* 分类分组框 */
.group-box { border: 1px solid #eee; border-left: 4px solid #ff6b2b; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; background: #fff; }
.group-title { font-size: 14px; font-weight: 600; color: #ff6b2b; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.group-title:hover { opacity: 0.8; }
.group-count { font-size: 11px; font-weight: 400; color: #999; background: #f5f6f8; border-radius: 10px; padding: 1px 8px; }
.fold-arrow { margin-left: auto; font-size: 12px; color: #bbb; transition: transform 0.15s; display: inline-block; }
.fold-arrow.open { transform: rotate(90deg); }
/* 档位内联小分组 */
.mini-group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mini-group-name { font-size: 12px; color: #999; flex-shrink: 0; min-width: 70px; }
/* 赠品图片框 */
.img-box { width: 52px; height: 52px; border: 1px dashed #ddd; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; flex-shrink: 0; background: #fafafa; }
.img-box:hover { border-color: #ff6b2b; }
.img-box img { width: 100%; height: 100%; object-fit: cover; }
.img-plus { font-size: 22px; color: #ccc; line-height: 1; }
.gift-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.gift-main-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.w-desc { width: 100%; box-sizing: border-box; }
/* 拖拽高亮 */
.card.dragging { outline: 2px dashed #ff6b2b; outline-offset: -8px; background: #fff8f3; }
/* 活动档位赠品卡片（图片+名称） */
.gift-card { display: inline-flex; align-items: center; gap: 6px; background: #fafafa; border: 1px solid transparent; border-radius: 8px; padding: 3px 10px 3px 3px; cursor: pointer; font-size: 13px; color: #666; }
.gift-card img { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; background: #fff; }
.gift-card:hover { border-color: #ffc9ad; }
.gift-card.on { border-color: #ff6b2b; background: #fff1e6; color: #ff6b2b; font-weight: 600; }
.gift-desc-line { display: block; color: #999; font-size: 12px; }

/* 活动编辑表单 */
.in-input.full { width: 100%; }
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-tab.sm { font-size: 12px; padding: 4px 10px; }
.label.no-margin { margin-bottom: 0; }
.label.sm { font-size: 12px; color: #888; margin: 8px 0 6px; }
.sku-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { font-size: 13px; color: #666; background: #f5f6f8; border: 1px solid transparent; border-radius: 8px; padding: 5px 14px; cursor: pointer; }
.check-chip.on { color: #ff6b2b; background: #fff1e6; border-color: #ff6b2b; font-weight: 600; }
.tier-box { border: 1px solid #f0f0f0; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.tier-edit-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.save-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.head-btns .btn { cursor: pointer; }
.btns { display: flex; gap: 8px; }

@media (min-width: 640px) {
  body { padding-top: 8px; }
}
