* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
.header {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 统计卡片 */
.stats-section {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* 嘉运订单页面：四个卡片一行显示 */
.jiayun-stats-section {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card[style*="cursor: pointer"]:hover {
    background: #f8fafc;
}

.stat-icon {
    font-size: 3rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-sub-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.stat-card-small {
    min-width: 180px;
    max-width: 220px;
    padding: 20px;
}

.stat-card-small .stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
}

.stat-card-small .stat-value {
    font-size: 1.8rem;
}

.stat-card-large {
    min-width: 300px;
    flex: 1;
}

.stat-sub-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
    line-height: 1.4;
    max-height: 60px;
    overflow-y: auto;
}

.regions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    align-items: center;
}

.region-stats-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.region-stats-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.region-stats-row:last-child {
    border-bottom: none;
}

.region-stats-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    flex-shrink: 0;
    white-space: nowrap;
}

.region-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.region-item:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.region-name {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.region-count {
    font-weight: 600;
    color: var(--primary-color);
    flex-shrink: 0;
    margin-left: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 图表区域 */
.charts-section-wrapper {
    margin-bottom: 20px;
}

.charts-toggle-header {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0;
}

.charts-toggle-header:hover {
    background: #f8fafc;
}

.charts-toggle-header h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.toggle-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.chart-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.chart-container canvas {
    max-height: 200px;
    height: 200px !important;
}

/* 筛选区域 */
.filter-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.filter-section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 1;
    min-width: 120px;
    flex: 0 1 auto;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.filter-input {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    width: 100%;
    min-width: 0;
}

.filter-input[type="date"] {
    min-width: 140px;
    max-width: 160px;
}

.filter-input[type="text"] {
    min-width: 120px;
    max-width: 180px;
}

.filter-input[type="text"]::placeholder {
    font-size: 0.85rem;
}

.filter-input select,
.filter-input[type="text"],
.filter-input[type="date"] {
    box-sizing: border-box;
}

select.filter-input {
    min-width: 120px;
    max-width: 200px;
}

.filter-divider {
    width: 1px;
    background: var(--border-color);
    margin: 0 5px;
    align-self: stretch;
    flex-shrink: 0;
    height: 40px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 按钮 */
.btn-primary, .btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    height: fit-content;
    white-space: nowrap;
    min-width: fit-content;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

/* 客户排名 */
.price-query-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.price-query-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.price-query-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.price-results-container {
    margin-top: 20px;
}

.price-results-container h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
}

.price-table thead {
    background: var(--bg-color);
}

.price-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.price-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.price-table tbody tr:hover {
    background: var(--bg-color);
}

.top-customers-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.top-customers-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.customers-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.customer-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-color);
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.customer-item:hover {
    background: #f1f5f9;
}

.customer-rank {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    width: 24px;
    flex-shrink: 0;
}

.customer-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 8px;
}

.customer-count {
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* 订单列表 */
.orders-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.table-container {
    overflow-x: auto;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table thead {
    background: var(--bg-color);
}

.orders-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.orders-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.orders-table td.product-info-cell {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.6;
    max-width: 400px;
}

.orders-table tbody tr {
    transition: background 0.2s;
}

.orders-table tbody tr:hover {
    background: var(--bg-color);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 提货类型标签样式 */
.order-type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.order-type-badge.type-order {
    background-color: #3b82f6;
    color: white;
}

.order-type-badge.type-spot {
    background-color: #10b981;
    color: white;
}

.status-4 {
    background: #fef3c7;
    color: #92400e;
}

.status-6 {
    background: #d1fae5;
    color: #065f46;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    padding: 8px 16px;
    color: var(--text-secondary);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 响应式 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
    
    .jiayun-stats-section {
        grid-template-columns: 1fr;
    }
    
    .stat-card-small,
    .stat-card-large {
        min-width: auto;
        max-width: none;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .chart-container canvas {
        max-height: 180px;
        height: 180px !important;
    }
    
    .filters {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .filter-group {
        min-width: calc(50% - 4px);
        flex: 1 1 calc(50% - 4px);
    }
    
    .filter-input[type="date"],
    .filter-input[type="text"],
    select.filter-input {
        max-width: 100%;
    }
    
    .btn-primary,
    .btn-secondary {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .orders-table {
        font-size: 0.85rem;
    }
    
    .customers-list,
    .regions-list {
        grid-template-columns: 1fr;
    }
}

