:root {
    --bs-primary: #0d6efd;
    --bs-primary-rgb: 13,110,253;
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-bg: #f8fafc;
    --dark-text: #2c3e50;
    --header-height: 45px;
}

/* 基础样式 */
* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    color: var(--dark-text);
    margin: 0;
    padding: 0;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* 导航栏 */
.app-header {
    background: white;
    -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 0.5rem 1rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    height: var(--header-height);
}

.logo-area {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 28px;
    width: auto;
}

.user-area {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 12px;
}

.remaining-badge {
    background: #e7f5ff;
    padding: 3px 10px;
    border-radius: 20px;
    color: #0a58ca;
    font-weight: 500;
    font-size: 0.75rem;
}

/* 主容器（三栏布局） */
.main-container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    height: calc(100vh - var(--header-height) - 4vh);
    padding: 0 2vw 4vh 2vw;
    gap: 10px;
    overflow: hidden;
}

/* 降级：为不支持 gap 的浏览器添加外边距 */
.main-container > * {
    margin-right: 10px;
}
.main-container > *:last-child {
    margin-right: 0;
}

.left-panel {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 45%;
    flex: 0 0 45%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.middle-panel {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 30%;
    flex: 0 0 30%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.right-panel {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 25%;
    flex: 0 0 25%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

/* 卡片通用样式 */
.card-custom {
    background: white;
    border-radius: 12px;
    border: 1px solid #edf2f7;
    -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    padding: 0.8rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.card-header-custom {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 0.6rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 4px;
}

/* 文件处理卡片 - 关键修改：使用 flex:1 1 0% 强制占满剩余空间 */
.file-processing-card {
    flex: 1 1 0%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    min-height: 0;
}

/* 日志卡片 */
.log-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #edf2f7;
    -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.log-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
    padding: 0.8rem 0.8rem 0.3rem 0.8rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 4px;
}

.log-content {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    padding: 0.6rem;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    background: white;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 0;
}

.log-item {
    margin-bottom: 3px;
    line-height: 1.4;
}

.log-success { color: #10b981; }
.log-error { color: #ef4444; }
.log-warning { color: #f59e0b; }
.log-info { color: #2563eb; }

.form-label-sm {
    font-size: 0.7rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.1rem;
    display: block;
}

/* 图标按钮 */
.icon-btn {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.icon-btn i {
    font-size: 0.8rem;
}

/* 主要处理按钮 */
.btn-process {
    background: #0d6efd;
    color: white;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 30px;
    border: none;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
    width: 100%;
    font-size: 0.85rem;
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-process:hover {
    background: #0b5ed7;
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
    -webkit-box-shadow: 0 4px 8px rgba(13,110,253,0.2);
    box-shadow: 0 4px 8px rgba(13,110,253,0.2);
}

.btn-process:disabled {
    background: #94a3b8;
    -webkit-transform: none;
    transform: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

/* 文件行 */
.file-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 0;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    box-sizing: border-box;
}

/* 各列使用 flex 占比，总和 7.5，为 gap 留出 0.5 份空间 */
.file-row .file-name-input {
    flex: 3 1 0; /* 占比 3/7.5 ≈ 40% */
    min-width: 0; /* 允许内容收缩 */
}
.file-row .waybill-input {
    flex: 1.5 1 0; /* 占比 1.5/7.5 = 20% */
    min-width: 0;
}
.file-row .weight-input {
    flex: 1 1 0; /* 占比 1/7.5 ≈ 13.3% */
    min-width: 0;
}
.file-row .actions {
    flex: 2 1 0; /* 占比 2/7.5 ≈ 26.7% */
    min-width: 0;
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* 文件列表容器 */
#fileEntriesContainer {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-bottom: 8px;
}

/* 当前批次列表卡片 */
.current-batch-card {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    min-height: 0;
}

.current-batch-list {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-bottom: 4px;
}

.batch-item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.75rem;
}

.batch-item .filename {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 4px;
}

.batch-item .filesize {
    margin-right: 4px;
    color: #6c757d;
}

.batch-actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 2px;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

/* 表格 */
.table-sm td, .table-sm th {
    padding: 0.2rem 0.15rem;
    vertical-align: middle;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* 滚动条 */
.log-content::-webkit-scrollbar,
#fileEntriesContainer::-webkit-scrollbar,
.current-batch-list::-webkit-scrollbar {
    width: 4px;
}
.log-content::-webkit-scrollbar-track,
#fileEntriesContainer::-webkit-scrollbar-track,
.current-batch-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.log-content::-webkit-scrollbar-thumb,
#fileEntriesContainer::-webkit-scrollbar-thumb,
.current-batch-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}
.log-content::-webkit-scrollbar-thumb:hover,
#fileEntriesContainer::-webkit-scrollbar-thumb:hover,
.current-batch-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 紧凑栅格 */
.row.g-1 {
    --bs-gutter-y: 0.2rem;
    --bs-gutter-x: 0.3rem;
}

/* 按钮不换行 */
.btn, .btn-sm {
    white-space: nowrap;
}

/* 登录页面包装器 */
.login-wrapper {
    width: 1200px;
    max-width: 95vw;
    height: 680px;
    max-height: 90vh;
    background: white;
    border-radius: 32px;
    -webkit-box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    overflow: hidden;
}

.promo-section {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 55%;
    flex: 1 1 55%;
    background: -webkit-gradient(linear, left top, right bottom, from(#f8fafc), to(#e9ecef));
    background: linear-gradient(145deg, #f8fafc 0%, #e9ecef 100%);
    padding: 1.5rem 1.8rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.promo-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.8rem;
}

.promo-logo {
    width: 52px;
    height: 52px;
    -o-object-fit: contain;
    object-fit: contain;
}

.promo-title h1 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
}

.promo-title p {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
}

.promo-tagline {
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* 功能网格（flex 实现，兼容性更好） */
.feature-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: 0 -8px;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow-y: auto;
}

.feature-item {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(50% - 16px);
    flex: 0 0 calc(50% - 16px);
    margin: 0 8px 12px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 8px;
}

/* 降级方案：如果浏览器不支持 gap，用外边距模拟 */
@supports not (gap: 8px) {
    .feature-item {
        gap: 0;
    }
    .feature-item > * {
        margin-right: 8px;
    }
    .feature-item > *:last-child {
        margin-right: 0;
    }
}

.feature-icon {
    width: 38px;
    height: 38px;
    background: var(--secondary-color);
    color: white;
    border-radius: 10px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 1.1rem;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.feature-text h4 {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0 0 3px 0;
    color: var(--primary-color);
}

.feature-text p {
    font-size: 0.73rem;
    color: #5a6a7a;
    margin: 0;
    line-height: 1.3;
}

.download-area {
    background: white;
    border-radius: 18px;
    padding: 0.9rem 1.2rem;
    -webkit-box-shadow: 0 8px 18px rgba(0,0,0,0.04);
    box-shadow: 0 8px 18px rgba(0,0,0,0.04);
    margin-top: 0.2rem;
}

.version-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.version-badge {
    background: var(--secondary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
}

.download-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 40px;
    padding: 8px 18px;
    font-weight: 600;
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
    width: 100%;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 0.9rem;
}

.download-btn:hover {
    background: #c0392b;
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
    -webkit-box-shadow: 0 6px 12px rgba(231,76,60,0.3);
    box-shadow: 0 6px 12px rgba(231,76,60,0.3);
    color: white;
}

/* 右侧登录区域 */
.login-section {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 45%;
    flex: 0 0 45%;
    background: white;
    padding: 2.5rem 2rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.login-card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.login-card .subtitle {
    color: #6c757d;
    margin-bottom: 2rem;
}

/* 浏览器推荐提示 */
.browser-tip {
    margin-top: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
    border: 1px solid #e9ecef;
}

/* 响应式 */
@media (max-width: 1000px) {
    .login-wrapper {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow: auto;
    }
    .promo-section, .login-section {
        -webkit-box-flex: auto;
        -ms-flex: auto;
        flex: auto;
    }
    body {
        overflow: auto;
        height: auto;
        padding: 20px;
    }
    .feature-item {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 100%;
        flex: 0 0 100%;
    }
}

/* ========== 新增：进度条动画强制流动 ========== */
#progressBar.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite !important;
}

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    display: flex;
    align-items: center;
}