/* Styling using Tailwind-like classes for a clean, responsive design */
        body {
            font-family: Arial, "Helvetica Neue", "SimHei", "PingFang SC", "Microsoft YaHei", sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f4f7f6;
            color: #333;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .container {
            width: 100%;
            max-width: 1200px;
            background-color: #fff;
            padding: 14px 8px 18px 8px;
            border-radius: 10px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 10px;
            font-size: 1.08em;
            font-weight: 700;
            letter-spacing: 0.5px;
        }
        /* Controls: compact grid layout */
        .controls {
            display: flex;
            flex-wrap: wrap;
            gap: 6px 12px;
            margin-bottom: 8px;
            align-items: flex-start;
            justify-content: flex-start;
        }
        @media (max-width: 900px) {
            .controls { grid-template-columns: 1fr 1fr; }
        }
        @media (max-width: 560px) {
            .controls { grid-template-columns: 1fr; }
        }
        .control-group {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: unset;
            margin: 0;
           
        }
        .parameter-section-wrapper {
            flex: 1 1 48%;
            min-width: 400px;
        }
        .control-group label {
            font-size: 0.85em;
            color: #556677;
            font-weight: 600;
        }
        .control-group input[type="file"],
        .control-group input[type="text"],
        .control-group input[type="number"],
        .control-group select {
            padding: 6px 8px;
            border: 1px solid #e1e7eb;
            border-radius: 7px;
            font-size: 0.92em;
            transition: border-color 0.18s ease, box-shadow 0.18s ease;
            box-sizing: border-box;
            background: linear-gradient(180deg,#ffffff, #fbfdff);
        }
        #searchInput {
            width: 260px;
            min-width: 180px;
            max-width: 340px;
        }
        #sizeFilterInput, #patternFilterInput, #positionFilterInput, #applicationFilterInput, #brandCodeInput, #categoryFilterInput, #brandNameInput {
            width: 100px;
            min-width: 70px;
            max-width: 130px;
            font-size: 0.82em;
        }
        #countryInput, #certificateSelect {
            width: 100px;
            font-size: 0.82em;
        }
        #sizeFilterInput::placeholder,
        #patternFilterInput::placeholder,
        #positionFilterInput::placeholder,
        #applicationFilterInput::placeholder,
        #brandCodeInput::placeholder,
        #categoryFilterInput::placeholder,
        #brandNameInput::placeholder,
        #countryInput::placeholder {
            color: #aaa;
            font-weight: 300;
        }
        .control-group input:focus,
        .control-group select:focus {
            border-color: #2b7aa2;
            outline: none;
            box-shadow: 0 6px 18px rgba(43,122,162,0.08);
        }
        .default-value-text {
            color: #a0a0a0; /* Very light grey */
        }
        
        .control-group select {
            background-color: #fff;
            cursor: pointer;
        }
        
        .control-group select option {
            padding: 8px;
        }
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 8px;
            padding-bottom: 5px;
        }
        .checkbox-group input {
            width: auto;
            margin: 0;
        }
        .status-bar {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 0.92em;
            color: #666;
            padding: 4px 0 2px 0;
            border-bottom: 1px solid #eee;
        }
        .status-bar span {
            font-weight: 500;
        }
        .client-type-toggle {
            display: flex;
            gap: 15px;
            align-items: center;
            font-size: 0.92em;
            color: #666;
        }
        .client-type-toggle label {
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .client-type-toggle input[type="radio"] {
            margin: 0;
            width: auto;
        }
    .export-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-top: 20px;
            justify-content: center;
        }
        .export-buttons button {
            padding: 12px 25px;
            border: none;
            border-radius: 8px;
            font-size: 1em;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.3s ease, transform 0.2s ease;
            color: #fff;
        }
        .export-buttons button:hover {
            transform: translateY(-2px);
        }
    /* Premium button styles */
    #exportXlsxBtn { background: linear-gradient(180deg,#36b37e,#279a62); }
    #exportXlsxBtn:hover { filter: brightness(0.95); }
    #exportPdfBtn { background: linear-gradient(180deg,#f6c84c,#d4a81a); color:#162c3a; }
    #exportPdfBtn:hover { filter: brightness(0.98); }
    #exportCodeBtn { background: linear-gradient(180deg,#4b8cff,#276fb3); }
    #exportCodeBtn:hover { filter: brightness(0.95); }
        #exportXlsxBtn:disabled, #exportPdfBtn:disabled, #exportCodeBtn:disabled {
            background-color: #cccccc;
            cursor: not-allowed;
            transform: none;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            background-color: #fff;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            border-radius: 12px;
            overflow: hidden; /* Ensures rounded corners on table */
        }
        th, td {
            border: 1px solid #e0e0e0;
            padding: 10px 6px; /* Reduced padding for a more compact look */
            text-align: center; /* Centered text for a cleaner look */
            font-size: 0.88em;
            vertical-align: middle;
            white-space: normal; /* Allow text to wrap */
        }
        td {
            /* Removed white-space: nowrap; */
        }
        th {
            background-color: #2c3e50; /* Dark blue-grey */
            color: white;
            font-weight: 700;
            position: sticky;
            top: 0;
            z-index: 10;
            text-transform: uppercase;
            font-size: 0.82em; /* Slightly reduced font size */
            letter-spacing: 0.5px;
            text-align: center;
        }
        tbody tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tbody tr:hover {
            background-color: #f1f1f1;
            transition: background-color 0.2s ease;
        }
        .selected-row {
            background-color: #C5E1FF !important;
            border-left: 6px solid #0066CC !important;
            border-right: 6px solid #0066CC !important;
            border-top: 4px solid #0066CC !important;
            border-bottom: 4px solid #0066CC !important;
            box-shadow: 0 0 0 3px #FFD700, 0 8px 20px rgba(0, 102, 204, 0.5) !important;
            font-weight: 700 !important;
            transform: scale(1.02);
            transition: all 0.2s ease;
            position: relative;
            z-index: 10;
        }

        .selected-row td:first-child {
            position: relative;
        }

        .selected-row td:first-child::before {
            content: "✓ ";
            font-size: 1.25em;
            font-weight: bold;
            color: #0066CC;
            margin-right: 5px;
        }
        .col-photo {
            width: 80px; /* 缩小图片列的宽度 */
            padding: 0px !important; /* 减少单元格内边距，使用 !important 提高优先级 */
        }
        .col-photo img {
            width: 70px; /* 设置图片统一宽度 */
            height: 70px; /* 设置图片统一高度 */
            object-fit: contain; /* 保持图片纵横比，避免裁剪或拉伸 */
            border-radius: 4px; /* 轻微的圆角 */
            display: block; /* 确保图片是块级元素，便于边距控制 */
            margin: 0 auto; /* 图片在单元格内水平居中 */
        }
        
        /* 公司表头样式 */
        .company-header {
            text-align: center;
            margin: 10px 0 6px 0;
            padding: 8px 2px 6px 2px;
            background: linear-gradient(135deg, #f8fbff 0%, #eef6fb 100%);
            border-radius: 7px;
            border: 1px solid #dee2e6;
            box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
        }
        
        .company-name {
            font-size: 1.12em;
            font-weight: 700;
            color: #2c3e50;
            margin: 0 0 4px 0;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
        }
        
        .company-subtitle {
            font-size: 0.95em;
            color: #6c757d;
            margin: 0 0 6px 0;
            font-weight: 400;
            line-height: 1.2;
        }
        
        .quotation-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 4px 6px;
            background: #ffffff;
            border-radius: 6px;
            border: 1px solid #e9ecef;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
            font-size: 0.95em;
        }
        
        .quotation-number, .quotation-date {
            font-size: 1em;
            font-weight: 600;
            color: #495057;
        }
        
        .quotation-number span, .quotation-date span {
            color: #007bff;
            font-weight: 700;
        }
        
        /* 底部联系信息和图片布局样式 */
        .footer-section {
            margin-top: 40px;
            padding: 30px;
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border-radius: 15px;
            border: 1px solid #dee2e6;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        }
        
        .contact-info {
            margin-bottom: 30px;
        }
        
        .contact-item {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            padding: 12px 16px;
            background: #ffffff;
            border-radius: 10px;
            border: 1px solid #e9ecef;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
        }
        
        .contact-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        
        .contact-icon {
            font-size: 1.2em;
            margin-right: 15px;
            min-width: 30px;
            text-align: center;
        }
        
        .contact-text {
            font-size: 0.95em;
            color: #495057;
            font-weight: 500;
            line-height: 1.4;
        }
        
        .images-section {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            gap: 20px;
        }
        
        .contact-images {
            display: flex;
            gap: 15px;
        }
        
        .contact-image {
            width: 120px;
            height: 120px;
            object-fit: cover;
            border-radius: 12px;
            border: 2px solid #ffffff;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            transition: all 0.3s ease;
        }
        
        .contact-image:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        }
        
        .seyoun-image {
            flex-shrink: 0;
        }
        
        .seyoun-img {
            width: 235px;
            height: 38px;
            object-fit: cover;
            border-radius: 15px;
            border: 3px solid #ffffff;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
            transition: all 0.3s ease;
        }
        
        .seyoun-img:hover {
            transform: scale(1.05);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
        }
        
        /* 新增卡片视图样式 */
    .product-card {
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px 12px;
        margin-bottom: 12px;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0,0,0,0.05);
        font-size: 0.9em;
    }
    .shopping-cart-container {
        margin-top: 20px;
        padding: 20px;
        border: 2px dashed #007bff;
        border-radius: 10px;
        background-color: #f8f9fa;
    }
    .shopping-cart-container h2 {
        text-align: center;
        color: #2c3e50;
        margin-top: 0;
        margin-bottom: 15px;
    }
    #cartItemsContainer {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    .cart-item {
        display: flex;
        flex-direction: column;
        padding: 10px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fff;
        font-size: 0.9em;
    }
    .cart-item-details {
        flex-grow: 1;
    }
    .cart-item-remove {
        margin-top: 10px;
        padding: 5px;
        background-color: #ff4d4d;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        text-align: center;
    }
    .product-card-header {
        display: flex;
        justify-content: space-between;
        /* font-weight moved to a more specific selector */
        margin-bottom: 6px;
    }
    .product-card-header span:first-child {
        font-weight: 600;
    }
    .product-title {
        color: #007bff;
        font-weight: normal;
    }
    .product-weight,
    .product-fob {
        color: #007bff;
    }
    .product-card-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 4px;
    }
    .product-card img {
        margin-top: 6px;
        max-width: 100%;
        border-radius: 6px;
    }

    /* ============================================================
       统一控件行 — 所有参数一行显示
       ============================================================ */
    .cart-controls-row {
        display: inline-flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 3px 7px;
        padding: 5px 12px;
        background: #f8fafc;
        border: 1px solid #c8d4e0;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }
    .ctrl-label {
        font-size: 0.78em;
        font-weight: 600;
        color: #556677;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ctrl-unit {
        font-size: 0.68em;
        color: #889aaa;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ctrl-check {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        cursor: pointer;
        font-size: 0.78em;
        font-weight: 600;
        color: #556677;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ctrl-check input[type="checkbox"] {
        margin: 0;
        accent-color: #007bff;
    }
    .ctrl-radio {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        cursor: pointer;
        font-size: 0.72em;
        font-weight: 500;
        color: #667788;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ctrl-radio input[type="radio"] {
        margin: 0;
        accent-color: #007bff;
    }
    .ctrl-input {
        padding: 3px 5px;
        border: 1px solid #d0d8e4;
        border-radius: 6px;
        font-size: 0.82em;
        text-align: right;
        box-sizing: border-box;
        background: #fff;
        color: #333;
        height: 26px;
        flex-shrink: 0;
    }
    .ctrl-input:focus {
        border-color: #2b7aa2;
        outline: none;
        box-shadow: 0 0 0 2px rgba(43,122,162,0.10);
    }
    .ctrl-input:disabled {
        background: #f0f1f3;
        color: #aaa;
        cursor: not-allowed;
    }
    .ctrl-w40 { width: 40px !important; min-width: 40px; }
    .ctrl-w48 { width: 48px !important; min-width: 48px; }
    .ctrl-w56 { width: 56px !important; min-width: 56px; }
    .ctrl-w72 { width: 72px !important; min-width: 72px; }
    .ctrl-select {
        padding: 3px 18px 3px 5px;
        border: 1px solid #d0d8e4;
        border-radius: 6px;
        font-size: 0.78em;
        background: #fff;
        color: #333;
        height: 26px;
        box-sizing: border-box;
        cursor: pointer;
        flex-shrink: 0;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23888'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 5px center;
    }
    .ctrl-select:focus {
        border-color: #2b7aa2;
        outline: none;
        box-shadow: 0 0 0 2px rgba(43,122,162,0.10);
    }
    .ctrl-divider {
        width: 1px;
        height: 28px;
        background: #d8dde5;
        flex-shrink: 0;
        align-self: center;
    }
    /* EXW 专用控件（内嵌于统一行） */
    .exw-control {
        display: none;
        align-items: center;
        gap: 3px;
    }
    .exw-control.visible {
        display: inline-flex;
    }
    .exw-badge {
        font-size: 0.7em;
        font-weight: 700;
        color: #cc3333;
        background: #fff5f5;
        border: 1px solid #f0c0c0;
        border-radius: 3px;
        padding: 1px 5px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .exw-input {
        width: 42px !important;
        padding: 3px 4px !important;
        border: 1px solid #d0d8e4 !important;
        border-radius: 6px !important;
        font-size: 0.82em !important;
        text-align: right !important;
        box-sizing: border-box !important;
        background: #fff !important;
        color: #333 !important;
        height: 26px !important;
        flex-shrink: 0;
    }
    .exw-input:focus {
        border-color: #cc3333 !important;
        outline: none !important;
        box-shadow: 0 0 0 2px rgba(204,51,51,0.10) !important;
    }
    .exw-label {
        font-size: 0.7em;
        color: #778899;
        font-weight: 500;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* --- 响应式视图切换逻辑 --- */
    /* 在大屏幕上 (>= 768px)，隐藏卡片视图 */
    @media (min-width: 768px) {
        #mobileCards { display: none; }
    }

   

    /* 在小屏幕上 (< 768px)，隐藏表格视图，并调整其他控件 */

    @media (max-width: 767px) {
        #resultTable {
            display: none;
        }
        .controls {
            flex-direction: column;
            align-items: stretch;
        }
        .control-group {
            min-width: unset;
        }
        .export-buttons {
            flex-direction: column;
        }
        .control-group label, .checkbox-group label {
            padding-left: 0;
            text-align: left;
        }
    }

/*  新增代码-关于二维码和seyoun.jpg 定位， */
@media (max-width: 767px) {
    #resultTable {
        display: none;
    }
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    .control-group {
        min-width: unset;
    }
    .export-buttons {
        flex-direction: column;
    }
    .control-group label, .checkbox-group label {
        padding-left: 0;
        text-align: left;
    }
    /* 之前添加的图片布局样式 */
    .images-section {
        flex-direction: column;
        align-items: center;
    }
    .contact-images {
        display: flex;
        gap: 15px;
        justify-content: center;
    }
    .seyoun-image {
        margin-top: 15px;
    }
    /* 新增：产品展示区域整体样式 */
    #mobileCards {
        font-size: 0.8em;
        background-color: #fafafa;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        padding: 5px;
        margin: 5px 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }
    /* 新增：单个产品卡片样式 */
    .product-card {
        background-color: #ffffff;
        border: 1px solid #e8ecef;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }
    /* 之前添加的价格突出样式（可选） 
    .product-fob {
        color: #d32f2f;
        font-weight: bold;
        font-size: 1.1em;
        background-color: #fff3e0;
        padding: 4px 8px;
        border-radius: 6px;
        display: inline-block;
    }

    */
    .product-card-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 8px;
        font-size: 0.95em;
    }
    .product-weight {
        color: #555;
    }
}

/* Share Modal Styles */
.share-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.share-modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 1.75em;
    font-weight: bold;
}

.share-modal-close:hover,
.share-modal-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.share-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.share-option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
}
.email-btn { background-color: #777; }
.whatsapp-btn { background-color: #25D366; }
.facebook-btn { background-color: #1877F2; }
.telegram-btn { background-color: #0088cc; }

.share-option-btn .icon {
    margin-right: 8px;
    font-size: 1.2em;
}

.share-manual-note {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
}

/* All Agents Modal Styles - Clean Business Design */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #f7f8fa; /* Lighter background for modal content */
    border: 1px solid #e2e8f0; /* Softer border */
    border-radius: 12px; /* Slightly more rounded corners */
    padding: 20px; /* Increased padding */
    width: 98%;
    max-width: 1400px;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1); /* Softer, larger shadow */
    overflow: hidden; /* Ensure content stays within rounded corners */
    display: flex; /* Use flex for internal layout */
    flex-direction: column;
}

.modal-header {
    background: #ffffff; /* White header background */
    padding: 15px 25px; /* Increased padding */
    border-bottom: 1px solid #e2e8f0; /* Lighter, subtle border */
    display: flex;
    justify-content: space-between; /* Space between title and close button */
    align-items: center;
    margin: -20px -20px 20px -20px; /* Adjust to align with modal-content padding */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.modal-title {
    color: #4a5568; /* Darker, professional text color */
    font-size: 1.2em; /* Slightly larger title */
    font-weight: 700; /* Bolder */
    margin: 0;
    text-align: left; /* Left-aligned title */
    letter-spacing: 0.5px;
}

.close {
    color: #718096; /* Softer close button color */
    font-size: 1.5em; /* Slightly larger icon */
    font-weight: bold;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Circular close button */
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: static; /* Remove absolute positioning */
}

.close:hover,
.close:focus {
    color: #2d3748; /* Darker on hover */
    background: #edf2f7; /* Light background on hover */
}

.table-container {
    padding: 0;
    position: relative;
    max-height: calc(90vh - 120px); /* Adjusted height */
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0; /* Lighter border */
    border-radius: 8px; /* Rounded corners for table container */
    background-color: #ffffff; /* White background for the table itself */
    flex-grow: 1; /* Allow table to take available space */
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #718096; /* Softer color for spinner text */
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(113, 128, 150, 0.3); /* Softer spinner border */
    border-top: 3px solid #4299e1; /* Blue spinner top */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.agents-table {
    width: 100%; /* Full width */
    border-collapse: collapse;
    color: #4a5568; /* Professional dark grey text */
    font-size: 0.875em; /* Slightly larger font */
    margin: 0; /* Remove auto margin */
}

.agents-table th {
    background: #f8f9fa; /* Light grey header background */
    padding: 12px 15px; /* Increased padding */
    text-align: left;
    font-weight: 700; /* Bolder */
    color: #4a5568; /* Dark text for header */
    border-bottom: 2px solid #e2e8f0; /* Clearer bottom border */
    position: sticky;
    top: 0;
    z-index: 100;
    white-space: nowrap;
    min-width: 80px;
    text-transform: uppercase; /* Uppercase for headers */
    letter-spacing: 0.5px;
}

.agents-table td {
    padding: 12px 15px; /* Increased padding for better spacing */
    border-bottom: 1px solid #e2e8f0; /* Subtle row separator */
    vertical-align: middle;
    color: #4a5568;
    min-width: 80px;
    transition: background-color 0.2s ease;
}

/* Remove zebra striping */
.agents-table tbody tr:nth-child(odd),
.agents-table tbody tr:nth-child(even) {
    background: transparent; /* No background color */
}

/* Modern hover effect: subtle background change */
.agents-table tbody tr:hover {
    background-color: #f8fafc; /* Very light grey on hover */
    cursor: pointer;
    transform: none; /* Remove lift effect */
    box-shadow: none; /* Remove shadow on hover */
}

/* Selected state: clear, high-contrast, and professional */
.agents-table tbody tr.selected {
    background-color: #eff6ff !important; /* Light blue background */
    font-weight: 600;
    transform: none; /* Remove lift effect */
    box-shadow: none; /* Remove shadow */
}

/* Remove visual indicator bar for selection */
.agents-table tbody tr.selected td:first-child {
    border-left: none;
}

.country-name {
    font-weight: 700; /* Bolder country name */
    color: #2d3748; /* Darker color for emphasis */
    font-size: 0.875em;
}

.brand-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px; /* Increased gap between tags */
}

.brand-tag {
    padding: 4px 10px; /* Increased padding */
    border-radius: 16px; /* Pill shape */
    font-size: 0.75em; /* Slightly larger font */
    font-weight: 600;
    white-space: nowrap;
    border: none; /* Remove border */
    text-transform: uppercase; /* Uppercase for tags */
}

.brand-tag.exclusive {
    background: #eef2f7; /* Light grey */
    color: #4a5568; /* Dark grey */
}

.brand-tag.protected {
    background: #e0f2fe; /* Light blue */
    color: #2b6cb0; /* Dark blue */
}

.brand-tag.promotable {
    background: #e6fffa; /* Light green */
    color: #38a169; /* Dark green */
}

.no-brands {
    color: #a0aec0; /* Softer grey for no brands */
    font-style: italic;
    font-size: 0.75em; /* Slightly larger font */
}


.modal-footer {
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85em;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.exclusive {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.legend-color.protected {
    background: linear-gradient(135deg, #ff7b25, #ff9d5c);
}

.legend-color.promotable {
    background: linear-gradient(135deg, #28a745, #4cd964);
}

.update-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85em;
}

/* Mobile Card Layout */
.agents-cards {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
}

.agent-card {
    background: #ffffff;
    border-radius: 4px;
    padding: 8px;
    border: 1px solid #ecf0f1;
}

.agent-country {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.8125em;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ecf0f1;
}

.agent-brands {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.brand-label {
    color: #2c3e50;
    font-size: 0.6875em;
    min-width: 35px;
    white-space: nowrap;
    font-weight: 500;
}

.brand-tags-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        max-height: 90vh;
        margin: 10px;
    }

    .modal-header {
        padding: 12px 15px;
    }

    .table-container {
        max-height: calc(90vh - 100px);
    }

    /* Hide table on mobile, show cards */
    .agents-table {
        display: none;
    }

    .agents-cards {
        display: flex;
    }

    .modal-footer {
        padding: 10px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .legend {
        gap: 12px;
    }
}

/* Desktop: show table, hide cards */

@media (min-width: 769px) {
    /* --- NEW DESKTOP TWO ROWS LAYOUT --- */
    #topFiltersRow.desktop-two-rows {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        margin: 0 0 12px 0 !important;
        /* Card UI additions */
        background-color: #f8f9fa !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 6px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
        padding: 6px 16px !important;
        box-sizing: border-box !important;
    }

        .desktop-row-1, .desktop-row-2 {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 16px !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
    }
    .desktop-row-1 {
        margin: 0 0 4px 0 !important;
    }
    .desktop-row-2 {
        margin: 0 !important;
    }
    
    /* Hide scrollbar for clean look */
    .desktop-row-1::-webkit-scrollbar, .desktop-row-2::-webkit-scrollbar {
        display: none !important;
    }

    /* Inline Label + Input */
    .desktop-row-1 .control-group,
    .desktop-row-2 .control-group,
    #categoryGroup, #certGroup {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        margin: 0 !important;
        flex-shrink: 1 !important; /* Allow shrinking */
    }

    .desktop-row-1 .control-group label,
    .desktop-row-2 .control-group label {
        margin: 0 !important;
        padding: 0 !important;
        white-space: nowrap !important;
        min-width: 60px !important;
        text-align: right !important;
        display: block !important;
    }

    /* Constrain inputs width */
    .desktop-row-1 input, 
    .desktop-row-1 select,
    .desktop-row-2 input[type="text"],
    .desktop-row-2 select {
        width: 100% !important;
        max-width: 100px !important;
        min-width: 50px !important;
        flex-shrink: 1 !important;
        padding: 0 6px !important;
        box-sizing: border-box !important;
    }
    
    /* Exception: Tool inputs might need to be smaller, e.g. Random count */
    #randomProductInput {
        width: 50px !important;
    }

    /* Agent Combo within Row 2 */
    #agentSearchCombo {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }
    #agentSearchCombo label[for="countryInput"] {
        display: none !important;
    }
    #agentSearchCombo .control-group {
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
    }

    /* Dev module */
    .dev-module {
        position: static !important;
        float: none !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
        background: transparent !important;
        flex-shrink: 0 !important;
    }
    .dev-module .checkbox-group {
        margin: 0 !important;
    }

    
}

/* ── 全局移动端工具类 (max-width: 768px) ── */
@media (max-width: 768px) {
    /* 通用：在手机上隐藏 */
    .hide-on-mobile {
        display: none !important;
    }
    /* 通用：在手机上以 inline-flex 显示 */
    .show-on-mobile-inline {
        display: inline-flex !important;
        align-items: center;
    }
    /* 强制隐藏 PC 端的 xx条+全显 块 */
    #rightAlignCountAndShowAll {
        display: none !important;
    }
    /* 隐藏过滤条件标签（用 placeholder 代替） */
    .filter-label {
        display: none !important;
    }
    /* 让 input/select 的 placeholder 风格与原来一致 */
    #sizeFilterInput::placeholder,
    #patternFilterInput::placeholder,
    #positionFilterInput::placeholder,
    #applicationFilterInput::placeholder,
    #brandCodeInput::placeholder,
    #brandNameInput::placeholder {
        color: #909399;
        font-size: 0.85em;
        font-weight: 400;
    }

    /* ── 小屏幕全局字体统一（以"全显"为基准）── */
    /* 基准：font-size: 0.8125em; font-weight:600; color:#303133;
       英文：Arial；中文：SimHei/黑体 */
    #sizeFilterInput,
    #patternFilterInput,
    #positionFilterInput,
    #applicationFilterInput,
    #brandCodeInput,
    #brandNameInput,
    #categoryFilterInput,
    #certificateSelect,
    #allAgentsBtn,
    #speedLevelBtn,
    label[for="debugModeCheckbox"],
    label[for="ttCheckbox"],
    label[for="tlCheckbox"],
    label[for="mobileShowAllCheckbox"],
    label[for="selectAllCheckbox"],
    label[for="removePricePdf"],
    label[for="removeWeightPdf"],
    label[for="topPackingCheckbox"],
    .client-type-toggle label,
    .client-type-toggle span,
    #mobileTotalInfo,
    #mobileTotalWrapper,
    .optional-columns span,
    .optional-columns label,
    .optional-columns .checkbox-group label,
    #price-panels-container details summary,
    #randomProductContainer label {
        font-family: Arial, "Helvetica Neue", "SimHei", "PingFang SC", "Microsoft YaHei", sans-serif !important;
        font-size: 0.8125em !important;
        font-weight: 600 !important;
        color: #303133 !important;
    }

    /* input 和 select 本身内容字体（输入时显示的文字） */
    #sizeFilterInput,
    #patternFilterInput,
    #positionFilterInput,
    #applicationFilterInput,
    #brandCodeInput,
    #brandNameInput,
    #categoryFilterInput,
    #certificateSelect {
        font-family: Arial, "Helvetica Neue", "SimHei", "PingFang SC", "Microsoft YaHei", sans-serif !important;
        font-size: 0.8125em !important;
        font-weight: 400 !important;
        color: #303133 !important;
    }

    /* placeholder 字体跟进 */
    #sizeFilterInput::placeholder,
    #patternFilterInput::placeholder,
    #positionFilterInput::placeholder,
    #applicationFilterInput::placeholder,
    #brandCodeInput::placeholder,
    #brandNameInput::placeholder {
        font-family: Arial, "Helvetica Neue", "SimHei", "PingFang SC", "Microsoft YaHei", sans-serif !important;
        color: #909399;
        font-size: 0.75em;
        font-weight: 400;
    }

    /* ── 小屏幕文字基线对齐 (Baseline Alignment) ── */
    .status-bar, 
    .optional-columns, 
    .optional-columns-checkboxes,
    .controls,
    #agentSearchCombo,
    .dev-module,
    .styled-group,
    .client-type-toggle {
        align-items: baseline !important;
    }

    /* 让 label 内部的文字参与基线计算 */
    .checkbox-group,
    .client-type-toggle label,
    #mobileShowAllInline {
        display: inline-flex !important;
        align-items: baseline !important;
    }

    /* 让方块(checkbox/radio)相对于文字中心对齐，不干扰文字基线 */
    input[type="checkbox"],
    input[type="radio"] {
        align-self: center !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        position: relative;
        top: 1px; /* 微调视觉居中 */
    }
    
    /* 修正输入框和按钮的内外边距，确保基线纯净 */
    #sizeFilterInput, #patternFilterInput, #positionFilterInput, 
    #applicationFilterInput, #brandCodeInput, #brandNameInput, 
    #categoryFilterInput, #certificateSelect, #countryInput, 
    #searchCountryBtn, #allAgentsBtn, #speedLevelBtn {
        vertical-align: baseline !important;
    }

    /* ── 拆除 status-bar 视觉分组，形成单行极其紧凑流 (Flat Flex) ── */
    .status-bar {
        gap: 6px 8px !important; /* 行距6px，列距8px */
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        padding-top: 4px !important;
    }
    
    /* 将内部容器拆除，使所有单选/复选/文字直接成为 status-bar 的 flex 子项 */
    .status-bar .client-type-toggle,
    .status-bar #ttTlGroup {
        display: contents !important;
    }

    /* 剥离原来用于强行分隔的 margin，全部交由 gap 控制 */
    .status-bar label,
    .status-bar .show-on-mobile-inline,
    .status-bar #mobileTotalWrapper,
    .status-bar #mobileShowAllInline,
    .status-bar input {
        margin: 0 !important;
    }
    
    /* 让独立的 label 内部控件靠得更紧 */
    .status-bar label {
        gap: 4px !important;
    }

    /* ── 小屏幕极致空间压缩：复选框/单选框统一切换为现代化 Chip (标签按钮) ── */
    
    /* 1. 隐藏真实的勾选框和单选框方块 */
    .status-bar input[type="radio"],
    .status-bar input[type="checkbox"],
    .optional-columns input[type="checkbox"] {
        display: none !important;
    }

    /* 2. 统一的基础标签样式 (未选中状态) */
    .client-type-toggle input[type="radio"] + span.desktop-text + span.mobile-text,
    #topPackingCheckbox + span.desktop-text + span.mobile-text,
    #ttCheckbox + label,
    #tlCheckbox + label,
    #mobileShowAllCheckbox + label,
    .optional-columns input[type="checkbox"] + label {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px 10px !important;
        border-radius: 4px !important;
        background-color: #f0f2f5 !important;
        color: #606266 !important;
        border: 1px solid #dcdfe6 !important;
        font-weight: 400 !important;
        font-size: 0.8125em !important; /* 统一字体大小覆盖 responsive.css */
        line-height: 1.2 !important;
        height: auto !important;
        box-sizing: border-box !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
        margin: 0 !important;
        min-height: 24px !important;
    }

    /* 3. 统一的激活标签样式 (已选中状态) */
    .client-type-toggle input[type="radio"]:checked + span.desktop-text + span.mobile-text,
    #topPackingCheckbox:checked + span.desktop-text + span.mobile-text,
    #ttCheckbox:checked + label,
    #tlCheckbox:checked + label,
    #mobileShowAllCheckbox:checked + label,
    .optional-columns input[type="checkbox"]:checked + label {
        background-color: #e8f4ff !important;
        color: #1890ff !important;
        border-color: #91caff !important;
        font-weight: 600 !important;
    }

    /* 4. 可选列子项目 (OD, SW, TW, TD) 小一号设计 */
    #odCheckbox + label,
    #swCheckbox + label,
    #twCheckbox + label,
    #tdCheckbox + label {
        padding: 2px 6px !important;
        font-size: 0.72em !important;
        min-height: 20px !important;
        border-radius: 3px !important;
    }
}


