/* 新版供应商分类页：左侧三级分类 + 右侧一行一条商品列表 */
/* 始终预留纵向滚动条宽度，避免展开分类/切换列表时页面宽度抖动 */
html {
    scrollbar-gutter: stable;
}

/* 宽度与老版 /category 的 .column-container 保持一致：最大 1400px、左右 20px 内边距 */
.sp-page {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    /* 顶部固定导航高 60px + 老版 20px 内边距，外层 .main-goods-panel 已有 15px 内边距 */
    padding: 65px 20px 30px;
}

html.has-marquee .sp-page {
    padding-top: 97px;
}

/* ==================== 左侧分类树 ==================== */
.sp-side {
    flex: 0 0 260px;
    width: 260px;
    background: #fff;
    border: 1px solid #f0f3fa;
    border-radius: 14px;
    padding: 10px;
    position: sticky;
    /* 导航 60px + 20px 间距，与老版侧栏对齐 */
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    /* 展开分类时滚动条出现/消失不再改变侧栏宽度，避免列表左右抖动 */
    scrollbar-gutter: stable;
}

html.has-marquee .sp-side {
    top: 112px;
    max-height: calc(100vh - 132px);
}

.sp-side::-webkit-scrollbar {
    width: 5px;
}

.sp-side::-webkit-scrollbar-thumb {
    background: #e2eaf5;
    border-radius: 4px;
}

.sp-side-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #1a3a5c;
    padding: 8px 10px 10px;
    border-bottom: 1px solid #f4f7fc;
    margin-bottom: 6px;
}

.sp-side-title i {
    color: #409EFF;
    font-size: 14px;
}

.sp-cate-tree,
.sp-sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sp-sub {
    display: none;
    /* 缩进收窄，保证 220px 宽的侧栏里三级分类名仍有足够空间 */
    margin-left: 10px;
    padding-left: 6px;
    border-left: 1px dashed #e6eefc;
}

.sp-node.open>.sp-sub {
    display: block;
}

.sp-cate {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 8px;
    border-radius: 9px;
    font-size: 13px;
    color: #4a5a6a;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.sp-cate:hover {
    background: #f4f9ff;
    color: #2986f7;
}

.sp-cate.active {
    background: linear-gradient(90deg, #eaf3ff, #f7fbff);
    color: #2986f7;
    font-weight: 600;
}

.sp-arrow {
    flex: 0 0 12px;
    width: 12px;
    font-size: 13px;
    line-height: 1;
    color: #b0bac6;
    text-align: center;
    transition: transform 0.18s ease;
}

.sp-node.open>.sp-cate .sp-arrow {
    transform: rotate(90deg);
    color: #409EFF;
}

.sp-arrow-empty {
    visibility: hidden;
}

.sp-cate-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
}

.sp-cate-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-side-empty {
    padding: 24px 10px;
    text-align: center;
    font-size: 13px;
    color: #a8b4c2;
}

/* ==================== 右侧商品列表 ==================== */
.sp-main {
    flex: 1;
    min-width: 0;
}

.sp-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border: 1px solid #f0f3fa;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.sp-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #f5f8ff;
    border-radius: 10px;
    padding: 3px;
}

.sp-tab {
    padding: 6px 12px;
    font-size: 13px;
    color: #66788a;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.sp-tab:hover {
    color: #2986f7;
}

.sp-tab.active {
    background: #fff;
    color: #2986f7;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(41, 134, 247, 0.18);
}

.sp-search {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 300px;
    margin-left: auto;
}

.sp-search input {
    width: 100%;
    height: 34px;
    border: 1px solid #e5ebf5;
    border-radius: 10px;
    padding: 0 32px 0 32px;
    font-size: 13px;
    color: #33465a;
    outline: none;
    background: #fbfdff;
    transition: all 0.18s ease;
}

.sp-search input:focus {
    border-color: #409EFF;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
}

.sp-search .search.icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    font-size: 13px;
    color: #a9b7c6;
}

.sp-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 !important;
    font-size: 13px;
    color: #b6c2d0;
    cursor: pointer;
    display: none;
}

.sp-search-clear.show {
    display: block;
}

.sp-count {
    font-size: 13px;
    color: #8c9bab;
    white-space: nowrap;
}

.sp-count b {
    color: #2986f7;
    font-weight: 700;
}

.sp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 切换分类/排序时旧列表半透明保留，等新数据返回后整体替换，避免高度塌陷闪动 */
.sp-list.loading {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* ==================== 表格化列表 ==================== */
/* 表头与商品行共用同一套列宽：图标 | 标题（占主位） | 价格 | 库存 | 购买 */
.sp-list-head,
.sp-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 128px 96px 116px;
    align-items: center;
    gap: 14px;
}

.sp-list-head {
    padding: 0 17px 8px;
    font-size: 12px;
    color: #9aa9b8;
}

.sp-list-head .sp-col-action {
    text-align: center;
}

.sp-item {
    background: #fff;
    border: 1px solid #f0f3fa;
    border-radius: 14px;
    padding: 12px 16px;
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.sp-item:hover {
    border-color: #cfe4ff;
    box-shadow: 0 8px 22px rgba(64, 158, 255, 0.12);
}

.sp-col-name {
    min-width: 0;
}

/* 置顶商品 HOT 标签：相对整张卡片定位，贴住卡片左上角（与卡片圆角、边框无缝衔接） */
.sp-item {
    position: relative;
}

.sp-hot-tag {
    position: absolute;
    top: -1px;
    left: -1px;
    z-index: 3;
    padding: 2px 9px;
    /* 左上圆角与卡片一致，右下圆角形成小切角，整体贴在卡片左上角 */
    border-radius: 14px 0 10px 0;
    background: linear-gradient(135deg, #ff7a45 0%, #ff2d55 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 0 rgba(255, 45, 85, 0);
    animation: spHotPulse 1.8s ease-in-out infinite;
    pointer-events: none;
}

/* 只做光晕呼吸，不做缩放，避免标签与卡片边缘脱离 */
@keyframes spHotPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 45, 85, 0); }
    50% { box-shadow: 0 0 12px rgba(255, 45, 85, 0.55); }
}

.sp-item-icon {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    border-radius: 12px;
    border: 1px solid #eef5ff;
    background: #f7fbff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sp-item-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.sp-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #23384d;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 购买按钮：库存为 0 时置灰禁用 */
.sp-buy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #2986f7;
    border-radius: 9px;
    background: #2986f7;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.sp-buy-btn:hover {
    background: #1677e8;
    border-color: #1677e8;
}

.sp-buy-btn i {
    margin: 0 !important;
    font-size: 12px;
}

.sp-buy-btn:disabled {
    background: #eef2f8;
    border-color: #e6ecf5;
    color: #b3c0ce;
    cursor: not-allowed;
}

/* 价格：主题橙色 + 加粗，突出售价 */
.sp-item-price {
    font-size: 16px;
    font-weight: 700;
    color: #ff6b35;
    line-height: 1.2;
    white-space: nowrap;
}

.sp-item-original {
    display: block;
    font-size: 12px;
    color: #b7c1cd;
    text-decoration: line-through;
    margin-top: 2px;
}

/* 库存数量：纯文字（无底色胶囊），有货绿色、缺货红色 */
.sp-item-stock {
    display: inline-block;
    max-width: 100%;
    color: #23a35a;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-col-stock {
    min-width: 0;
}

.sp-item-stock.out {
    color: #f15c52;
}

/* ==================== 状态提示 ==================== */
.sp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px 0;
    font-size: 13px;
    color: #9aa9b8;
}

.sp-empty {
    text-align: center;
    padding: 60px 20px;
    color: #a8b4c2;
    font-size: 14px;
    background: #fff;
    border: 1px dashed #e6eefc;
    border-radius: 14px;
}

.sp-empty i {
    display: block;
    font-size: 34px;
    color: #cfdae7;
    margin-bottom: 10px;
}

.sp-no-more {
    text-align: center;
    padding: 20px 0;
    font-size: 13px;
    color: #b3c0ce;
}

.sp-back-top {
    position: fixed;
    right: 26px;
    bottom: 34px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #eaf1fb;
    box-shadow: 0 6px 18px rgba(64, 158, 255, 0.18);
    display: none;
    align-items: center;
    justify-content: center;
    color: #409EFF;
    cursor: pointer;
    z-index: 900;
}

.sp-back-top.show {
    display: flex;
}

.sp-back-top i {
    margin: 0;
    font-size: 15px;
}

/* ==================== 购买弹窗 ==================== */
.sp-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(17, 34, 51, 0.45);
}

.sp-modal {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(17, 34, 51, 0.25);
    overflow: hidden;
    animation: spModalIn 0.18s ease;
}

@keyframes spModalIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.sp-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f3fa;
}

.sp-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #23384d;
}

.sp-modal-close {
    margin: 0 !important;
    font-size: 15px;
    color: #9aa9b8;
    cursor: pointer;
}

.sp-modal-close:hover {
    color: #2986f7;
}

.sp-modal-body {
    padding: 16px 18px 4px;
}

/* 商品信息行：图标高度跟随右侧「标题 + 库存行」，标题换行时两侧保持对称 */
.sp-buy-product {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px dashed #eef2f8;
}

.sp-buy-icon {
    flex: 0 0 54px;
    width: 54px;
    /* 单行标题时保持 54px 正方形，标题换行时随右侧内容一起拉伸 */
    height: auto;
    min-height: 54px;
    align-self: stretch;
    border-radius: 12px;
    border: 1px solid #eef5ff;
    background: #f7fbff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sp-buy-icon img {
    /* 图标随图标框一起拉伸，内含 7px 内边距保持 54px 高时的 40px 显示效果 */
    width: 100%;
    height: 100%;
    padding: 7px;
    box-sizing: border-box;
    object-fit: contain;
}

.sp-buy-name {
    font-size: 14px;
    font-weight: 600;
    color: #23384d;
    line-height: 1.5;
    word-break: break-word;
}

/* 标题下方的库存信息：总库存常显，类型库存仅在商品有宝贝类型时展示 */
.sp-buy-info {
    flex: 1;
    min-width: 0;
    /* 与左侧图标同高，标题+库存整体垂直居中对齐图标 */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sp-buy-stock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    margin-top: 6px;
    font-size: 12px;
    color: #8c9bab;
}

.sp-buy-stock-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sp-buy-stock-item b {
    color: #23384d;
    font-weight: 600;
}

.sp-buy-stock-item.sku b {
    color: #ff6b35;
}

/* 类型库存为 0：数字标红，库存不足文案统一走 layui 的 layer.msg 提示 */
.sp-buy-stock-item.sku.empty b {
    color: #e5484d;
}

/* 频道/群组公开链接输入框：仅商品所属分类开启该字段时展示 */
.sp-buy-link {
    padding: 12px 0;
    border-bottom: 1px solid #f6f9ff;
}

.sp-buy-link .sp-buy-label {
    display: block;
    margin-bottom: 8px;
}

.sp-buy-link-input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid #e5ebf5;
    border-radius: 9px;
    background: #fff;
    font-size: 13px;
    color: #23384d;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sp-buy-link-input::placeholder {
    color: #b0bac6;
}

.sp-buy-link-input:focus {
    border-color: #2986f7;
    box-shadow: 0 0 0 3px rgba(41, 134, 247, 0.12);
}

.sp-buy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    font-size: 13px;
}

.sp-buy-row+.sp-buy-row {
    border-top: 1px solid #f6f9ff;
}

/* 宝贝类型下拉：触发框左标题右价格，面板带搜索；json_data 无数据时整块隐藏 */
.sp-buy-sku {
    padding: 12px 0;
    border-bottom: 1px solid #f6f9ff;
}

.sp-buy-sku .sp-buy-label {
    display: block;
    margin-bottom: 8px;
}

.sp-sku-select {
    position: relative;
}

.sp-sku-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #e5ebf5;
    border-radius: 9px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sp-sku-trigger:hover {
    border-color: #cfe4ff;
}

.sp-sku-trigger.open {
    border-color: #2986f7;
    box-shadow: 0 0 0 3px rgba(41, 134, 247, 0.12);
}

.sp-sku-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sp-sku-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #23384d;
}

.sp-sku-price {
    flex: 0 0 auto;
    color: #ff6b35;
    font-weight: 600;
}

/* 箭头用内联 SVG：图形关于中心对称，翻转 180° 不会上下位移，始终与文字居中对齐 */
.sp-sku-caret {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    color: #a8b4c2;
    transition: transform 0.18s ease, color 0.18s ease;
}

.sp-sku-caret svg {
    display: block;
    width: 12px;
    height: 12px;
}

.sp-sku-trigger.open .sp-sku-caret {
    transform: rotate(180deg);
    color: #2986f7;
}

/* 面板为绝对定位浮层：不占文档流，展开/收起时模态框高度保持不变 */
.sp-sku-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    border: 1px solid #e5ebf5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 74, 130, 0.16);
    overflow: hidden;
}

.sp-sku-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #f2f6fc;
    background: #fafcff;
}

.sp-sku-search i {
    color: #b0bac6;
    font-size: 13px;
}

.sp-sku-search input {
    flex: 1;
    min-width: 0;
    height: 26px;
    border: 0;
    background: transparent;
    font-size: 13px;
    color: #23384d;
    outline: none;
}

.sp-sku-options {
    max-height: 168px;
    overflow-y: auto;
    padding: 4px;
}

.sp-sku-options::-webkit-scrollbar {
    width: 5px;
}

.sp-sku-options::-webkit-scrollbar-thumb {
    background: #e2eaf5;
    border-radius: 4px;
}

.sp-sku-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.16s ease;
}

.sp-sku-option:hover {
    background: #f4f9ff;
}

.sp-sku-option.active {
    background: #eaf3ff;
    font-weight: 600;
}

.sp-sku-option.active .sp-sku-name {
    color: #2986f7;
}

.sp-sku-empty {
    padding: 14px 10px;
    text-align: center;
    font-size: 13px;
    color: #a8b4c2;
}

/* 宝贝类型面板已改为浮层，需让模态框允许内容溢出显示（弹窗内容本身无需滚动） */
.sp-modal {
    overflow: visible;
}

.sp-buy-label {
    color: #8c9bab;
}

.sp-buy-unit {
    color: #33465a;
    font-weight: 600;
}

/* 数量步进器 */
.sp-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e5ebf5;
    border-radius: 10px;
    overflow: hidden;
}

.sp-qty-btn {
    width: 34px;
    height: 32px;
    border: 0;
    background: #f7faff;
    color: #54697f;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s ease;
}

.sp-qty-btn:hover {
    background: #eef4ff;
    color: #2986f7;
}

.sp-qty-input {
    width: 56px;
    height: 32px;
    border: 0;
    border-left: 1px solid #eef2f8;
    border-right: 1px solid #eef2f8;
    text-align: center;
    font-size: 13px;
    color: #23384d;
    outline: none;
    -moz-appearance: textfield;
}

.sp-qty-input::-webkit-outer-spin-button,
.sp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sp-buy-total-row {
    border-top: 1px dashed #eef2f8;
}

.sp-buy-total {
    font-size: 18px;
    font-weight: 700;
    color: #ff6b35;
}

.sp-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px 16px;
}

/* 按钮文字统一水平垂直居中：避免「查看商品介绍」等多字按钮文字偏位或换行 */
.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    height: 34px;
    padding: 0 18px;
    border: 1px solid #e2e9f3;
    border-radius: 9px;
    background: #fff;
    color: #54697f;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.sp-btn:hover {
    border-color: #cfe4ff;
    color: #2986f7;
}

/* 取消按钮：白底、蓝字、蓝边，与主按钮形成主次层级 */
.sp-btn.cancel {
    background: #fff;
    border-color: #2986f7;
    color: #2986f7;
}

.sp-btn.cancel:hover {
    background: #f2f8ff;
    border-color: #1677e8;
    color: #1677e8;
}

.sp-btn.primary {
    background: #2986f7;
    border-color: #2986f7;
    color: #fff;
    font-weight: 600;
}

.sp-btn.primary:hover {
    background: #1677e8;
    border-color: #1677e8;
}

/* ==================== 响应式 ==================== */
/* 移动端分类抽屉开关：桌面不显示，仅小屏固定到屏幕左侧 */
.sp-cate-toggle {
    display: none;
}

@media (max-width: 900px) {
    .sp-page {
        flex-direction: column;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* 分类侧栏收成左侧抽屉：默认藏在屏幕外，点漂浮按钮从左侧滑出 */
    .sp-side {
        position: fixed;
        top: 56px;
        bottom: 0;
        left: 0;
        flex: none;
        width: 260px;
        max-width: 82vw;
        max-height: none;
        z-index: 1150;
        border-radius: 0 14px 14px 0;
        border-left: 0;
        padding: 12px 10px 12px 12px;
        scrollbar-gutter: auto;
        box-shadow: 0 12px 30px rgba(17, 34, 51, 0.18);
        overflow-y: auto;
        transform: translateX(-102%);
        transition: transform 0.26s ease;
    }

    /* 顶部有滚动公告时导航整体下移 32px，抽屉同步 */
    html.has-marquee .sp-side {
        top: 88px;
        max-height: none;
    }

    .sp-side.show {
        transform: translateX(0);
    }

    /* 漂浮按钮：展开后跟随抽屉右移，箭头由向右翻转为向左 */
    .sp-cate-toggle {
        display: flex;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1200;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 68px;
        padding: 0;
        border: 1px solid #dfe9f6;
        border-left: 0;
        border-radius: 0 14px 14px 0;
        background: #fff;
        color: #2986f7;
        box-shadow: 0 6px 18px rgba(31, 74, 130, 0.16);
        cursor: pointer;
        transition: left 0.26s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .sp-cate-toggle svg {
        width: 18px;
        height: 18px;
        display: block;
        transition: transform 0.26s ease;
    }

    /* 展开态：左侧与抽屉右边缘重叠 1px、边框/阴影与抽屉一致，视觉上成为抽屉的一部分 */
    .sp-cate-toggle.show {
        left: calc(min(260px, 82vw) - 1px);
        border-color: #f0f3fa;
        border-radius: 0 14px 14px 0;
        box-shadow: 0 12px 30px rgba(17, 34, 51, 0.18);
    }

    .sp-cate-toggle.show svg {
        transform: rotate(180deg);
    }

    .sp-search {
        margin-left: 0;
        max-width: none;
        width: 100%;
        order: 9;
    }

    /* 小屏压缩各列宽度，保持表格化行结构 */
    .sp-list-head,
    .sp-item {
        grid-template-columns: 44px minmax(0, 1fr) 92px 76px 92px;
        gap: 8px;
    }

    .sp-list-head {
        padding: 0 13px 8px;
    }

    .sp-item {
        padding: 12px;
    }

    .sp-buy-btn {
        height: 32px;
        padding: 0 6px;
        font-size: 12px;
    }

    .sp-item-icon {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
    }

    .sp-item-icon img {
        width: 32px;
        height: 32px;
    }

    .sp-item-price {
        font-size: 15px;
    }

    .sp-modal {
        max-width: none;
    }
}

/* 手机端：表格化单行放不下（标题列被挤到只剩 1~2 个字），改为卡片式两行布局 */
@media (max-width: 640px) {
    /* 列标题在卡片布局下无意义，隐藏；用 !important 覆盖 JS 设置的内联 display */
    .sp-list-head {
        display: none !important;
    }

    .sp-item {
        /* 5 列：图标 | 价格 | 库存 | 弹性占位 | 按钮；第二行价格与库存相邻，按钮贴右 */
        grid-template-columns: 44px auto auto minmax(0, 1fr) auto;
        grid-template-areas:
            "icon name name name name"
            "icon price stock . action";
        column-gap: 8px;
        row-gap: 8px;
        padding: 12px;
    }

    .sp-col-icon {
        grid-area: icon;
        align-self: start;
    }

    .sp-col-name {
        grid-area: name;
    }

    .sp-col-price {
        grid-area: price;
        align-self: center;
        min-width: 0;
    }

    /* 库存紧跟价格，不再挤在购买按钮前面 */
    .sp-col-stock {
        grid-area: stock;
        justify-self: start;
        align-self: center;
    }

    .sp-col-action {
        grid-area: action;
        align-self: center;
    }

    /* 标题允许折成两行，避免只剩一两个字 */
    .sp-item-name {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        font-size: 13px;
    }

    .sp-buy-btn {
        min-width: 68px;
        padding: 0 10px;
    }

    /* 原价与现价同一行，节省纵向空间 */
    .sp-item-original {
        display: inline;
        margin-top: 0;
        margin-left: 4px;
    }

    /* 窄屏抽屉再收窄一点，避免完全盖住列表 */
    .sp-side {
        width: 240px;
        max-width: 80vw;
    }

    .sp-cate-toggle.show {
        left: calc(min(240px, 80vw) - 1px);
    }
}


