:root {
    --primary-color: #6C8E7F;
    --primary-dark: #5a7a6d;
    --primary-light: #8fa89d;
    --secondary-color: #d4b483;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Budget fallback styles */
.budget-fallback {
    display: none;
}

/* Hide budget amounts and labels in summary stats */
.budget-report-container .summary-stats,
.summary-stats .budget-amount,
.summary-stats .budget-label {
    display: none;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f9f9f9;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    box-shadow: var(--shadow);
}

/* Header Styles */
.app-header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.app-header h1 {
    margin-bottom: 1rem;
    font-weight: 300;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Main Content */
#app {
    flex: 1;
    padding: 2rem;
    position: relative;
    min-height: 400px;
}

/* Loading State */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Summary Cards Grid */
.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.summary-card .amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.summary-card .label {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Make first summary card label bold */
.summary-cards-grid .summary-card:first-child .label {
    font-weight: 700;
}

/* Sort controls */
.sort-controls {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sort-controls span {
    margin-right: 10px;
    font-weight: 500;
    color: #495057;
}

.sort-btn {
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
}

.sort-btn:hover {
    background: #dee2e6;
}

.sort-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

/* Department cards */
.department-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.department-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.department-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.department-card h3 {
    margin: 0 0 15px 0;
    color: var(--primary-dark);
    font-size: 1.2em;
}

.budget-total {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: center;
}

.budget-total span {
    display: block;
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 5px;
}

.budget-total strong {
    font-size: 1.5em;
    color: #2c3e50;
}

.budget-breakdown {
    font-size: 0.9em;
}

.budget-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.budget-row:last-child {
    border-bottom: none;
}
.budget-row span:first-child {
    color: #666;
}

.budget-row span:last-child {
    font-weight: 500;
}

.budget-table th,
.budget-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.budget-table th {
    background-color: var(--light-gray);
    color: var(--primary-color);
    font-weight: 600;
}

.budget-table tr:nth-child(even) {
    background-color: var(--light-gray);
}

/* Footer */

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        box-shadow: none;
    }
    
    #app {
        padding: 1rem;
    }
    
    .department-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart Container */
.chart-container {
    position: relative;
    margin: 2rem 0;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.chart-wrapper {
    width: 100%;
    text-align: center;
}

.chart-wrapper img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Department Detail Page */
.department-detail {
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.department-detail .department-content {
    width: 100%;
    overflow: hidden;
}

/* Department Description Formatting */
.dept-description {
    background-color: var(--light-gray);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.dept-description h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.dept-description p {
    line-height: 1.6;
    margin-bottom: 1rem;
    text-align: justify;
}

.department-detail table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.department-detail th,
.department-detail td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.department-detail th {
    background-color: var(--light-gray);
    font-weight: 600;
}

/* Back Button */
.back-button {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.back-button:hover {
    text-decoration: underline;
}

/* Department Header */
.department-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.department-header h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.summary-card .amount {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.summary-card .label {
    color: #666;
    font-size: 0.9rem;
}

/* Override for department page embedded styles */
.budget-amount {
    color: var(--primary-color) !important;
}

/* Removed override - using light gray background for better readability */
