* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* 上传进度容器样式 */
#uploadProgressContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    max-width: 300px;
}

#uploadProgressBar {
    background: #4CAF50;
    height: 20px;
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}

#uploadProgressText {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* 上传通知样式 */
.upload-notification {
    animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 校验结果样式 */
.validation-summary {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.summary-item .label {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.summary-item .value {
    font-size: 28px;
    font-weight: bold;
}

.summary-item.success .value {
    color: #2e7d32;
}

.summary-item.error .value {
    color: #c62828;
}

/* 结果标签页 */
.result-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.result-tabs .tab {
    padding: 10px 20px;
    border: none;
    background: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-tabs .tab:hover {
    background: #d0d0d0;
}

.result-tabs .tab.active {
    background: #1890ff;
    color: white;
}

/* 码列表容器 */
.code-list-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background: #fafafa;
}

/* 码项 */
.code-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
    border-left: 4px solid;
    background: white;
    transition: all 0.2s;
}

.code-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(2px);
}

.code-item.valid {
    border-left-color: #2e7d32;
}

.code-item.invalid {
    border-left-color: #c62828;
    background: #ffebee;
}

.code-item.invalid .code-text {
    color: #c62828;
    font-weight: bold;
}

/* 徽章 */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background: #2e7d32;
    color: white;
}

.badge-error {
    background: #c62828;
    color: white;
}

/* 错误原因标签 */
.error-reason {
    font-size: 12px;
    color: #c62828;
    margin-left: 10px;
}

/* 错误头部 */
.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #ffebee;
    border-radius: 4px;
    margin-bottom: 10px;
    color: #c62828;
}

/* 空状态消息 */
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* 警告 */
.alert-warning {
    background: #fff3e0;
    border: 1px solid #f57c00;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-warning ul {
    margin: 10px 0 0 20px;
    color: #f57c00;
}

.alert-warning li {
    margin-bottom: 5px;
}

/* 表格中的错误码行 */
.error-code {
    background: #ffebee !important;
}

.error-code .badge-error {
    display: inline-block;
}

/* 防伪码搜索和流向追踪样式 */
.search-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-filters {
    display: flex;
    gap: 10px;
}

.search-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-info {
    background: #667eea;
}

.btn-info:hover {
    background: #5568d3;
}

/* 流向追踪样式 */
.trace-detail {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.trace-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-row label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.info-row span {
    font-size: 14px;
    color: #333;
}

.info-row .code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
}

.trace-timeline h3 {
    margin-bottom: 20px;
    color: #333;
}

.timeline {
    position: relative;
    padding-left: 50px;
}

.timeline-item {
    position: relative;
    padding-bottom: 30px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
}

.marker-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    z-index: 2;
}

.marker-line {
    position: absolute;
    left: 17px;
    top: 36px;
    width: 2px;
    height: calc(100% + 30px);
    background: linear-gradient(to bottom, #667eea, #ddd);
}

.timeline-item:last-child .marker-line {
    display: none;
}

.timeline-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.timeline-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.type-badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.type-generated {
    background: #e3f2fd;
    color: #1976d2;
}

.type-outbound {
    background: #fff3e0;
    color: #f57c00;
}

.type-distribution {
    background: #e8f5e9;
    color: #388e3c;
}

.type-transfer {
    background: #f3e5f5;
    color: #7b1fa2;
}

.type-default {
    background: #f5f5f5;
    color: #666;
}

.timeline-date {
    font-size: 13px;
    color: #666;
}

.timeline-description {
    font-size: 15px;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.6;
}

.timeline-meta {
    font-size: 13px;
    color: #666;
    line-height: 1.8;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.timeline-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 登录页面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
}

/* 着陆页 */
.landing-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
}

.landing-header {
    padding: 20px 40px;
    background: rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-header h1 {
    color: white;
    font-size: 24px;
    margin: 0;
}

.landing-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.landing-sections {
    display: flex;
    gap: 40px;
    max-width: 1200px;
    width: 100%;
}

.landing-section {
    flex: 1;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.landing-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-section h2 .icon {
    font-size: 32px;
}

.landing-section .verify-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.landing-section .verify-form input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.landing-section .verify-form button {
    padding: 12px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.landing-section .verify-form button:hover {
    background: #45a049;
}

.landing-section .verify-form .scan-btn {
    background: #2196F3;
}

.landing-section .verify-form .scan-btn:hover {
    background: #0b7dda;
}

.landing-section .verify-form .upload-btn {
    background: #FF9800;
}

.landing-section .verify-form .upload-btn:hover {
    background: #e68900;
}

#qr-reader {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

#qr-reader video {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#qr-reader video::-webkit-media-controls {
    display: none !important;
}

#qr-reader video::-webkit-media-controls-enclosure {
    display: none !important;
}

#groupQrReader, #scatterQrReader {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

#groupQrReader video, #scatterQrReader video {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.landing-section .verify-result {
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
}

.landing-section .verify-result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.landing-section .verify-result.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.landing-section .verify-result.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.landing-section .verify-result.danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.landing-section .verify-result h3 {
    margin-top: 0;
    font-size: 16px;
}

.landing-section .warning-message {
    margin-top: 10px;
    padding: 12px;
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 14px;
}

.landing-section .danger-message {
    margin-top: 10px;
    padding: 12px;
    background: #fee;
    border-left: 4px solid #dc3545;
    border-radius: 4px;
    font-size: 14px;
}

.landing-section .product-info {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 4px;
}

.landing-section .product-info p {
    margin: 5px 0;
    font-size: 14px;
}

.landing-section .login-btn {
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.landing-section .login-btn:hover {
    background: #5568d3;
}

.landing-section .info-text {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

/* 客户表单中的长文本输入框 */
#customerCompanyName,
#customerBusinessLicense,
#customerContactPerson,
#customerAddress {
    font-size: 13px;
    padding: 10px;
    line-height: 1.4;
    word-break: break-all;
    overflow-wrap: break-word;
}

/* 移动端优化 */
@media (max-width: 768px) {
    #customerCompanyName,
    #customerBusinessLicense,
    #customerContactPerson,
    #customerAddress {
        font-size: 12px;
        padding: 8px;
    }
}

.form-group select option {
    padding: 10px;
    min-height: 30px;
}

.form-group select option:hover {
    background-color: #f0f0f0;
}

/* 修复调整上级模态框中的select */
#editParentId {
    min-height: 44px !important;
    font-size: 14px !important;
    -webkit-appearance: menulist;
    appearance: menulist;
    background-color: white;
    min-width: 300px !important;
    width: 100% !important;
    height: 44px !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    cursor: pointer;
}

/* 分发方式选择器样式 - 优化下拉选项 */
.distribute-mode-select {
    width: 100% !important;
    min-height: 48px !important;
    padding: 12px !important;
    font-size: 15px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    cursor: pointer !important;
    transition: border-color 0.3s !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
}

.distribute-mode-select:hover {
    border-color: #667eea !important;
}

.distribute-mode-select:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.distribute-mode-select option {
    min-height: 48px !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background-color: #fff !important;
    display: block !important;
    cursor: pointer !important;
}

.distribute-mode-select option:hover,
.distribute-mode-select option:checked {
    background-color: #667eea !important;
    color: #fff !important;
}

/* 帮助文本样式 */
.help-text {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-top: 8px;
}

.editParentId option {
    min-height: 44px !important;
    padding: 12px !important;
    font-size: 14px !important;
    line-height: 1.5;
    color: #333 !important;
    min-width: 200px !important;
    display: block !important;
}

/* 确保select在模态框中正常显示 */
.modal-content #editParentId {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}

/* 主页面 */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px 0;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.user-info {
    font-size: 12px;
    color: #95a5a6;
}

.user-role {
    display: inline-block;
    padding: 2px 8px;
    background: #3498db;
    border-radius: 3px;
    font-size: 11px;
    margin-top: 5px;
}

.user-role.admin {
    background: #e74c3c;
}

.user-role.agent {
    background: #f39c12;
}

.user-role.sales {
    background: #27ae60;
}

.sidebar-nav {
    margin-top: 20px;
}

.sidebar-nav-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav-item:hover {
    background: #34495e;
}

.sidebar-nav-item.active {
    background: #34495e;
    border-left: 4px solid #3498db;
}

.sidebar-nav-item i {
    width: 20px;
}

.logout-btn {
    margin-top: 20px;
    margin-left: 20px;
    margin-right: 20px;
    padding: 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: calc(100% - 40px);
}

.logout-btn:hover {
    background: #c0392b;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.page-header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin: 0;
    flex: 1;
    color: white;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 按钮网格布局（用于客户管理页面） */
.header-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.header-buttons-grid .btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* 入库按钮样式 */
.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

/* 出库按钮样式 */
.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* 所有按钮的过渡效果 */
.btn {
    transition: all 0.3s ease;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    overflow-x: auto;
}

/* 移动端表格容器 */
.table-container {
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    min-width: 800px; /* 确保表格在移动端可滚动 */
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

table thead {
    background: #f8f9fa;
}

table th,
table td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    font-size: 13px;
}

table th {
    font-weight: 600;
    color: #495057;
    font-size: 12px;
    padding: 4px 8px;
}

table tbody tr:hover {
    background: #f8f9fa;
}

/* 表格单元格文本换行 */
table td {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-all;
}

/* 各列宽度设置 */
table th:nth-child(1),
table td:nth-child(1) {
    width: 40px; /* 选择框 */
    text-align: center;
}

table th:nth-child(2),
table td:nth-child(2) {
    width: 50px; /* ID */
}

table th:nth-child(3),
table td:nth-child(3) {
    width: 200px; /* 公司名称 */
}

table th:nth-child(4),
table td:nth-child(4) {
    width: 70px; /* 类型 */
}

table th:nth-child(5),
table td:nth-child(5) {
    width: 60px; /* 负责人 */
}

table th:nth-child(6),
table td:nth-child(6) {
    width: 110px; /* 负责人电话 */
}

table th:nth-child(7),
table td:nth-child(7) {
    width: 80px; /* 归属代理商 */
}

table th:nth-child(8),
table td:nth-child(8) {
    width: 80px; /* 归属业务员 */
}

table th:nth-child(9),
table td:nth-child(9) {
    width: 60px; /* 创建人 */
}

table th:nth-child(10),
table td:nth-child(10) {
    width: 70px; /* 审核状态 */
}

table th:nth-child(11),
table td:nth-child(11) {
    width: 160px; /* 操作 */
}

/* 复选框样式 */
table input[type="checkbox"] {
    cursor: pointer;
    transform: scale(1.1);
}

/* 表格内按钮的紧凑样式 */
table .btn {
    width: auto;
    padding: 2px 6px;
    font-size: 11px;
    margin: 1px;
    display: inline-block;
}

/* 表格内徽章样式优化 */
table .badge {
    font-size: 10px;
    padding: 2px 5px;
}

/* 表单样式 */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 600px;
}

.form-container h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 状态标签 */
.badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* 统计卡片 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

/* 二维码显示 */
.qrcode-container {
    text-align: center;
    padding: 20px;
}

.qrcode-container img {
    max-width: 200px;
    margin-bottom: 10px;
}

/* ==================== 微信公众号移动端适配 ==================== */

/* 测试：移动端按钮强制显示 */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
    }
}

/* 触摸友好的交互 */
button, .sidebar-nav-item, input, select {
    min-height: 44px; /* iOS推荐的最小触摸目标 */
    -webkit-tap-highlight-color: transparent;
}

/* 移动端侧边栏 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 侧边栏打开时，按钮移到侧边栏下方 */
.sidebar.active ~ .mobile-menu-btn {
    left: 300px;
}

/* 移动端面包屑导航 */
.mobile-breadcrumb {
    display: none;
    position: fixed;
    top: 10px;
    left: 65px;
    right: 10px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.mobile-breadcrumb .breadcrumb-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-breadcrumb .back-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.mobile-breadcrumb .back-btn:active {
    background: #5568d3;
    transform: scale(0.95);
}

.mobile-breadcrumb .home-btn {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.mobile-breadcrumb .home-btn:active {
    background: #d97706;
    transform: scale(0.95);
}

.mobile-breadcrumb .page-title {
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移动端遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* 移动端侧边栏激活状态（全局，不依赖媒体查询） */
.sidebar.active {
    transform: translateX(0) !important;
}

/* 移动端侧边栏默认隐藏 */
.sidebar {
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 85vw !important;
        transform: translateX(-100%) !important;
        z-index: 1000 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .sidebar.active {
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }
}

/* ==================== 响应式设计 ==================== */

/* 大屏设备 (桌面) */
@media (min-width: 1024px) {
    .main-container {
        display: flex;
    }

    .sidebar {
        position: relative;
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .mobile-breadcrumb {
        display: none !important;
    }
}

/* 中等屏幕 (平板) */
@media (min-width: 769px) and (max-width: 1023px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        padding: 20px;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .header-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .header-buttons .btn {
        flex: 1;
        min-width: 120px;
    }
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .mobile-breadcrumb {
        display: none !important;
    }
}

/* 小屏幕 (手机) */
@media (max-width: 768px) {
    /* 移动端面包屑导航 */
    .mobile-breadcrumb {
        display: flex;
    }

    /* 侧边栏变为抽屉式 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }
    
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* 移动端用户信息显示在右侧 */
    .sidebar .user-info {
        position: fixed;
        left: 10px;
        top: 10px;
        background: #2c3e50;
        padding: 8px 12px;
        border-radius: 8px;
        z-index: 999;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        color: white;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* 主内容区 */
    .main-container {
        flex-direction: column;
    }
    
    .main-content {
        padding: 15px;
        margin-top: 60px; /* 为菜单按钮留空间 */
        padding-top: 75px;
    }
    
    /* 页面头部 */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
        padding: 20px;
        border-radius: 12px;
    }

    .page-header h1 {
        font-size: 22px;
        margin-bottom: 10px;
        text-align: center;
        color: white;
    }

    .header-buttons {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .header-buttons .btn {
        font-size: 16px;
        padding: 16px;
        min-height: 52px;
        border-radius: 8px;
        font-weight: 600;
    }
    
    .page-header h1 {
        font-size: 22px;
        margin-bottom: 10px;
    }
    
    /* 统计卡片 */
    .stats-container {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card h3 {
        font-size: 13px;
    }
    
    .stat-card .value {
        font-size: 24px;
    }
    
    /* 表单 */
    .form-container {
        padding: 20px;
        border-radius: 8px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 12px;
    }
    
    /* 表格容器 */
    .table-container {
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px; /* 强制表格水平滚动 */
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* 按钮 */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons button {
        width: 100%;
    }
    
    /* 模态框 */
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 20px;
        margin: 10px;
    }
    
    /* 登录框 */
    .login-box {
        padding: 25px 20px;
        margin: 15px;
        width: auto;
        max-width: calc(100% - 30px);
    }
    
    .login-box h1 {
        font-size: 22px;
    }
    
    /* 着陆页 */
    .landing-sections {
        flex-direction: column;
        gap: 20px;
    }
    
    .landing-section {
        padding: 25px 20px;
    }
    
    .landing-section h2 {
        font-size: 18px;
    }
    
    .landing-section .verify-form {
        flex-direction: column;
    }
    
    .landing-section .verify-form input {
        min-width: 100%;
    }
    
    .landing-section .verify-form button {
        width: 100%;
    }
    
    /* 搜索栏 */
    .search-bar {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-bar input[type="text"],
    .search-bar input[type="date"],
    .search-bar select {
        width: 100%;
        min-width: 100%;
    }
    
    /* 标签页 */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .tab {
        padding: 10px 15px;
        white-space: nowrap;
        font-size: 14px;
    }
    
    /* 时间线 */
    .timeline {
        padding-left: 40px;
    }
    
    .timeline-content {
        padding: 15px;
    }
    
    .timeline-title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timeline-description {
        font-size: 14px;
    }
    
    .timeline-meta {
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
    }
    
    /* 二维码扫描区域 */
    #qr-reader {
        width: 100%;
        max-width: 100%;
    }
    
    #qr-reader video {
        border-radius: 8px;
    }
    
    /* Toast通知 - 移动端优化 */
    .toast {
        left: 10px !important;
        right: 10px !important;
        top: 10px !important;
        width: auto !important;
        max-width: calc(100% - 20px) !important;
        font-size: 14px !important;
        padding: 12px 16px !important;
        word-break: break-word !important;
        white-space: normal !important;
        line-height: 1.4 !important;
    }
    
    /* 上传进度 */
    #uploadProgressContainer {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
    
    /* 验证结果摘要 */
    .validation-summary {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .summary-item .value {
        font-size: 24px;
    }
    
    /* 码列表 */
    .code-list-container {
        max-height: 300px;
    }
    
    .code-item {
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* 徽章 */
    .badge {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    /* 箱信息 */
    .box-info {
        padding: 12px;
        font-size: 13px;
    }
    
    /* 追踪详情头部 */
    .trace-header {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
    }
    
    /* 追踪详情卡片 */
    .trace-detail {
        padding: 15px;
    }
    
    /* 搜索区域 */
    .search-section {
        padding: 15px;
    }
    
    /* 侧边栏导航项 */
    .sidebar-nav-item {
        padding: 15px 20px;
        font-size: 15px;
    }
    
    /* 退出按钮 */
    .logout-btn {
        margin: 20px;
        padding: 12px;
        font-size: 15px;
    }
    
    /* 用户信息 */
    .user-info {
        font-size: 13px;
    }
    
    .user-role {
        font-size: 12px;
        padding: 4px 10px;
    }
    
    /* 侧边栏头部 */
    .sidebar-header {
        padding: 20px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
    }
}

/* 超小屏幕 (< 360px) */
@media (max-width: 359px) {
    .main-content {
        padding: 10px;
        padding-top: 70px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .value {
        font-size: 20px;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 8px 5px;
        font-size: 12px;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        height: 100vh;
        max-height: none;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .sidebar-header {
        padding: 10px 20px;
    }
    
    .sidebar-nav-item {
        padding: 8px 20px;
    }
}

/* ==================== 着陆页移动端优化 ==================== */

@media (max-width: 768px) {
    .landing-header {
        padding: 15px 20px;
    }
    
    .landing-header h1 {
        font-size: 18px;
        text-align: center;
    }
    
    .landing-content {
        padding: 15px;
        align-items: flex-start;
    }
    
    .landing-sections {
        flex-direction: column;
        gap: 15px;
    }
    
    .landing-section {
        padding: 20px;
    }
    
    .landing-section h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .landing-section h2 .icon {
        font-size: 24px;
    }
    
    .landing-section .info-text {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .landing-section .verify-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .landing-section .verify-form input {
        min-width: 100%;
        padding: 14px;
        font-size: 16px;
    }
    
    .landing-section .verify-form button {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }
    
    .landing-section .verify-result {
        padding: 12px;
        margin-top: 15px;
    }
    
    .landing-section .verify-result h3 {
        font-size: 14px;
    }
    
    .landing-section .product-info {
        padding: 8px;
    }
    
    .landing-section .product-info p {
        font-size: 13px;
    }
    
    .landing-section .warning-message,
    .landing-section .danger-message {
        padding: 10px;
        font-size: 13px;
    }
    
    .landing-section .login-btn {
        padding: 14px;
        font-size: 15px;
    }
}

@media (max-width: 359px) {
    .landing-header h1 {
        font-size: 16px;
    }
    
    .landing-section {
        padding: 15px;
    }
    
    .landing-section h2 {
        font-size: 16px;
    }
    
    .landing-section .info-text {
        font-size: 12px;
    }
}

/* ==================== 微信浏览器特殊优化 ==================== */

/* 微信浏览器下固定底部内容不被遮挡 */
@media screen and (min-width: 320px) and (max-width: 768px) {
    .main-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    #uploadProgressContainer {
        bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* 优化输入框在iOS上的表现 */
input[type="text"],
input[type="tel"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
}

/* iOS安全区域适配 */
@supports (padding: max(0px)) {
    .modal-content {
        padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    }
    
    .sidebar {
        padding-top: env(safe-area-inset-top);
    }
}

/* 滚动优化 */
.modal-content,
.sidebar,
.main-content,
.code-list-container,
.table-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 防止iOS双击缩放 */
button,
input,
select,
textarea {
    touch-action: manipulation;
}

/* 文字选择优化 */
.user-info,
.stat-card .value,
.timeline-description {
    -webkit-user-select: none;
    user-select: none;
}

/* 输入框聚焦优化 */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Toast 提示 - 使用!important确保不被覆盖 */
.toast {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    padding: 16px 20px !important;
    border-radius: 8px !important;
    color: white !important;
    z-index: 2000 !important;
    animation: slideIn 0.3s ease-out !important;
    -webkit-animation: slideIn 0.3s ease-out !important;
    -moz-animation: slideIn 0.3s ease-out !important;
    -ms-animation: slideIn 0.3s ease-out !important;
    -o-animation: slideIn 0.3s ease-out !important;
    width: 340px !important; /* 固定宽度 */
    max-width: 340px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-align: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    word-break: break-word !important; /* 自动换行 */
    white-space: normal !important; /* 正常换行 */
    display: block !important; /* 确保不是flex */
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ff9800;
}

.toast.info {
    background: #2196f3;
}

@keyframes slideIn {
    from {
        transform: translateX(100%) translateY(0);
        -webkit-transform: translateX(100%) translateY(0);
        -moz-transform: translateX(100%) translateY(0);
        -ms-transform: translateX(100%) translateY(0);
        -o-transform: translateX(100%) translateY(0);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(0);
        -webkit-transform: translateX(0) translateY(0);
        -moz-transform: translateX(0) translateY(0);
        -ms-transform: translateX(0) translateY(0);
        -o-transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        -webkit-transform: translateX(0);
        -moz-transform: translateX(0);
        -ms-transform: translateX(0);
        -o-transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        -webkit-transform: translateX(100%);
        -moz-transform: translateX(100%);
        -ms-transform: translateX(100%);
        -o-transform: translateX(100%);
        opacity: 0;
    }
}

/* 代理商分发管理样式 */
.shipment-card {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s;
    background: white;
}

.shipment-card:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.shipment-card.selected {
    border-color: #4CAF50;
    background: #f0f9f0;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

/* 标签页样式 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    position: relative;
    transition: all 0.3s;
}

.tab.active {
    color: #1890ff;
    font-weight: bold;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #1890ff;
}

/* 搜索栏样式 */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
    align-items: center;
    flex-wrap: wrap;
}

/* 收货人下拉列表样式 */
.recipient-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recipient-item:hover {
    background: #f5f5f5;
}

.recipient-item:last-child {
    border-bottom: none;
}

.search-bar input[type="text"],
.search-bar input[type="date"],
.search-bar select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-bar input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.search-bar input[type="date"] {
    min-width: 150px;
}

.search-bar select {
    min-width: 150px;
}
}

.tab:hover {
    color: #1890ff;
}

/* 箱信息样式 */
.box-info {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 20px;
}

.box-info p {
    margin: 8px 0;
    font-size: 14px;
}

.box-info strong {
    color: #333;
}

/* 更换追溯码样式 */
.validation-message {
    margin-top: 8px;
    font-size: 14px;
}

.validation-message .valid {
    color: #28a745;
}

.validation-message .invalid {
    color: #dc3545;
}

.validation-message .validating {
    color: #666;
}

.page-description {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

/* ==================== 用户管理页面按钮优化 ==================== */

/* 用户管理页面头部按钮容器优化 - 使用2x2网格布局 */
.page-header .header-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
}

.page-header .header-buttons-grid .btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* 大屏设备优化 */
@media (min-width: 769px) {
    .page-header .header-buttons-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: auto;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .page-header .header-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
    }

    .page-header .header-buttons-grid .btn {
        font-size: 13px;
        padding: 10px 8px;
        min-height: 44px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-align: center;
        word-break: break-word;
        line-height: 1.3;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .page-header .header-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .page-header .header-buttons-grid .btn {
        font-size: 12px;
        padding: 8px 6px;
        min-height: 42px;
    }
}




 
