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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
}


h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 10px;
}

.subtitle {
    opacity: 0.9;
    font-size: 16px;
}

.filters {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 20px;
    align-items: end;
}

@media (max-width: 768px) {
    .filter-group {
        grid-template-columns: 1fr;
    }
}

.filter-item {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a5568;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select, input {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
}

select:focus, input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid transparent;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 47px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.loading {
    text-align: center;
    padding: 60px;
    font-size: 18px;
    color: #718096;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

.results {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.allocation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.allocation-title {
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
}

.allocation-badge {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 18px;
}

.allocation-ok {
    background: #c6f6d5;
    color: #22543d;
}

.allocation-full {
    background: #fef5e7;
    color: #975a16;
}

.allocation-over {
    background: #fed7d7;
    color: #742a2a;
}

.allocation-under {
    background: #bee3f8;
    color: #2c5282;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.info-card {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-label {
    font-size: 12px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.project-list, .category-list {
    list-style: none;
}

.project-item, .category-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f7fafc;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.project-item:hover, .category-item:hover {
    transform: translateX(5px);
    background: #edf2f7;
}

.project-name, .category-name {
    flex: 1;
    color: #2d3748;
    font-size: 14px;
}

.project-allocation, .category-allocation {
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
    margin-left: 15px;
}

.progress-bar {
    width: 100px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-left: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
}

.error {
    background: #fed7d7;
    color: #742a2a;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #fc8181;
}

.no-data {
    text-align: center;
    padding: 60px;
    color: #718096;
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    padding: 2px 4px;
    border-radius: 4px;
}

.sortable-header:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sort-indicator {
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.5;
}

.sort-indicator.active {
    opacity: 1;
}
