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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: visible;
}

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

header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #2c3e50;
    margin: 0;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
    display: inline-block;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-warning {
    background-color: #e74c3c;
    color: white;
}

.btn-warning:hover {
    background-color: #c0392b;
}

.spreadsheet-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.visualization-section {
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    height: calc(100vh - 180px);
    overflow: visible;
}

.spreadsheet-section h2, .visualization-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
}

.table-wrapper {
    overflow: auto;
    max-height: 600px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#spreadsheet,
#incomeSpreadsheet,
#paymentSpreadsheet {
    border-collapse: collapse;
    width: 100%;
    background: white;
}

#spreadsheet th,
#spreadsheet td,
#incomeSpreadsheet th,
#incomeSpreadsheet td,
#paymentSpreadsheet th,
#paymentSpreadsheet td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    min-width: 80px;
}

/* 确收情况统计表和回款情况统计表列宽设置 */
#incomeSpreadsheet,
#paymentSpreadsheet {
    table-layout: fixed;
}

#incomeSpreadsheet td:first-child,
#incomeSpreadsheet th:first-child,
#paymentSpreadsheet td:first-child,
#paymentSpreadsheet th:first-child {
    white-space: nowrap;
}

#spreadsheet th,
#incomeSpreadsheet th,
#paymentSpreadsheet th {
    background-color: #3498db;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

#spreadsheet td:first-child,
#incomeSpreadsheet td:first-child,
#paymentSpreadsheet td:first-child {
    background-color: #ecf0f1;
    font-weight: bold;
    position: sticky;
    left: 0;
    z-index: 5;
}

#spreadsheet th:first-child,
#incomeSpreadsheet th:first-child,
#paymentSpreadsheet th:first-child {
    position: sticky;
    left: 0;
    z-index: 15;
    background-color: #2980b9;
}

#spreadsheet input,
#incomeSpreadsheet input,
#paymentSpreadsheet input {
    width: 100%;
    border: none;
    padding: 4px;
    text-align: center;
    background: transparent;
    font-size: 14px;
}

#spreadsheet input:focus,
#incomeSpreadsheet input:focus,
#paymentSpreadsheet input:focus {
    outline: 2px solid #3498db;
    background: #f8f9fa;
}

#spreadsheet td.invalid,
#incomeSpreadsheet td.invalid,
#paymentSpreadsheet td.invalid {
    background-color: #ffebee;
}

#spreadsheet td.header-cell input,
#incomeSpreadsheet td.header-cell input,
#paymentSpreadsheet td.header-cell input {
    font-weight: bold;
}

#sankeyChart {
    min-height: 400px;
    padding: 0;
    overflow: visible;
    height: 100%;
    width: 100%;
}

.sankey-container {
    position: relative;
    min-height: 400px;
}

.employee-list, .project-list {
    display: inline-block;
    vertical-align: top;
}

.employee-item, .project-item {
    height: 10px;
    margin: 2px 0;
    padding: 5px 10px;
    background-color: #3498db;
    color: white;
    border-radius: 3px;
    font-size: 12px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.project-item {
    background-color: #2ecc71;
}

canvas#sankeyCanvas {
    display: block;
    margin: 0;
    padding: 0;
}

.validation-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    font-weight: bold;
}

/* 配置区域样式 */
.config-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.config-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
}

.config-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.config-panel {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background-color: #f8f9fa;
}

.config-panel h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.groups-container {
    margin-top: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.group-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
}

.group-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.group-item-header h4 {
    color: #2c3e50;
    font-size: 14px;
    margin: 0;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background-color: #c0392b;
}

.group-item-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
}

.field-group input[type="text"],
.field-group input[type="number"] {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

.field-group input[type="color"] {
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
}

.field-group input[type="color"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.field-group input:focus {
    outline: 2px solid #3498db;
    border-color: #3498db;
}

.color-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-type-select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    background-color: white;
    cursor: pointer;
}

.color-type-select:focus {
    outline: 2px solid #3498db;
    border-color: #3498db;
}

.color-selector input[type="color"] {
    flex-shrink: 0;
    width: 60px;
}

.auto-color-preview {
    flex-shrink: 0;
    width: 60px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.gradient-preview {
    background: linear-gradient(
        to right,
        hsl(0, 70%, 55%),
        hsl(60, 70%, 55%),
        hsl(120, 70%, 55%),
        hsl(180, 70%, 55%),
        hsl(240, 70%, 55%),
        hsl(300, 70%, 55%),
        hsl(360, 70%, 55%)
    );
}
