/* =========================================
   1. CORE CONTAINER OVERRIDES (Fixes Visibility)
   ========================================= */
#of-spa-root {
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    z-index: 99999 !important;
    background-color: var(--of-bg);
}

/* The Main App Shell */
.of-dashboard-shell {
    display: flex !important;
    flex-direction: column !important; /* Default: Vertical Stack */
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important; /* Prevent double scrollbars */
    background: var(--of-bg);
    color: var(--of-text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =========================================
   2. THEME VARIABLES
   ========================================= */
:root {
    --of-bg: #FFFFFF;
    --of-text-main: #111827;
    --of-text-muted: #6B7280;
    --of-border: #E5E7EB;
    --of-primary: #4F46E5;
    --of-primary-bg: #EEF2FF;
}

/* =========================================
   3. COMPONENT STYLES
   ========================================= */

/* Header */
.of-dashboard-header {
    padding: 20px;
    border-bottom: 1px solid var(--of-border);
    flex-shrink: 0; /* Prevent header from shrinking */
}
.of-brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--of-text-main);
}

/* Navigation Container */
.of-nav-container {
    flex-shrink: 0; /* Don't let nav shrink to 0 */
    overflow-y: auto;
    padding: 16px;
    border-bottom: 1px solid var(--of-border);
    max-height: 300px; /* Limit nav height on mobile so content is visible */
}

/* Nav List */
.of-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Nav Buttons */
.of-nav-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--of-text-muted);
    transition: all 0.2s ease;
}
.of-nav-btn:hover {
    background-color: #F3F4F6;
    color: var(--of-text-main);
}
.of-nav-btn.active {
    background-color: var(--of-primary-bg);
    color: var(--of-primary);
    font-weight: 600;
}
.of-nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.of-nav-icon svg { width: 100%; height: 100%; }

/* Main Content Area (The Fix for Empty Space) */
.of-view-wrapper {
    flex-grow: 1; /* Take up all remaining space */
    height: 100%;
    overflow-y: auto; /* Allow content to scroll */
    padding: 24px;
    background-color: #F9FAFB; 
    min-height: 0; /* Vital for nested flex scrolling */
    display: block !important; /* Ensure visibility */
}

/* Footer */
.of-user-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--of-border);
    background: #F9FAFB;
    flex-shrink: 0;
}
.of-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}
.of-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E0E7FF;
    object-fit: cover;
}
.of-user-details {
    display: flex;
    flex-direction: column;
}
.of-user-name { font-size: 0.9rem; font-weight: 600; color: var(--of-text-main); }
.of-user-email { font-size: 0.75rem; color: var(--of-text-muted); }


/* =========================================
   4. DESKTOP LAYOUT (Side-by-Side)
   ========================================= */
@media (min-width: 768px) {
    /* On Desktop, force full height usage */
    .of-dashboard-shell {
       height: 100vh !important; 
    }
    
    .of-nav-container {
        max-height: none; /* Remove mobile height limit */
        border-bottom: none;
        border-right: 1px solid var(--of-border); 
    }
}

/* =========================================
   5. STAT CARDS & GRIDS
   ========================================= */
.of-grid-3 {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
}
@media (min-width: 600px) {
    .of-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.of-grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (min-width: 600px) {
    .of-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Card Styles */
.of-stat-card { background: #FFF; border: 1px solid var(--of-border); border-radius: 12px; padding: 16px; }
.of-stat-header { display: flex; justify-content: space-between; margin-bottom: 16px; }
.of-stat-value { font-size: 1.5rem; font-weight: 700; margin: 0; }
.of-stat-icon-bg { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.of-stat-icon-bg.positive { background: #ECFDF5; color: #10B981; } 
.of-stat-icon-bg.brand    { background: #EEF2FF; color: #4F46E5; }
.of-stat-badge { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.of-stat-badge.positive { color: #10B981; background: #ECFDF5; }
.of-stat-badge.brand    { color: #4F46E5; background: #EEF2FF; }
.of-stat-body { display: flex; flex-direction: column; }
.of-stat-label { font-size: 0.85rem; color: var(--of-text-muted); margin-bottom: 4px; }

/* Action Buttons */
.of-action-btn { background: #FFF; border: 1px solid var(--of-border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; transition: all 0.2s ease; }
.of-action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); border-color: var(--of-primary); }
.of-action-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #FFF; }
.of-action-icon.blue { background: #3B82F6; }
.of-action-icon.purple { background: #8B5CF6; }
.of-action-icon.green { background: #10B981; }
.of-action-icon.orange { background: #F59E0B; }
.of-action-label { font-size: 0.9rem; font-weight: 600; color: var(--of-text-main); }

/* Activity List */
.of-activity-list { background: #FFF; border: 1px solid var(--of-border); border-radius: 12px; }
.of-activity-item { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--of-border); }
.of-activity-item:last-child { border-bottom: none; }
.of-activity-icon-box { width: 32px; height: 32px; background: #EFF6FF; color: #3B82F6; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 16px; }
.of-activity-details { flex-grow: 1; display: flex; flex-direction: column; }
.of-activity-name { font-size: 0.9rem; font-weight: 500; color: var(--of-text-main); }
.of-activity-time { font-size: 0.75rem; color: var(--of-text-muted); }
.of-activity-amount { font-weight: 600; color: #10B981; }