* {
    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;
}

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

header {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

header h2 {
    font-size: 1.3em;
    font-weight: 300;
}

.controls {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.control-group {
    flex: 1;
    min-width: 200px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: #0066cc;
}

.control-group select[multiple] {
    min-height: 100px;
}

.control-group button {
    padding: 12px 24px;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-right: 10px;
    margin-bottom: 5px;
    transition: background-color 0.3s;
}

.control-group button:hover {
    background-color: #0052a3;
}

.control-group button:active {
    transform: translateY(1px);
}

.control-group button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

#export-csv-btn {
    background-color: #28a745;
}

#export-csv-btn:hover {
    background-color: #218838;
}

#clear-cache-btn {
    background-color: #6c757d;
}

#clear-cache-btn:hover {
    background-color: #5a6268;
}

.loading {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.status-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: grid;
    gap: 8px;
    color: #475569;
    font-size: 0.95em;
}

.status-panel div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-panel div::before {
    content: '•';
    color: #0066cc;
    font-weight: bold;
}

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

.summary h3 {
    color: #0066cc;
    margin-bottom: 15px;
    font-size: 1.5em;
}

#summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid #0066cc;
}

.summary-card h4 {
    color: #555;
    font-size: 0.9em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.summary-card .value {
    font-size: 2em;
    font-weight: bold;
    color: #0066cc;
}

.summary-card .unit {
    font-size: 0.8em;
    color: #777;
    margin-left: 5px;
}

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

.data-view h3 {
    color: #0066cc;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.view-toggle {
    margin-bottom: 20px;
}

.view-toggle button {
    padding: 10px 20px;
    background-color: #e9ecef;
    color: #333;
    border: none;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
    border-radius: 4px;
    transition: all 0.3s;
}

.view-toggle button.active {
    background-color: #0066cc;
    color: white;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

thead {
    background-color: #0066cc;
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    position: relative;
}

th[role="button"]::after {
    content: ' ↕';
    font-size: 0.8em;
    opacity: 0.5;
}

th[role="button"][aria-sort="ascending"]::after {
    content: ' ↑';
    opacity: 1;
}

th[role="button"][aria-sort="descending"]::after {
    content: ' ↓';
    opacity: 1;
}

th[role="button"]:hover {
    background-color: #0052a3;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:nth-child(even) {
    background-color: #fafafa;
}

#chart-container {
    min-height: 400px;
    padding: 20px;
}

.yearly-totals {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.yearly-totals h3 {
    color: #0066cc;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.yearly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.year-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.year-card h4 {
    color: #555;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.year-card .total {
    font-size: 1.5em;
    font-weight: bold;
    color: #28a745;
}

.year-card .unit {
    font-size: 0.8em;
    color: #777;
    margin-left: 5px;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    
    .control-group {
        min-width: 100%;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    header h2 {
        font-size: 1em;
    }
}
