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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #2d3748;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: none;
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header {
    text-align: center;
    padding: 2rem 0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    color: #4a5568;
}

.controls {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 1.5rem;
    align-items: center;
}

.upload-section {
    display: flex;
    gap: 1rem;
    flex-direction: column;
}

.upload-btn {
    background: #2b6cb0;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    display: inline-block;
}

.upload-btn:hover {
    background: #2c5282;
    transform: translateY(-2px);
}

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #2b6cb0;
    color: white;
}

.btn-secondary {
    background: #edf2f7;
    color: #2d3748;
    border: 2px solid #e2e8f0;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-filter-section {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box input {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #2b6cb0;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.375rem;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: border-color 0.3s ease;
}

.filters select:focus {
    outline: none;
    border-color: #2b6cb0;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
}

.card h3 {
    font-size: 0.875rem;
    color: #718096;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card span {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    height: 400px;
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-container canvas {
    max-height: 100%;
}

.table-section {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    flex-grow: 1;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-header h3 {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
}

.table-controls span {
    color: #718096;
    font-size: 0.875rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

th {
    background: #2b6cb0;
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 1px solid #e2e8f0;
}

th:nth-child(4), th:nth-child(5), th:nth-child(6),
th:nth-child(9), th:nth-child(10), th:nth-child(11) {
    text-align: center;
    background: #4a90e2;
}

th:nth-child(7), th:nth-child(8), th:nth-child(9) {
    text-align: center;
    background: #e0f7fa;
    color: #2d3748;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.3s ease;
    text-align: center;
    border-right: 1px solid #e2e8f0;
}

td:first-child, td:nth-child(2), td:nth-child(3) {
    text-align: left;
}

td:nth-child(4), td:nth-child(5), td:nth-child(6),
td:nth-child(9), td:nth-child(10), td:nth-child(11) {
    background: #f0f8ff;
}

td:nth-child(7), td:nth-child(8), td:nth-child(9) {
    background: #e0f7fa;
}

.comparison {
    font-weight: bold;
}

.comparison:nth-child(7) {
    background-color: #d3d3d3; /* Gray for Mins Inc/Dec */
}

.comparison:nth-child(8) {
    background-color: #ffcc80; /* Light Orange for Mins Inc/Dec % */
}

.comparison:nth-child(9) {
    background-color: #c8e6c9; /* Light Green for Margin Inc/Dec */
}

.positive-change {
    color: #2ecc71;
    font-weight: 600;
}

.negative-change {
    color: #e74c3c;
    font-weight: 600;
}

.neutral-change {
    color: #718096;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #edf2f7;
    border-top: 5px solid #2b6cb0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    font-size: 1.1rem;
}

@media (max-width: 1200px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .controls {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .search-filter-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        max-width: none;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filters select {
        width: 100%;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .card span {
        font-size: 1.25rem;
    }
    
    .table-container {
        font-size: 0.75rem;
    }
}
