/* CSS Variables - Following target_matrix_select.css pattern */
:root {
    --black: #0a0a0a;
    --black-soft: #1a1a1a;
    --titanium: #3d4451;
    --titanium-light: #565d6d;
    --titanium-dark: #2a2e38;
    --gold: #875806;
    --gold-light: #f4d03f;
    --gold-dark: #b8941f;
    --white: #ffffff;
    --white-soft: #f5f5f5;
    --shadow-gold: rgba(179, 206, 229, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.5);
}

/* Modern Dashboard Styles */
.dashboard-container {
    min-height: 100vh;
    padding: 0.75rem 0.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Clickable card header styles */
.card-header[style*="cursor: pointer"] {
    transition: all 0.3s ease;
    position: relative;
}

.card-header[style*="cursor: pointer"]:hover {
    background-color: rgba(0, 123, 255, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-header[style*="cursor: pointer"]::after {
    content: '\f061'; /* FontAwesome arrow-right icon code */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    color: var(--primary-color, #b8941f);
}

.card-header[style*="cursor: pointer"]:hover::after {
    opacity: 1;
}

/* Header Styles */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-title h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    background: linear-gradient(135deg, #875806, #875806);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #718096;
    margin: 0.4rem 0 0 0;
    font-size: 1rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Filter Styles */
.filters-form {
    display: flex;
    gap: 0.75rem;
}

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

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

.filter-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.8rem;
}

.filter-select {
    padding: 0.6rem 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    min-width: 130px;
}

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

/* Toggle Switch Styles */
.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-checkbox {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.toggle-text {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.8rem;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 24px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.filter-checkbox:checked + .toggle-label .toggle-switch {
    background: #875806;
}

.filter-checkbox:checked + .toggle-label .toggle-slider {
    transform: translateX(20px);
}

.toggle-label:hover .toggle-switch {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Action Buttons - Following target_matrix_select.css pattern */
.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    white-space: nowrap;
    line-height: 1.6;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(179, 206, 229, 0.1), transparent);
    transition: left 0.5s ease;
    z-index: 0;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--white);
    border: 2px solid var(--gold);
    color: var(--black);
}

.btn-primary:hover {
    background: var(--gold);
    color: var(--black);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-gold);
}

.btn-primary .btn-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.btn-outline-secondary,
.btn-secondary {
    background: linear-gradient(135deg, var(--titanium-dark) 0%, var(--black-soft) 100%);
    border: 2px solid var(--titanium);
    color: var(--white);
}

.btn-outline-secondary:hover,
.btn-secondary:hover {
    background: linear-gradient(135deg, var(--black-soft) 0%, var(--titanium-dark) 100%);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-dark), 0 0 20px var(--shadow-gold);
}

.btn-outline-secondary .btn-content,
.btn-secondary .btn-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
}

.btn i {
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
}

.btn span,
.btn .btn-text {
    position: relative;
    z-index: 1;
}

/* Operations Grid */
.operations-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Operation Card */
.operation-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.operation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #f7fafc;
}

.operation-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.operation-icon {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #875806, #875806);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
}

.operation-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.operation-type {
    color: #718096;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-badge {
    background: linear-gradient(135deg, #875806, #875806);
    color: white;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    text-align: center;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.stat-number {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.stat-badge .stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    opacity: 1;
    line-height: 1;
}

.stat-item .stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #875806;
    opacity: 0.9;
    line-height: 1;
}

/* Units Grid */
.units-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Departments Grid */
.departments-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.department-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    padding: 0.75rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.department-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #f7fafc;
}

.department-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.department-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #875806, #875806);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.department-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.department-type {
    color: #718096;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.department-meta {
    display: flex;
    align-items: center;
}

.unit-section {
    background: rgba(248, 250, 252, 0.8);
    border-radius: 12px;
    padding: 0.6rem;
}

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

.unit-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.unit-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.unit-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.unit-type {
    color: #718096;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.goals-count {
    background: rgba(102, 126, 234, 0.1);
    color: #875806;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.6rem;
}

/* Goal Card */
.goal-card {
    background: white;
    border-radius: 12px;
    padding: 0.6rem;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 260px;
}

.goal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.6rem;
    flex-shrink: 0;
}

.goal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.2rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.goal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.2rem;
}

.goal-department {
    margin-top: 0.2rem;
}

.department-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.4rem;
    background: rgba(99, 179, 237, 0.1);
    color: #63b3ed;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.department-badge i {
    font-size: 0.6rem;
    margin-right: 0.15rem;
}

.badge {
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-period {
    background: rgba(102, 126, 234, 0.1);
    color: #875806;
}

.badge-unit {
    background: rgba(24, 46, 111, 0.1);
    color: #875806;
}

.badge-status-active {
    background: rgba(72, 187, 120, 0.1);
    color: #48bb78;
}

.badge-status-completed {
    background: rgba(56, 178, 172, 0.1);
    color: #38b2ac;
}

.badge-status-inactive {
    background: rgba(113, 128, 150, 0.1);
    color: #718096;
}

.goal-link {
    color: #875806;
    text-decoration: none;
    padding: 0.3rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.goal-link:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.6rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    flex-shrink: 0;
}

.stat-item {
    background: #f7fafc;
    padding: 0.25rem;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.stat-completed {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1), rgba(56, 161, 105, 0.1));
}

.stat-completed.stat-negative {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(231, 76, 60, 0.1));
}

.stat-active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.stat-active.stat-negative {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(231, 76, 60, 0.1));
}

.stat-progress {
    background: linear-gradient(135deg, rgba(24, 46, 111, 0.1), rgba(179, 206, 229, 0.1));
}

.stat-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-label {
    font-size: 0.65rem;
    color: #718096;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-completed .stat-value {
    color: #48bb78;
}

.stat-completed.stat-negative .stat-value {
    color: #dc3545;
}

.stat-active .stat-value {
    color: #875806;
}

.stat-active.stat-negative .stat-value {
    color: #dc3545;
}

.stat-progress .stat-value {
    color: #875806;
}

/* Chart Section */
.chart-section {
    background: #f7fafc;
    border-radius: 10px;
    padding: 0.4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.chart-title-container {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.chart-note {
    font-size: 0.65rem;
    color: #718096;
    font-style: italic;
}

.chart-filter {
    padding: 0.3rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.75rem;
    color: #4a5568;
}

.chart-container {
    height: 140px;
    background: white;
    border-radius: 8px;
    padding: 0.4rem;
    flex: 1;
    min-height: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    max-width: 450px;
    margin: 0 auto;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.empty-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #875806, #875806);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 1.75rem;
}

.empty-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.75rem;
}

.empty-description {
    color: #718096;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Additional optimizations for better space utilization */
.operation-card {
    position: relative;
    overflow: hidden;
}

.operation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #875806, #875806);
    border-radius: 16px 16px 0 0;
}

.department-section {
    position: relative;
    overflow: hidden;
}

.department-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #875806, #875806);
    border-radius: 14px 14px 0 0;
}

.unit-section {
    position: relative;
    overflow: hidden;
}

.unit-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    border-radius: 12px 12px 0 0;
}

/* Compact layout for better space utilization */
@media (min-width: 1200px) {
    .goals-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 0.5rem;
    }
    
    .goal-card {
        min-height: 240px;
        padding: 0.5rem;
    }
    
    .chart-container {
        height: 120px;
    }
}

@media (min-width: 1400px) {
    .goals-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 0.4rem;
    }
    
    .goal-card {
        min-height: 220px;
        padding: 0.5rem;
    }
    
    .chart-container {
        height: 110px;
    }
}

/* Enhanced hover effects for better user experience */
.goal-card {
    position: relative;
    overflow: hidden;
}

.goal-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.goal-card:hover::after {
    left: 100%;
}

/* Improved loading states */
.chart-container {
    position: relative;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #875806;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container.loading::before {
    opacity: 1;
}

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

/* Better responsive behavior */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 0.5rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .goals-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .operation-header,
    .unit-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .department-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    /* Mobile optimizations for goal cards */
    .goal-card {
        min-height: 200px;
        padding: 0.5rem;
    }
    
    .goal-title {
        font-size: 0.85rem;
        line-height: 1.2;
        margin-bottom: 0.2rem;
    }
    
    .goal-badges {
        gap: 0.2rem;
        margin-top: 0.2rem;
    }
    
    .badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.65rem;
    }
    
    .stat-item {
        padding: 0.25rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
        margin-bottom: 0.05rem;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .chart-container {
        height: 120px;
        padding: 0.3rem;
    }
    
    .operation-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .operation-title {
        font-size: 1.25rem;
    }
    
    .department-icon {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }
    
    .department-title {
        font-size: 1.125rem;
    }
    
    .unit-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .unit-title {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .dashboard-container {
        padding: 0.25rem;
    }
    
    .header-title h1 {
        font-size: 1.75rem;
    }
    
    .goals-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .goal-card {
        min-height: 180px;
        padding: 0.4rem;
    }
    
    .goal-title {
        font-size: 0.8rem;
        line-height: 1.1;
        margin-bottom: 0.15rem;
    }
    
    .badge {
        padding: 0.1rem 0.3rem;
        font-size: 0.6rem;
    }
    
    .stat-item {
        padding: 0.2rem;
    }
    
    .stat-value {
        font-size: 0.75rem;
        margin-bottom: 0.05rem;
    }
    
    .stat-label {
        font-size: 0.55rem;
    }
    
    .chart-container {
        height: 100px;
        padding: 0.25rem;
    }
    
    .operation-icon {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }
    
    .operation-title {
        font-size: 1.125rem;
    }
    
    .department-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .department-title {
        font-size: 1rem;
    }
    
    .unit-icon {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .unit-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding: 0.25rem;
    }
    
    .header-title h1 {
        font-size: 1.5rem;
    }
    
    .goals-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .goal-card {
        min-height: 200px;
        padding: 0.5rem;
    }
    
    .goal-title {
        font-size: 0.85rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .goal-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .chart-container {
        height: 120px;
    }
}

/* --- COMPACT SECTION & SUBSECTION STYLES --- */
.operation-card,
.department-section,
.unit-section {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 0.75rem;
    border-radius: 10px;
}

.operation-card::before {
    height: 2px;
    border-radius: 10px 10px 0 0;
}
.department-section::before {
    height: 2px;
    border-radius: 10px 10px 0 0;
}
.unit-section::before {
    height: 2px;
    border-radius: 10px 10px 0 0;
}

.operation-header,
.department-header,
.unit-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.2rem;
    border-bottom: none;
    gap: 0.5rem;
}

.operation-icon, .department-icon, .unit-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 8px;
}

.operation-title, .department-title, .unit-title {
    font-size: 1rem;
    margin-bottom: 0;
}

.operation-type, .department-type, .unit-type {
    font-size: 0.7rem;
    letter-spacing: 0.2px;
    margin-top: 0.1rem;
}

.stat-badge, .goals-count {
    padding: 0.18rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 6px;
    margin-top: 0.1rem;
    margin-bottom: 0.1rem;
}

.stat-badge {
    min-width: 60px;
}

.goals-count {
    min-width: 50px;
}

.badge {
    padding: 0.08rem 0.3rem;
    font-size: 0.6rem;
    border-radius: 6px;
}

/* Remove extra whitespace between sections */
.operations-grid, .departments-grid, .units-grid {
    gap: 0.5rem;
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    .operation-card, .department-section, .unit-section {
        margin-bottom: 0.3rem;
        padding: 0.3rem 0.5rem 0.3rem 0.5rem;
        border-radius: 8px;
    }
    .operation-header, .department-header, .unit-header {
        margin-bottom: 0.3rem;
        gap: 0.3rem;
    }
    .operation-icon, .department-icon, .unit-icon {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        border-radius: 6px;
    }
    .operation-title, .department-title, .unit-title {
        font-size: 0.92rem;
    }
    .operation-type, .department-type, .unit-type {
        font-size: 0.6rem;
    }
    .stat-badge, .goals-count {
        padding: 0.12rem 0.3rem;
        font-size: 0.6rem;
        border-radius: 5px;
        min-width: 40px;
    }
    .badge {
        padding: 0.05rem 0.2rem;
        font-size: 0.5rem;
        border-radius: 5px;
    }
    .operations-grid, .departments-grid, .units-grid {
        gap: 0.3rem;
    }
}

/* --- HORIZONTAL HEADER LAYOUT --- */
.operation-header, .department-header, .unit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
    padding-bottom: 0;
    border-bottom: none;
}

.operation-info, .department-info, .unit-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.operation-details, .department-details, .unit-details {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.operation-title, .department-title, .unit-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0;
    margin-right: 0.3rem;
}

.operation-type, .department-type, .unit-type {
    font-size: 0.7rem;
    color: #718096;
    margin-bottom: 0;
    margin-right: 0.3rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.stat-badge, .goals-count {
    margin: 0 0 0 0.3rem;
    align-self: center;
    display: inline-flex;
}

/* Remove vertical stacking of badges/subtitles */
.operation-title-section, .department-title-section, .unit-title-section {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* --- MOBILE: Stack only if not enough width --- */
@media (max-width: 768px) {
    .operation-header, .department-header, .unit-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    .operation-details, .department-details, .unit-details {
        flex-direction: row;
        gap: 0.2rem;
    }
    .stat-badge, .goals-count {
        margin-left: 0.2rem;
        font-size: 0.6rem;
    }
    .operation-title, .department-title, .unit-title {
        font-size: 0.92rem;
    }
    .operation-type, .department-type, .unit-type {
        font-size: 0.6rem;
    }
}

/* --- Remove extra vertical space in cards --- */
.operation-card, .department-section, .unit-section {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

/* --- Grouped Goals Container Styles --- */
.grouped-goals-container {
    background: rgba(248, 250, 252, 0.8);
    border-radius: 12px;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
}

.grouped-goals-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.grouped-goals-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #9f7aea, #805ad5);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.grouped-goals-title h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.2rem 0;
}

.grouped-goals-subtitle {
    color: #718096;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grouped-goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.6rem;
}

/* --- Grouped Goal Card Styles --- */
.goal-card.grouped-goal-card {
    grid-column: span 2;
    min-height: 400px;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    border: 2px solid #875806;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.goal-card.grouped-goal-card .goal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.goal-card.grouped-goal-card .chart-container {
    height: 200px;
    margin-top: 1rem;
}

/* --- Units Breakdown Section --- */
.units-breakdown {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(247, 250, 252, 0.8);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.units-breakdown-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.units-breakdown-header h6 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.units-breakdown-header h6::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #875806, #875806);
    border-radius: 2px;
}

.units-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unit-breakdown-item {
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.unit-breakdown-item:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.unit-breakdown-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
}

.unit-breakdown-name i {
    color: #875806;
    font-size: 0.85rem;
}

.unit-breakdown-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f7fafc;
}

.unit-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem;
    background: rgba(247, 250, 252, 0.5);
    border-radius: 6px;
}

.unit-stat-label {
    font-size: 0.65rem;
    color: #718096;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.unit-stat-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2d3748;
}

/* Responsive adjustments for grouped cards */
@media (max-width: 1200px) {
    .goal-card.grouped-goal-card {
        grid-column: span 1;
    }
    
    .unit-breakdown-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .goal-card.grouped-goal-card {
        min-height: 350px;
        padding: 0.75rem;
    }
    
    .goal-card.grouped-goal-card .chart-container {
        height: 180px;
    }
    
    .units-breakdown {
        padding: 0.75rem;
    }
    
    .unit-breakdown-stats {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    
    .unit-stat {
        flex-direction: row;
        justify-content: space-between;
        padding: 0.5rem;
    }
}

/* --- Chart Modal Styles --- */
.chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.chart-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.chart-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

.chart-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.chart-modal.active .chart-modal-content {
    transform: scale(1);
}

.chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #f7fafc;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.chart-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.chart-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.chart-modal-close:hover {
    background: rgba(113, 128, 150, 0.1);
    color: #2d3748;
    transform: rotate(90deg);
}

.chart-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.chart-modal-stats {
    margin-bottom: 2rem;
}

.chart-modal-stats .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.chart-modal-stats .stat-item {
    padding: 1rem;
    background: #f7fafc;
    border-radius: 12px;
}

.chart-modal-stats .stat-value {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.chart-modal-stats .stat-label {
    font-size: 0.75rem;
}

.chart-modal-chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    height: 500px;
    position: relative;
}

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

/* Make goal cards clickable */
.goal-card {
    cursor: pointer;
    user-select: none;
}

.goal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* Responsive modal */
@media (max-width: 768px) {
    .chart-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .chart-modal-header {
        padding: 1rem 1.5rem;
    }
    
    .chart-modal-title {
        font-size: 1.25rem;
    }
    
    .chart-modal-body {
        padding: 1.5rem;
    }
    
    .chart-modal-stats .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .chart-modal-chart-container {
        height: 350px;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .chart-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chart-modal-header {
        padding: 1rem;
    }
    
    .chart-modal-body {
        padding: 1rem;
    }
    
    .chart-modal-chart-container {
        height: 300px;
        padding: 0.75rem;
    }
}
