        .modal-overlay {
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 999;
        }
        .modal-content {
            background: #fff;
            padding: 20px;
            border-radius: 12px;
            width: 92%;
            max-width: 420px;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
        }
        .modal-close {
            position: absolute;
            top: 10px; right: 14px;
            font-size: 22px;
            cursor: pointer;
            color: #999;
            background: none;
            border: none;
        }
        .modal-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 18px;
            text-align: center;
            color: #333;
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 14px;
        }
        .form-label {
            display: block;
            font-size: 13px;
            color: #666;
            margin-bottom: 5px;
        }
        .form-input {
            width: 100%;
            padding: 9px 12px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }
        .form-input:focus {
            border-color: #0088ff;
        }
        .form-row {
            display: flex;
            gap: 8px;
        }
        .form-row .form-input {
            flex: 1;
        }
        .sms-btn {
            padding: 9px 14px;
            background: #0088ff;
            color: #fff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .sms-btn:disabled {
            background: #ccc;
            cursor: not-allowed;
        }
        .submit-btn {
            width: 100%;
            padding: 11px;
            background: linear-gradient(135deg, #0088ff, #0066cc);
            color: #fff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 15px;
            font-weight: bold;
            margin-top: 6px;
        }
        .submit-btn:active {
            opacity: 0.85;
        }
        .switch-link {
            text-align: center;
            margin-top: 12px;
            font-size: 13px;
            color: #0088ff;
            cursor: pointer;
        }

        /* 个人中心 */
        .user-info-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: #f8f9fa;
            border-radius: 8px;
            margin-bottom: 8px;
            font-size: 14px;
        }
        .user-info-row .info-label {
            color: #999;
            font-size: 13px;
        }
        .user-info-row .info-value {
            color: #333;
            font-weight: 500;
        }
        .user-center-btn {
            width: 100%;
            padding: 11px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 8px;
            transition: opacity 0.2s;
        }
        .user-center-btn:active { opacity: 0.85; }
        .user-center-btn.primary {
            background: linear-gradient(135deg, #0088ff, #0066cc);
            color: #fff;
        }
        .user-center-btn.warning {
            background: #ff6b00;
            color: #fff;
        }
        .user-center-btn.danger {
            background: #fff;
            color: #ff4d4f;
            border: 1px solid #ff4d4f;
        }

        /* 地址管理 */
        .addr-card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 8px;
            position: relative;
        }
        .addr-card.default {
            border: 1px solid #0088ff;
            background: #f0f7ff;
        }
        .addr-card .addr-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
        }
        .addr-card .addr-name {
            font-weight: bold;
            font-size: 14px;
            color: #333;
        }
        .addr-card .addr-phone {
            color: #666;
            font-size: 13px;
        }
        .addr-card .addr-detail {
            font-size: 13px;
            color: #555;
            line-height: 1.5;
            margin-bottom: 6px;
        }
        .addr-card .default-badge {
            display: inline-block;
            background: #0088ff;
            color: #fff;
            font-size: 11px;
            padding: 1px 8px;
            border-radius: 10px;
            margin-bottom: 6px;
        }
        .addr-card .addr-actions {
            display: flex;
            gap: 8px;
        }
        .addr-card .addr-action-btn {
            font-size: 12px;
            padding: 3px 10px;
            border-radius: 12px;
            cursor: pointer;
            border: 1px solid #ddd;
            background: #fff;
            color: #333;
        }
        .addr-card .addr-action-btn.danger {
            color: #ff4d4f;
            border-color: #ff4d4f;
        }
        .addr-card .addr-action-btn.primary {
            color: #0088ff;
            border-color: #0088ff;
        }
        .addr-empty {
            text-align: center;
            color: #999;
            padding: 20px 0;
            font-size: 13px;
        }
        .add-addr-btn {
            width: 100%;
            padding: 10px;
            border: 1px dashed #0088ff;
            border-radius: 8px;
            background: #fff;
            color: #0088ff;
            font-size: 14px;
            cursor: pointer;
            margin-top: 8px;
        }
        .add-addr-btn:active { background: #f0f7ff; }
        .addr-form {
            background: #fff;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 8px;
        }
        .addr-form .addr-form-actions {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }
        .addr-form .addr-form-btn {
            flex: 1;
            padding: 8px;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            font-weight: bold;
            cursor: pointer;
        }
        .addr-form .addr-form-btn.save {
            background: #0088ff;
            color: #fff;
        }
        .addr-form .addr-form-btn.cancel {
            background: #f0f0f0;
            color: #666;
        }
        .addr-loading {
            text-align: center;
            color: #999;
            padding: 20px 0;
            font-size: 13px;
        }

        /* 登录方式切换 Tab */
        .login-tabs {
            display: flex;
            margin-bottom: 16px;
            background: #f5f5f5;
            border-radius: 8px;
            padding: 3px;
        }
        .login-tab {
            flex: 1;
            text-align: center;
            padding: 8px;
            border-radius: 6px;
            font-size: 13px;
            cursor: pointer;
            color: #666;
            transition: all 0.2s;
        }
        .login-tab.active {
            background: #fff;
            color: #0088ff;
            font-weight: bold;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        /* 地址卡片 */
        .addr-card {
            border: 1px solid #eee;
            border-radius: 8px;
            padding: 10px;
            margin-bottom: 8px;
            position: relative;
            font-size: 13px;
        }
        .addr-card.default {
            border-color: #0088ff;
            background: #f0f7ff;
        }
        .addr-default-tag {
            color: #0088ff;
            font-size: 11px;
            margin-left: 6px;
        }
        .addr-actions {
            margin-top: 6px;
            display: flex;
            gap: 8px;
        }
        .addr-action-btn {
            padding: 3px 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 11px;
            cursor: pointer;
            background: #fff;
        }
        .add-addr-btn {
            display: block;
            width: 100%;
            padding: 8px;
            border: 1px dashed #0088ff;
            border-radius: 8px;
            color: #0088ff;
            background: #f0f7ff;
            cursor: pointer;
            font-size: 13px;
            margin-bottom: 8px;
        }

        /* ===== 底部 Tab 栏 ===== */
        .bottom-tabbar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 56px;
            background: #fff;
            border-top: 1px solid #e8e8e8;
            display: flex;
            z-index: 900;
            box-shadow: 0 -2px 8px rgba(0,0,0,0.07);
        }
        .tab-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #999;
            font-size: 10px;
            gap: 2px;
            transition: color 0.2s;
            -webkit-tap-highlight-color: transparent;
        }
        .tab-item.active {
            color: #0088ff;
        }
        .tab-item svg {
            width: 22px;
            height: 22px;
        }
        .tab-item .tab-badge {
            position: absolute;
            top: 4px;
            right: calc(50% - 18px);
            background: #ff4d4f;
            color: #fff;
            font-size: 10px;
            min-width: 16px;
            height: 16px;
            line-height: 16px;
            padding: 0 4px;
            border-radius: 8px;
            text-align: center;
            display: none;
        }
        .tab-item {
            position: relative;
        }

        /* ===== 主页主分页控件（固定在最顶部） ===== */
        .main-page-tabs {
            display: flex;
            background: #fff;
            border-radius: 0;
            overflow: hidden;
            border-bottom: 2px solid #e8e8e8;
        }
        .main-page-tab {
            flex: 1;
            text-align: center;
            padding: 10px 0;
            font-size: 15px;
            font-weight: 500;
            color: #555;
            cursor: pointer;
            position: relative;
            transition: color 0.2s, background 0.2s;
            -webkit-tap-highlight-color: transparent;
            background: #f7f8fa;
        }
        .main-page-tab.active {
            color: #0088ff;
            font-weight: bold;
            background: #fff;
        }
        .main-page-tab.active::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 20%;
            width: 60%;
            height: 3px;
            background: #0088ff;
            border-radius: 2px 2px 0 0;
        }
        #goodsHeaderTopBar, #goodsHeaderControls {
            /* 商品店铺的头部控件区域，广告Tab时隐藏 */
        }
        .main-page-panel {
            display: none;
        }
        .main-page-panel.active {
            display: block;
        }
        /* 商家面板：fixed 全屏定位（和消息面板一样） */
        #mainPanel-merchant.active {
            display: flex !important;
            flex-direction: column;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            overflow: hidden;
            background: #f5f5f5;
            z-index: 5;
        }

        /* ===== 广告区样式 ===== */
        .ad-category-tabs {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }
        .ad-cat-btn {
            padding: 6px 16px;
            border: 1px solid #e0e0e0;
            border-radius: 20px;
            font-size: 13px;
            background: #fff;
            color: #555;
            cursor: pointer;
            transition: all 0.2s;
            -webkit-tap-highlight-color: transparent;
        }
        .ad-cat-btn.active {
            background: #0088ff;
            color: #fff;
            border-color: #0088ff;
        }
        .ad-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .ad-card {
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06);
            overflow: hidden;
            display: flex;
            gap: 0;
        }
        .ad-card-img {
            width: 110px;
            min-width: 110px;
            height: 90px;
            object-fit: cover;
            background: #f0f0f0;
            flex-shrink: 0;
        }
        .ad-card-body {
            flex: 1;
            padding: 10px 12px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            min-width: 0;
        }
        .ad-card-title {
            font-size: 14px;
            font-weight: 600;
            color: #222;
            margin-bottom: 4px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .ad-card-desc {
            font-size: 12px;
            color: #888;
            margin-bottom: 6px;
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
        .ad-card-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .ad-card-price {
            font-size: 15px;
            font-weight: bold;
            color: #f30;
        }
        .ad-card-price.free {
            color: #28a745;
        }
        .ad-card-price.negotiable {
            color: #ff6b00;
        }
        .ad-card-tag {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 500;
        }
        .ad-card-tag.rent { background: #e8f4ff; color: #0088ff; }
        .ad-card-tag.sale { background: #fff3e0; color: #ff6b00; }
        .ad-card-tag.used { background: #f3e8ff; color: #8c54f0; }
        .ad-card-tag.job  { background: #e8fff0; color: #28a745; }
        .ad-location {
            font-size: 11px;
            color: #bbb;
        }
        .ad-empty {
            text-align: center;
            padding: 40px 0;
            color: #ccc;
            font-size: 14px;
        }
        .ad-publish-btn {
            width: 100%;
            margin-top: 16px;
            padding: 12px;
            border: 1px dashed #0088ff;
            border-radius: 10px;
            background: #f0f7ff;
            color: #0088ff;
            font-size: 14px;
            cursor: pointer;
            text-align: center;
        }
        .ad-publish-btn:active { opacity: 0.8; }

        @media (min-width: 768px) {
            .modal-content { padding: 24px; }
        }
        @media (min-width: 1200px) {
            .goods-container { grid-template-columns: repeat(6, 1fr); }
            .goods-img { max-height: 180px; }
            body { padding: 20px; padding-top: 0; padding-bottom: calc(56px + 20px); }
        }

        /* ===== 购物车样式 ===== */
        /* 购物车面板：fixed 全屏 + 底部 56px 给 tabbar */
        #mainPanel-cart {
            display: none;
            background: #f5f5f5;
        }
        #mainPanel-cart.active {
            display: flex !important;
            flex-direction: column;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 56px;
            z-index: 5;
            overflow: hidden;
        }
        /* 顶部 toolbar：固定高度不压缩 */
        .cart-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            margin: 0;
            padding: 10px 12px;
            background: #fff;
            border-bottom: 1px solid #eee;
            flex-shrink: 0;
            flex-wrap: nowrap;
            min-height: 50px;
            box-sizing: border-box;
        }
        .check-all-btn {
            padding: 6px 14px;
            background: #f0f0f0;
            border: 1px solid #ddd;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .total-price {
            font-size: 15px;
            font-weight: bold;
            color: #e63946;
            flex: 1;
            text-align: right;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .pay-btn {
            padding: 8px 20px;
            background: #e63946;
            color: #fff;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            cursor: pointer;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .pay-btn:disabled { background: #ccc; cursor: not-allowed; }

        /* 购物车列表容器：flex:1 + min-height:0 才能正确响应滚动 */
        #homeCartList {
            display: block;
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            background: #f5f5f5;
            padding: 8px 8px 0 8px;
            box-sizing: border-box;
        }
        #homeCartList .empty-text {
            text-align: center;
            color: #999;
            padding: 60px 20px;
            font-size: 14px;
        }

        /* 店铺分组 */
        .shop-group {
            background: #fff;
            border-radius: 10px;
            margin-bottom: 8px;
            overflow: hidden;
        }
        .shop-header {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 12px;
            background: #f8f9fa;
            border-bottom: 1px solid #eee;
        }
        .shop-check { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
        .shop-name-title { font-size: 14px; font-weight: 600; color: #333; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

        /* 单个购物车行：3 列横排（左侧 上下结构 + 右侧 6 层 + 最右价格） */
        .cart-item {
            display: flex;
            align-items: stretch;
            gap: 10px;
            padding: 12px;
            border-bottom: 1px solid #f0f0f0;
            box-sizing: border-box;
        }
        .cart-item:last-child { border-bottom: none; }

        /* 左侧：上图片 + 下 checkbox+小计（2 层结构） */
        .cart-col1 {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            gap: 6px;
            flex-shrink: 0;
            width: 80px;
        }
        .cart-col1-bottom {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            width: 100%;
        }
        .cart-check {
            width: 18px;
            height: 18px;
            cursor: pointer;
            flex-shrink: 0;
        }
        .cart-img-wrap {
            width: 70px;
            height: 70px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f8f8f8;
            border-radius: 6px;
            overflow: hidden;
        }
        .cart-img {
            max-width: 100%;
            max-height: 100%;
            width: auto;
            height: auto;
            object-fit: contain;
            display: block;
        }
        .cart-img-fallback {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ccc;
            font-size: 12px;
            background: #f5f5f5;
        }

        /* 中间：6 层垂直堆叠 */
        .cart-col2 {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .cart-row { display: flex; align-items: center; min-height: 22px; gap: 6px; flex-wrap: nowrap; }
        .cart-row-name { padding-bottom: 2px; }
        .cart-goods-name {
            font-weight: 600;
            font-size: 13px;
            line-height: 1.3;
            color: #222;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
            min-width: 0;
        }
        .cart-spec-tag {
            font-size: 11px;
            color: #666;
            background: #f3f4f6;
            padding: 2px 6px;
            border-radius: 3px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }
        .cart-original-price {
            font-size: 11px;
            color: #999;
            text-decoration: line-through;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .cart-promo-tag {
            font-size: 11px;
            color: #e63946;
            background: #fff3e0;
            padding: 2px 6px;
            border-radius: 3px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
            flex: 1;
        }
        .cart-stock-tag {
            font-size: 11px;
            color: #16a34a;
            background: #f0fff4;
            padding: 2px 6px;
            border-radius: 3px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .cart-quantity-input {
            width: 60px;
            height: 24px;
            text-align: center;
            border: 1px solid #ddd;
            border-radius: 4px;
            outline: none;
            font-size: 13px;
            padding: 0;
            box-sizing: border-box;
            flex-shrink: 0;
        }
        .cart-limit-tag {
            font-size: 11px;
            color: #2563eb;
            background: #eff6ff;
            padding: 2px 6px;
            border-radius: 3px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
            min-width: 0;
        }
        .cart-del-btn {
            padding: 3px 10px;
            background: #ef4444;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 11px;
            cursor: pointer;
            transition: 0.2s;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .cart-del-btn:active { opacity: 0.7; }
        .cart-row-remark { margin-top: 2px; }
        .cart-remark-input {
            width: 100%;
            height: 26px;
            padding: 0 8px;
            border: 1px solid #e0e0e0;
            border-radius: 4px;
            outline: none;
            font-size: 12px;
            box-sizing: border-box;
            background: #fafafa;
        }
        .cart-remark-input:focus { border-color: #0088ff; background: #fff; }

        /* 小计：现在放在左下，跟 checkbox 同一行 */
        .cart-subtotal {
            color: #ff4500;
            font-weight: bold;
            font-size: 13px;
            white-space: nowrap;
            flex: 1;
            text-align: right;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        @media (max-width: 768px) {
            .cart-toolbar { padding: 8px 10px; gap: 6px; }
            .check-all-btn { padding: 6px 10px; font-size: 12px; }
            .total-price { font-size: 14px; }
            .pay-btn { padding: 6px 14px; font-size: 13px; }
            .cart-item { padding: 10px 8px; gap: 8px; }
            .cart-col1 { width: 72px; }
            .cart-img-wrap { width: 60px; height: 60px; }
            .cart-subtotal { font-size: 12px; }
            .cart-quantity-input { width: 54px; height: 22px; }
            .cart-goods-name { font-size: 12px; }
            .cart-promo-tag, .cart-limit-tag { max-width: 100%; }
        }
        /* ===== 购物车样式结束 ===== */

        /* ===== 商家面板（含子导航） ===== */
        #mainPanel-merchant {
            display: none;
            background: #f5f5f5;
        }
        /* 商家子Tab导航栏 */
        .merchant-subtabs {
            display: flex;
            gap: 4px;
            padding: 10px 12px;
            background: #fff;
            border-bottom: 1px solid #eee;
            flex-shrink: 0;
        }
        .merchant-subtab {
            flex: 1;
            padding: 8px 0;
            text-align: center;
            font-size: 13px;
            font-weight: 500;
            color: #666;
            background: #f0f0f0;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
        }
        .merchant-subtab.active {
            background: #0088ff;
            color: #fff;
            font-weight: 600;
        }
        .merchant-subtab .subtab-dot {
            position: absolute;
            top: 4px;
            right: 8px;
            width: 8px;
            height: 8px;
            background: #ff4d4f;
            border-radius: 50%;
            display: none;
        }
        .merchant-subtab .subtab-dot.show {
            display: block;
        }
        /* 商家子面板公共 */
        .merchant-subpanel {
            display: none;
            padding: 12px;
        }
        .merchant-subpanel.active {
            display: flex;
            flex-direction: column;
            flex: 1;
            min-height: 0;
            overflow: hidden;
            padding-bottom: 56px;
            box-sizing: border-box;
        }

        /* ===== 登录子面板 ===== */
        .mch-login-card {
            background: #fff;
            border-radius: 12px;
            padding: 24px 20px;
            margin-bottom: 12px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        .mch-login-card .shop-icon {
            font-size: 48px;
            text-align: center;
            margin-bottom: 8px;
        }
        .mch-login-card .desc {
            text-align: center;
            font-size: 14px;
            color: #666;
            margin-bottom: 20px;
        }
        .mch-login-tabs {
            display: flex;
            gap: 0;
            margin-bottom: 16px;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid #ddd;
        }
        .mch-login-tab-btn {
            flex: 1;
            padding: 10px;
            text-align: center;
            font-size: 13px;
            background: #f8f8f8;
            color: #888;
            border: none;
            cursor: pointer;
        }
        .mch-login-tab-btn.active {
            background: #0088ff;
            color: #fff;
        }
        .mch-form-group {
            margin-bottom: 14px;
            text-align: left;
        }
        .mch-form-group label {
            display: block;
            font-size: 13px;
            color: #555;
            margin-bottom: 6px;
            font-weight: 500;
        }
        .mch-form-group input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            outline: none;
            box-sizing: border-box;
        }
        .mch-form-group input:focus {
            border-color: #0088ff;
        }
        .mch-form-row {
            display: flex;
            gap: 10px;
        }
        .mch-form-row input {
            flex: 1;
        }
        .mch-sms-btn {
            padding: 10px 16px;
            background: #0088ff;
            color: #fff;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            cursor: pointer;
            white-space: nowrap;
        }
        .mch-sms-btn:disabled {
            background: #ccc;
        }
        .mch-login-btn {
            width: 100%;
            padding: 12px;
            background: #ff6b00;
            color: #fff;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            margin-top: 6px;
        }
        .mch-login-btn:disabled {
            background: #ccc;
        }
        /* ===== 已登录信息卡片 ===== */
        .mch-info-card {
            background: #fff;
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 12px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        .mch-info-row {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
        }
        .mch-avatar {
            width: 48px;
            height: 48px;
            background: linear-gradient(135deg, #0088ff, #00c6ff);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 20px;
            font-weight: 700;
        }
        .mch-info-text .mch-name {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        .mch-info-text .mch-code {
            font-size: 12px;
            color: #999;
        }
        .mch-info-text .mch-phone {
            font-size: 12px;
            color: #999;
        }
        .mch-stat-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 14px;
        }
        .mch-stat-item {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 14px;
            text-align: center;
        }
        .mch-stat-item .val {
            font-size: 24px;
            font-weight: 700;
            color: #0088ff;
        }
        .mch-stat-item .lbl {
            font-size: 12px;
            color: #888;
            margin-top: 4px;
        }
        .mch-logout-btn {
            width: 100%;
            padding: 10px;
            background: #fff;
            color: #ff4d4f;
            border: 1px solid #ff4d4f;
            border-radius: 8px;
            font-size: 14px;
            cursor: pointer;
        }
        .mch-setpw-link {
            display: block;
            text-align: center;
            font-size: 13px;
            color: #0088ff;
            margin-bottom: 12px;
            cursor: pointer;
            text-decoration: underline;
        }
        /* ===== 消息子面板 ===== */
        .mch-msg-item {
            background: #fff;
            border-radius: 10px;
            padding: 14px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
        }
        .mch-msg-item:active {
            background: #f0f7ff;
        }
        .mch-msg-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: #e8f4ff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            flex-shrink: 0;
            color: #0088ff;
        }
        .mch-msg-body {
            flex: 1;
            min-width: 0;
        }
        .mch-msg-body .name {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
        }
        .mch-msg-body .preview {
            font-size: 12px;
            color: #999;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .mch-msg-left .mch-msg-right {
            text-align: right;
            flex-shrink: 0;
        }
        .mch-msg-right .time {
            font-size: 11px;
            color: #bbb;
        }
        .mch-msg-unread {
            display: inline-block;
            background: #ff4d4f;
            color: #fff;
            font-size: 11px;
            padding: 2px 7px;
            border-radius: 10px;
            margin-top: 4px;
            min-width: 18px;
            text-align: center;
        }
        .mch-empty {
            text-align: center;
            padding: 60px 20px;
            color: #999;
            font-size: 14px;
        }
        .mch-empty .icon {
            font-size: 48px;
            margin-bottom: 12px;
        }
        /* 商家消息分栏布局 */
        .mch-msg-layout {
            display: flex;
            height: 100%;
            background: #fff;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        .mch-msg-left {
            width: 280px;
            border-right: 1px solid #e8e8e8;
            display: flex;
            flex-direction: column;
            background: #f8f9fa;
            flex-shrink: 0;
            overflow-y: auto;
        }
        .mch-msg-list-header {
            padding: 14px 16px;
            font-size: 15px;
            font-weight: 600;
            color: #333;
            border-bottom: 1px solid #e8e8e8;
            background: #fff;
            flex-shrink: 0;
        }
        .mch-msg-left > #mchMsgList {
            flex: 1;
            overflow-y: auto;
        }
        .mch-msg-right {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #f5f5f5;
            overflow: hidden;
            min-height: 0;
        }
        .mch-msg-item.active {
            background: #e6f7ff;
            border-left: 3px solid #0088ff;
        }
        /* 商家消息移动端适配 */
        @media (max-width: 768px) {
            .mch-msg-left {
                width: 100%;
            }
            .mch-msg-right {
                display: none;
            }
            .mch-msg-layout.mch-chat-open .mch-msg-left {
                display: none;
            }
            .mch-msg-layout.mch-chat-open .mch-msg-right {
                display: flex;
            }
            .msg-chat-back {
                display: block;
            }
            .mch-msg-layout {
                height: 100%;
            }
        }
        /* ===== 商品子面板 ===== */
        .mch-product-item {
            background: #fff;
            border-radius: 10px;
            padding: 12px;
            margin-bottom: 8px;
            display: flex;
            gap: 12px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
        }
        .mch-product-img {
            width: 80px;
            height: 80px;
            border-radius: 8px;
            background: #f5f5f5;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 32px;
            flex-shrink: 0;
            overflow: hidden;
        }
        .mch-product-img img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .mch-product-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        .mch-product-info .pname {
            font-size: 14px;
            font-weight: 600;
            color: #333;
        }
        .mch-product-info .pprice {
            font-size: 18px;
            font-weight: 700;
            color: #ff4d4f;
        }
        .mch-product-info .pmeta {
            font-size: 12px;
            color: #999;
        }
        .mch-product-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 4px 10px;
        }
        .mch-product-header .title {
            font-size: 15px;
            font-weight: 600;
            color: #333;
        }
        .mch-product-header .count {
            font-size: 13px;
            color: #888;
        }
        /* ===== 订单子面板 ===== */
        .mch-order-placeholder {
            text-align: center;
            padding: 60px 20px;
        }
        .mch-order-placeholder .icon {
            font-size: 48px;
            margin-bottom: 12px;
            color: #ccc;
        }
        .mch-order-placeholder .title {
            font-size: 16px;
            color: #666;
            margin-bottom: 8px;
        }
        .mch-order-placeholder .sub {
            font-size: 13px;
            color: #999;
            margin-bottom: 20px;
        }
        .mch-order-preview {
            background: #fff;
            border-radius: 10px;
            padding: 16px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        .mch-order-preview h4 {
            font-size: 14px;
            color: #0088ff;
            margin-bottom: 10px;
        }
        .mch-order-stat-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }
        .mch-order-stat-row .os-item {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 10px;
            text-align: center;
        }
        .mch-order-stat-row .os-item .num {
            font-size: 20px;
            font-weight: 700;
            color: #333;
        }
        .mch-order-stat-row .os-item .lbl {
            font-size: 11px;
            color: #888;
        }

        /* ===== 消息面板 - 买家消息中心 ===== */
        #mainPanel-msg {
            display: none;
            background: #f5f5f5;
            min-height: 100vh;
        }
        #mainPanel-msg.active {
            display: flex !important;
            flex-direction: column;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            overflow: hidden;
            background: #f5f5f5;
            z-index: 5;
            will-change: transform;
            -webkit-overflow-scrolling: touch;
        }

        /* 消息中心容器：填满面板高度，底部留 56px 给 tabbar */
        .msg-center {
            flex: 1;
            min-height: 0;
            display: flex;
            background: #fff;
            margin: 0;
            padding-bottom: 56px;
            box-sizing: border-box;
        }

        /* 左侧：会话列表 */
        .msg-session-list {
            width: 320px;
            border-right: 1px solid #e8e8e8;
            display: flex;
            flex-direction: column;
            background: #f8f9fa;
        }
        .msg-session-header {
            padding: 16px;
            font-size: 18px;
            font-weight: 600;
            color: #333;
            border-bottom: 1px solid #e8e8e8;
            background: #fff;
        }
        .msg-session-items {
            flex: 1;
            overflow-y: auto;
        }
        .msg-session-item {
            padding: 14px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            border-bottom: 1px solid #f0f0f0;
            transition: background 0.2s;
            position: relative;
        }
        .msg-session-item:hover {
            background: #f0f7ff;
        }
        .msg-session-item.active {
            background: #e6f7ff;
        }
        .msg-session-item.unread {
            background: #fff1f0;
        }
        .msg-session-item.unread.active {
            background: #fff7e6;
        }
        .msg-session-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: #e8f4ff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            flex-shrink: 0;
            color: #0088ff;
            overflow: hidden;
        }
        .msg-session-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .msg-session-body {
            flex: 1;
            min-width: 0;
        }
        .msg-session-body .title {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
        }
        .msg-session-body .preview {
            font-size: 12px;
            color: #999;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .msg-session-right {
            text-align: right;
            flex-shrink: 0;
        }
        .msg-session-right .time {
            font-size: 11px;
            color: #bbb;
        }
        .msg-session-right .unread-badge {
            display: inline-block;
            background: #ff4d4f;
            color: #fff;
            font-size: 11px;
            padding: 2px 7px;
            border-radius: 10px;
            margin-top: 4px;
            min-width: 18px;
            text-align: center;
        }
        .msg-session-unread-dot {
            position: absolute;
            left: 8px;
            top: 50%;
            transform: translateY(-50%);
            width: 8px;
            height: 8px;
            background: #ff4d4f;
            border-radius: 50%;
        }

        /* 右侧：聊天区域 */
        .msg-chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #f5f5f5;
            overflow: hidden;
        }
        .msg-chat-placeholder {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: #999;
            font-size: 14px;
        }
        .msg-chat-placeholder .icon {
            font-size: 48px;
            margin-bottom: 12px;
        }
        .msg-chat-header {
            padding: 14px 16px;
            background: #fff;
            border-bottom: 1px solid #e8e8e8;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .msg-chat-back {
            display: none;
            background: none;
            border: none;
            font-size: 18px;
            cursor: pointer;
            color: #666;
            padding: 4px;
        }
        .msg-chat-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        .msg-chat-messages {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            padding: 16px;
            display: flex;
            flex-direction: column;
            will-change: scroll-position;
            -webkit-overflow-scrolling: touch;
            gap: 12px;
        }

        /* 聊天消息样式 */
        .msg-chat-bubble {
            max-width: 70%;
            padding: 10px 14px;
            border-radius: 12px;
            font-size: 14px;
            line-height: 1.5;
            word-break: break-word;
        }
        .msg-chat-bubble.sent {
            align-self: flex-end;
            background: #0088ff;
            color: #fff;
            border-bottom-right-radius: 4px;
        }
        .msg-chat-bubble.received {
            align-self: flex-start;
            background: #fff;
            color: #333;
            border-bottom-left-radius: 4px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.06);
        }
        .msg-chat-bubble img {
            max-width: 200px;
            border-radius: 8px;
            cursor: pointer;
        }
        .msg-chat-bubble video {
            max-width: 200px;
            border-radius: 8px;
        }
        .msg-chat-time {
            font-size: 11px;
            color: #bbb;
            text-align: center;
            margin: 8px 0;
        }

        /* 聊天消息行（含头像）—— 买家消息面板 + 商家消息面板共用 */
        #msgChatMessages, #mchChatMessages {
            display: flex;
            flex-direction: column;
            gap: 10px;
            min-height: 0;
            flex: 1;
            overflow-y: auto;
        }
        .msg-row {
            display: flex;
            align-items: flex-end;
            gap: 8px;
            max-width: 85%;
        }
        .msg-row.sent {
            align-self: flex-end;
            flex-direction: row-reverse;
        }
        .msg-row.received {
            align-self: flex-start;
        }
        .msg-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: #e0e0e0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            flex-shrink: 0;
            overflow: hidden;
        }
        .msg-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .msg-row .msg-chat-bubble {
            align-self: unset;
            max-width: 100%;
        }

        /* 聊天输入区 */
        .msg-chat-input-area {
            position: relative;
            padding: 12px;
            background: #fff;
            border-top: 1px solid #e8e8e8;
            flex-shrink: 0;
        }
        .msg-chat-toolbar {
            display: flex;
            gap: 12px;
            margin-bottom: 8px;
        }
        .msg-chat-upload-btn {
            cursor: pointer;
            font-size: 13px;
            color: #666;
            padding: 4px 8px;
            border-radius: 4px;
            transition: background 0.2s;
        }
        .msg-chat-upload-btn:hover {
            background: #f0f0f0;
        }
        .msg-chat-input-row {
            display: flex;
            gap: 6px;
            align-items: flex-end;
        }
        .msg-chat-input {
            flex: 1;
            width: 100%; /* 确保在 flex wrapper 中撑满 */
            padding: 10px 14px;
            border: 1px solid #e8e8e8;
            border-radius: 20px;
            font-size: 14px;
            outline: none;
            resize: none;
            min-height: 40px;
            max-height: 100px;
            font-family: inherit;
            box-sizing: border-box;
        }
        .msg-chat-input:focus {
            border-color: #0088ff;
        }
        .msg-chat-input-wrapper {
            flex: 1; min-width: 0; position: relative;
            display: flex;
        }
        .msg-chat-send {
            padding: 6px 12px;
            background: #0088ff;
            color: #fff;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            font-size: 13px;
            flex-shrink: 0;
            white-space: nowrap;
        }
        .msg-chat-send:disabled {
            background: #ccc;
            cursor: not-allowed;
        }
        /* 移动端适配 */
        @media (max-width: 768px) {
            .msg-session-list {
                width: 100%;
            }
            .msg-chat-area {
                display: none;
            }
            .msg-center.chat-open .msg-session-list {
                display: none;
            }
            .msg-center.chat-open .msg-chat-area {
                display: flex;
            }
            .msg-chat-back {
                display: block;
            }
        }
    
/* 表情面板 */
.emoji-panel{position:absolute;bottom:100%;left:0;margin-bottom:6px;background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,0.12);padding:10px;z-index:9999;width:320px;max-height:240px;overflow-y:auto;display:none;grid-template-columns:repeat(8,1fr);gap:4px;}
.emoji-panel.show{display:grid;}
.emoji-panel span{font-size:1.5rem;cursor:pointer;text-align:center;padding:4px;border-radius:6px;transition:background .15s;user-select:none;}
.emoji-panel span:hover{background:#f1f5f9;transform:scale(1.2);}
.emoji-btn{background:none;border:1px solid #e2e8f0;border-radius:8px;cursor:pointer;font-size:1.2rem;padding:4px 8px;transition:all .15s;}
.emoji-btn:hover{background:#f0f9ff;border-color:#93c5fd;}

/* ===== 付款弹窗样式 ===== */
.pay-popup-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;}
.pay-popup-box{position:relative;background:#fff;border-radius:16px;padding:24px;width:90%;max-width:400px;max-height:80vh;overflow-y:auto;box-shadow:0 8px 32px rgba(0,0,0,0.2);}
.pay-popup-title{font-size:18px;font-weight:700;text-align:center;margin-bottom:8px;color:#333;}
.pay-popup-count{text-align:center;color:#888;font-size:13px;margin-bottom:12px;}
.pay-popup-list{margin-bottom:16px;max-height:150px;overflow-y:auto;}
.pay-order-item{padding:6px 10px;margin:4px 0;background:#f8f9fa;border-radius:8px;font-size:12px;color:#555;word-break:break-all;}
.pay-popup-btns{display:flex;gap:12px;}