body { background-color: #f8f9fa; padding-bottom: 60px; }
.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    transition: transform 0.2s;
}
.product-card:active { transform: scale(0.98); }
.product-img {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Square */
    background-size: cover;
    background-position: center;
    background-color: #eee;
}
.product-img-tag {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background-color: #eee;
    display: block;
}
.product-info { padding: 10px; }
.product-title { font-size: 14px; font-weight: bold; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-price { color: #dc3545; font-size: 16px; font-weight: bold; }
.product-code { font-size: 12px; color: #999; }

.search-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 商家列表排序：「最新」+ #idxSortPriceWrap 价格子菜单（与图二一致） */
.idx-sort-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    color: #212529;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.idx-sort-pill:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}
.idx-sort-pill.idx-sort-pill-active {
    background: #fff;
    border-color: #ced4da;
    color: #111;
}
.idx-sort-price-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}
/* 悬停时按钮与面板之间有视觉间隙，指针经过会离开 wrap 触发 mouseleave；
   用伪元素做桥接，top 取负延伸入按钮、height 延伸到面板下方，确保全程在 wrap 内 */
.idx-sort-price-wrap.idx-sort-panel-open::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 14px);
    height: calc(100% + 14px);
    z-index: 49;
    pointer-events: auto;
}
.idx-sort-price-btn.idx-sort-price-highlight {
    color: #e85d04;
    border-color: #e85d04;
    background: #fff;
}
.idx-sort-price-btn.idx-sort-price-highlight:hover {
    background: #fff8f3;
}
.idx-sort-price-wrap.idx-sort-panel-open .idx-sort-price-btn {
    color: #e85d04;
    border-color: #e85d04;
    background: #fff;
}
.idx-sort-price-chevron {
    font-size: 10px;
    margin-left: 2px;
    transition: transform 0.2s ease;
}
.idx-sort-price-wrap.idx-sort-panel-open .idx-sort-price-chevron {
    transform: rotate(180deg);
}
.idx-sort-price-panel {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 132px;
    padding: 6px 0;
    margin: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 50;
}
.idx-sort-price-wrap.idx-sort-panel-open .idx-sort-price-panel {
    display: block;
}
.idx-sort-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    color: #212529;
    background: transparent;
    border: none;
    cursor: pointer;
    line-height: 1.3;
}
.idx-sort-menu-item:hover {
    background: #f8f9fa;
}
.idx-sort-menu-item.idx-sort-menu-active {
    color: #e85d04;
    font-weight: 700;
}

#reader { width: 100%; display: none; }

#productDetailModal .modal-content {
    border-radius: 14px;
    overflow: hidden;
}
#productDetailModal .modal-header {
    padding: 14px 14px 0 14px;
}
#productDetailModal .modal-body {
    padding: 14px;
}
#productDetailModal .jn-detail-grid {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
@media (min-width: 768px) {
    #productDetailModal .jn-detail-grid {
        grid-template-columns: 60px minmax(0, 1fr) 360px;
        gap: 18px;
        align-items: stretch;
    }
}
#productDetailModal .jn-detail-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#productDetailModal .jn-detail-thumbs img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background: #f0f0f0;
    border: 1px solid #e9ecef;
    cursor: pointer;
}
#productDetailModal .jn-detail-thumbs img.border-primary {
    border-width: 2px;
}
/* 外层圆角 + 裁剪，避免大图 object-fit:contain 时四角仍显直角 */
#productDetailModal .jn-detail-media {
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    line-height: 0;
}
#productDetailModal .jn-detail-media img {
    width: 100%;
    display: block;
    border-radius: 0;
    background: #f5f5f5;
    min-height: 320px;
    max-height: 70vh;
    object-fit: contain;
}
#productDetailModal .jn-detail-info {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}
@media (min-width: 768px) {
    #productDetailModal .jn-detail-info {
        max-height: 70vh;
    }
    #productDetailModal .jn-detail-info-scroll {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 2px;
    }
    #productDetailModal .jn-detail-info-foot {
        flex-shrink: 0;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px solid #e9ecef;
        background: #fff;
    }
    #productDetailModal .market-product-comments-list {
        max-height: none;
        overflow: visible;
    }
}
/* 与市场 market.html 商品弹窗评论列表一致 */
#productDetailModal .market-product-comments-list .mkt-cmt {
    border-bottom: 1px solid #eee;
    padding: 8px 0;
}
#productDetailModal .market-product-comments-list .mkt-cmt--reply {
    margin-left: 10px;
    padding-left: 8px;
    border-left: 2px solid #e9ecef;
}
#productDetailModal .market-product-comments-list .mkt-cmt-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
#productDetailModal .market-product-comments-list .mkt-cmt-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eee;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
#productDetailModal .market-product-comments-list .mkt-cmt-av--sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}
#productDetailModal .market-product-comments-list .mkt-cmt-av img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#productDetailModal .market-product-comments-list .mkt-cmt-name {
    font-weight: 600;
}
#productDetailModal .market-product-comments-list .mkt-cmt-meta {
    font-size: 11px;
    color: #888;
}
#productDetailModal .market-product-comments-list .mkt-badge-owner {
    font-size: 10px;
    vertical-align: middle;
}
#productDetailModal .jn-detail-info-foot .jn-comments-input-bar {
    margin-top: 0;
}
#productDetailModal .jn-detail-info-foot .jn-actions {
    margin-top: 10px;
    padding-top: 0;
}
#productDetailModal .jn-merchant-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #f8f9fa;
}
#productDetailModal .jn-merchant-card img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}
#productDetailModal .jn-merchant-meta {
    line-height: 1.1;
}
#productDetailModal .jn-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 14px 0 6px 0;
}
#productDetailModal .jn-price {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.05;
    color: #dc3545;
}
/* 与市场商品详情一致：编号胶囊 + 「复制」同一行，价格/询价独占下一行 */
#productDetailModal .jn-code-price {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
#productDetailModal .jn-code-price .jn-price {
    flex: 1 0 100%;
    max-width: 100%;
}
#productDetailModal .jn-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    background: #5a6268;
    color: #fff;
    border: none;
    box-shadow: none;
}
/* 独立「复制」按钮：白底灰框灰字，高度略低于胶囊，纵向与胶囊居中 */
#productDetailModal .jn-code-price > #modalDetailCodeCopy.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
    background: #fff;
    border: 1px solid #adb5bd;
    border-radius: 6px;
    line-height: 1.25;
    box-shadow: none;
}
#productDetailModal .jn-code-price > #modalDetailCodeCopy.btn:hover {
    color: #495057;
    border-color: #868e96;
    background: #f8f9fa;
}
#productDetailModal .jn-code-price > #modalDetailCodeCopy.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.2);
}
#productDetailModal .jn-meta {
    margin-top: 10px;
    color: #6c757d;
    font-size: 16px;
}
#productDetailModal .jn-desc {
    margin-top: 10px;
    color: #6c757d;
    font-size: 13px;
}
#productDetailModal .jn-comments {
    margin-top: 16px;
}
#productDetailModal .jn-warn {
    margin-top: 10px;
    color: #dc3545;
    font-size: 16px;
}
#productDetailModal .jn-actions {
    margin-top: auto;
    padding-top: 14px;
}
#productDetailModal .jn-actions .btn {
    height: 52px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
}
#productDetailModal .jn-tags, #detailPage .jn-tags {
    margin-top: 8px;
}
#productDetailModal .jn-tags a, #detailPage .jn-tags a {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 2px 8px;
    background-color: #f1f3f5;
    border-radius: 12px;
    color: #0d6efd;
    text-decoration: none;
    font-size: 14px;
}

.mobile-detail-page,
.mobile-consult-bar,
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 767.98px) {
    body {
        background: #f6f7f9;
        padding-bottom: 66px;
    }
    #productDetailModal {
        display: none !important;
    }
    .mobile-detail-page {
        display: block;
        min-height: 100vh;
        background: #f6f7f9;
    }
    .mobile-detail-media {
        position: relative;
        background: #111;
        border-radius: 0 0 16px 16px;
        overflow: hidden;
    }
    .mobile-detail-main-img {
        width: 100%;
        height: 56vh;
        object-fit: cover;
        display: block;
        background: #222;
    }
    .mobile-back-btn {
        position: absolute;
        top: 12px;
        left: 12px;
        border: 0;
        background: rgba(0, 0, 0, 0.35);
        color: #fff;
        width: 34px;
        height: 34px;
        border-radius: 17px;
    }
    .mobile-download-btn {
        position: absolute;
        right: 12px;
        bottom: 12px;
        border: 0;
        background: rgba(0, 0, 0, 0.4);
        color: #fff;
        border-radius: 14px;
        padding: 4px 10px;
        font-size: 12px;
    }
    .mobile-detail-pager {
        position: absolute;
        right: 12px;
        bottom: 44px;
        background: rgba(0, 0, 0, 0.4);
        color: #fff;
        border-radius: 12px;
        font-size: 12px;
        padding: 2px 8px;
    }
    .mobile-detail-sheet {
        margin-top: -12px;
        background: #fff;
        border-radius: 16px 16px 0 0;
        padding: 18px 14px 18px 14px;
    }
    .mobile-price {
        color: #e02020;
        font-size: 24px;
        font-weight: 800;
        line-height: 1;
        margin-top: 4px;
    }
    .mobile-title {
        margin-top: 10px;
        font-size: 18px;
        line-height: 1.25;
        font-weight: 700;
        color: #111;
    }
    .mobile-param-card {
        margin-top: 12px;
        background: #eefdf1;
        border-radius: 10px;
        overflow: hidden;
    }
    .mobile-param-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 14px;
        line-height: 1.35;
    }
    .mobile-param-table td {
        border-bottom: 1px solid #dff1e3;
        border-right: 1px solid #dff1e3;
        padding: 9px 12px;
        vertical-align: top;
        line-height: 1.35;
    }
    .mobile-param-table tr td:last-child {
        border-right: 0;
    }
    .mobile-param-table tr:last-child td {
        border-bottom: 0;
    }
    .mobile-param-table .k {
        color: #367a53;
        width: 30%;
        font-weight: 600;
    }
    .mobile-param-table .v {
        color: #0f3120;
        width: 70%;
        font-weight: 500;
        word-break: break-all;
    }
    .mobile-consult-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 58px;
        background: #fff;
        border-top: 1px solid #eaeaea;
        display: none;
        align-items: center;
        padding: 6px 10px;
        z-index: 1060;
        gap: 8px;
    }
    .mobile-consult-bar.show {
        display: flex;
    }
    .mobile-avatar-btn {
        width: 38px;
        height: 38px;
        border: 0;
        background: transparent;
        padding: 0;
    }
    .mobile-avatar-btn img {
        width: 38px;
        height: 38px;
        border-radius: 19px;
        object-fit: cover;
    }
    .mobile-icon-btn {
        border: 0;
        background: transparent;
        color: #333;
        width: 54px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        line-height: 1.1;
    }
    .mobile-icon-btn i {
        font-size: 16px;
        margin-bottom: 2px;
    }
    .mobile-consult-btn {
        flex: 1;
        border: 0;
        border-radius: 22px;
        background: #086a3b;
        color: #fff;
        font-size: 18px;
        font-weight: 700;
        height: 42px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 10px;
        height: 58px;
        background: #fff;
        border-top: 1px solid #eaeaea;
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 1055;
    }
    .mobile-bottom-nav .nav-btn {
        border: 0;
        background: transparent;
        width: 25%;
        height: 58px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #222;
        font-size: 12px;
        line-height: 1.1;
        padding: 0;
    }
    .mobile-bottom-nav .nav-btn i {
        font-size: 18px;
        margin-bottom: 4px;
    }
    #navBtnMessage {
        position: relative;
    }
    body.detail-open .mobile-bottom-nav {
        display: none;
    }
    .mobile-param-table .btn[data-copy] {
        min-height: 44px;
        min-width: 56px;
        padding: 8px 12px;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-detail-sheet {
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    }
    .mobile-param-card {
        border-radius: 12px;
    }
}

/* 抢购页详情弹层：与一口价 #productDetailModal 同款布局 */
#skFlashDetailModal .modal-content {
    border-radius: 14px;
    overflow: hidden;
}
#skFlashDetailModal .modal-header {
    padding: 14px 14px 0 14px;
}
#skFlashDetailModal .modal-body {
    padding: 14px;
}
#skFlashDetailModal .jn-detail-grid {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
@media (min-width: 768px) {
    #skFlashDetailModal .jn-detail-grid {
        grid-template-columns: 60px minmax(0, 1fr) 360px;
        gap: 18px;
    }
}
#skFlashDetailModal .jn-detail-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#skFlashDetailModal .jn-detail-thumbs img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background: #f0f0f0;
    border: 1px solid #e9ecef;
    cursor: pointer;
}
#skFlashDetailModal .jn-detail-thumbs img.border-primary {
    border-width: 2px;
}
#skFlashDetailModal .jn-detail-media {
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    line-height: 0;
}
#skFlashDetailModal .jn-detail-media img {
    width: 100%;
    display: block;
    border-radius: 0;
    background: #f5f5f5;
    min-height: 220px;
    max-height: 70vh;
    object-fit: contain;
}
#skFlashDetailModal .jn-detail-info {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
#skFlashDetailModal .jn-merchant-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #f8f9fa;
}
#skFlashDetailModal .jn-merchant-card img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}
#skFlashDetailModal .jn-merchant-meta {
    line-height: 1.1;
}
#skFlashDetailModal .jn-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 14px 0 6px 0;
    line-height: 1.3;
    word-break: break-word;
}
#skFlashDetailModal .jn-price {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.05;
    color: #dc3545;
}
#skFlashDetailModal .jn-code-price {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
}
#skFlashDetailModal .jn-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    background: #6c757d;
    color: #fff;
}
#skFlashDetailModal .jn-meta {
    margin-top: 10px;
    color: #6c757d;
    font-size: 15px;
    line-height: 1.4;
}
#skFlashDetailModal .jn-desc {
    margin-top: 10px;
    color: #6c757d;
    font-size: 13px;
    line-height: 1.5;
}
#skFlashDetailModal .jn-warn {
    margin-top: 10px;
    color: #dc3545;
    font-size: 14px;
}
#skFlashDetailModal .jn-actions {
    margin-top: auto;
    padding-top: 14px;
}
#skFlashDetailModal .jn-actions .btn {
    height: 52px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
}
#skFlashDetailModal .sk-flash-round-cd {
    font-size: 14px;
    font-weight: 700;
    color: #fd7e14;
}
.idx-inquiry-btn {
    background-color: #e53935;
    color: #fff;
    border: none;
    font-weight: 600;
    border-radius: 4px;
}
.idx-inquiry-btn:hover {
    color: #fff;
    opacity: 0.92;
}

/* PC：悬停在用户名上展开；窄屏：点击切换（面板样式与 market.html .mkt-user-menu-* 一致） */
.idx-user-menu-wrap { position: relative; }
.idx-user-menu-trigger {
    cursor: pointer;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1.25;
}
.idx-user-menu-panel {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: calc(100% - 2px);
    min-width: 9.5rem;
    z-index: 2200;
    padding: 8px 0 6px;
    margin-top: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
/* 与市场顶栏一致：退出 → 收藏 → 发布产品（DOM 顺序不变，仅视觉顺序） */
.idx-user-menu-panel > .idx-user-menu-logout { order: 1; }
.idx-user-menu-panel > a.idx-user-menu-item:nth-of-type(1) { order: 2; }
.idx-user-menu-panel > a.idx-user-menu-item:nth-of-type(2) { order: 3; }
.idx-user-menu-item {
    display: block;
    width: 100%;
    padding: 0.45rem 0.95rem;
    font-size: 0.875rem;
    color: #212529;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    box-sizing: border-box;
    text-align: left;
}
.idx-user-menu-item:hover { background: #f8f9fa; }
@media (min-width: 768px) {
    .idx-user-menu-wrap:hover .idx-user-menu-trigger { background: #f0f2f5; }
    .idx-user-menu-wrap:hover .idx-user-menu-panel { display: flex; }
}
@media (max-width: 767.98px) {
    .idx-user-menu-wrap.idx-user-menu-open .idx-user-menu-panel { display: flex; }
}

/* 商家页登录后隐藏「注册」（body.logged-in 由 js/index.js 在 me 接口返回已登录时添加，兼容所有浏览器） */
body.idx-page.logged-in #idxRegBtnSlot,
body.idx-page.logged-in #idxStickyRegBtnSlot {
    display: none !important;
}

@media (max-width: 767.98px) {
    #skFlashDetailModal .jn-detail-grid {
        grid-template-columns: 1fr;
    }
    #skFlashDetailModal .jn-detail-thumbs {
        flex-direction: row;
        flex-wrap: wrap;
    }
    #skFlashDetailModal .jn-detail-media img {
        max-height: 42vh;
        min-height: 180px;
    }
}

/* ========== 商家列表页 #listPage：与市场首页商品卡一致 ==========
   - 隐藏「下载图片」按钮（仅 CSS，DOM 保留）
   - 内容区顺序：标题 → 编号 → 聊一聊/价格
*/
#listPage .product-card > button.btn-light,
#listPage .product-card > button[title="下载图片"] {
    display: none !important;
}
#listPage .product-info {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
#listPage .product-title {
    order: 1;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}
#listPage .product-code {
    order: 2;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    margin-top: 0;
}
#listPage .product-info > .idx-inquiry-btn,
#listPage .product-info > .product-price {
    order: 3;
    align-self: flex-start;
    margin-top: 0;
    margin-bottom: 0;
}
#listPage .product-info > .idx-inquiry-btn {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
#listPage .product-info > .product-price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #dc3545;
}
