/* =========================================
   HUB COMPONENT STYLES
   (Widgets, Tool Cards, Project Lists, Hub View)
   ========================================= */

/* --- HEADER REDESIGN (Overrides dashboard.css) --- */
.dashboard-header {
    display: grid; 
    grid-template-columns: 220px 1fr 220px;
    gap: 2rem;
    align-content: center;
    /* align-items: center; */
    padding: 1.5rem 2.5rem;
    height: 80px; 
    min-height: 80px;
    
    /* Fixed Positioning */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--panel);
    border-bottom: 1px solid var(--edge);
}

/* Layout Offsets */
.dashboard-layout {
    margin-top: 80px; /* Header Height */
}
.dashboard-sidebar {
    top: 80px !important;
    height: fit-content;
    max-height: 80vh;
    scrollbar-width: none;
}
@media (max-width: 900px) {
    .dashboard-layout {
        margin-top: 0; /* Reset for mobile if header not fixed or different */
        padding-top: 80px;
    }
}

/* NO SIDEBAR MODE */
body.no-sidebar .dashboard-sidebar {
    display: none !important;
}
body.no-sidebar .dashboard-layout {
    grid-template-columns: 1fr !important;
    padding-left: 2rem;
    padding-right: 2rem;
    background-color: var(--bg);
}
body.no-sidebar .dashboard-main-panel {
    width: 100%;
    margin: 0 auto;
    max-width: 1400px;
}

/* LEFT: Logo & Context */
.header-left {
    flex-direction: row; 
    align-items: center;
    justify-content: start; 
    gap: 1.5rem;
}
.header-brand {
    display: flex; 
    align-items: center;
}
.header-logo {
    height: 50px; 
    width: auto;
}
.header-divider {
    height: 24px; 
    width: 1px; 
    background-color: var(--edge);
}
.header-context {
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    cursor: auto;
}
.header-context h1 {
    font-size: 1.4rem; 
    font-weight: 700; 
    color: var(--text); 
    margin: 0; 
    white-space: nowrap;
}
.header-chevron {
    color: var(--muted); 
    display: flex; 
    align-items: center;
}

/* CENTER: Search */
.header-center {
    display: flex; 
    justify-content: start; 
    align-items: center;
    width: 100%;
    gap: 2rem;
}
#header-actions {
    display: flex;
    flex-direction:row;
    align-items: center;
    /* gap: 1rem; */
}
.global-search-container {
    position: relative; 
    width: 100%; 
    max-width: 480px;
}
.global-search-input {
    width: 100%; 
    padding: 0.8rem 1rem 0.8rem 2.8rem; 
    border-radius: 8px; 
    border: 1px solid var(--edge); 
    background: var(--bg); 
    color: var(--text); 
    font-size: 1rem; 
    transition: all 0.2s;
}
.global-search-input:focus {
    outline: none; 
    border-color: var(--accent); 
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1); 
    background: #fff;
}
[data-theme="dark"] .global-search-input {
    background: var(--bg-dark);
}
.search-icon {
    position: absolute; 
    left: 10px; 
    top: 50%; 
    transform: translateY(-50%); 
    color: var(--muted); 
    width: 16px; 
    height: 16px; 
    pointer-events: none;
}
.search-shortcut {
    position: absolute; 
    right: 10px; 
    top: 50%; 
    transform: translateY(-50%); 
    font-size: 0.8rem; 
    color: var(--muted); 
    border: 1px solid var(--edge); 
    border-radius: 4px; 
    padding: 2px 6px; 
    background: var(--panel); 
    pointer-events: none;
}

/* RIGHT: Actions & Profile */
.header-right {
    display: flex; 
    justify-content: end; 
    align-items: center; 
    gap: 1rem;
}

.icon-btn-header {
    background: transparent; 
    border: none; 
    color: var(--muted); 
    cursor: pointer; 
    position: relative; 
    padding: 8px; 
    border-radius: 50%; 
    transition: color 0.2s;
}
.icon-btn-header:hover {
    color: var(--text); 
    background: var(--hover-bg);
}
.notification-dot {
    position: absolute; 
    top: 8px; 
    right: 8px; 
    width: 8px; 
    height: 8px; 
    background: #EF4444; 
    border-radius: 50%; 
    border: 2px solid var(--panel);
}

.header-profile-trigger {
    display: flex; 
    align-items: center; 
    gap: 0.8rem; 
    padding: 4px 8px 4px 4px; 
    border-radius: 30px; 
    cursor: pointer; 
    border: 1px solid transparent; 
    transition: all 0.2s;
}
.header-profile-trigger:hover {
    background: var(--hover-bg); 
    border-color: var(--edge);
}
.profile-avatar {
    width: 32px; 
    height: 32px; 
    background: var(--accent); 
    color: #fff; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 0.9rem; 
    font-weight: 700;
}
.profile-info {
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    line-height: 1.1;
}
.profile-name {
    font-size: 0.9rem; 
    font-weight: 600; 
    color: var(--text);
}
.profile-role {
    font-size: 0.75rem; 
    color: var(--muted);
}
.profile-chevron {
    color: var(--muted); 
    margin-left: 4px;
}

/* --- DROPDOWNS --- */
.header-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 280px;
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
    /* padding: 1rem; */
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    /* padding: 2rem; */
    border-bottom: 1px solid var(--edge);
    background: var(--bg);
}
.dropdown-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2rem;
}

.dropdown-user-info {
    padding: 1.2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--edge);
}

.dropdown-content {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: start;
    /* padding-left: 1rem; */
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 1rem;
    border-bottom: 1px solid var(--edge);
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.notification-item:hover {
    background: var(--hover-bg);
}
.notification-item:last-child { border-bottom: none; }
.notif-icon { font-size: 1.2rem; }
.notif-text strong { display: block; font-size: 0.95rem; color: var(--text); margin-bottom: 2px; }
.notif-text p { font-size: 0.85rem; color: var(--muted); margin: 0; line-height: 1.3; }



/* Responsive Headers */
@media (max-width: 900px) {
    .dashboard-header {
        grid-template-columns: auto 1fr auto; 
        height: 70px; 
        padding: 0.5rem 1rem; 
        gap: 0.5rem;
    }

    /* 1. Hamburger */
    .header-left {
        gap: 0.5rem;
        width: auto;
    }
    #mobile-menu-toggle { display: flex !important; }
    /* Hide toggle in "Select Product" view (no sidebar available) */
    body.no-sidebar #mobile-menu-toggle { display: none !important; }
    .header-brand, #header-status-badge, .header-context, .header-divider { display: none !important; }

    /* 2. Global Search */
    .header-center {
        display: flex !important;
        flex: 1;
        justify-content: flex-end; /* Align right next to profile/notif? No, center is Search */
        position: relative;
        gap: 0.5rem;
    }
    .global-search-container {
        display: block !important;
        width: 100%;
        max-width: none;
    }

    /* 3. Header Actions (Dropdown) */
    .mobile-only { display: flex !important; }
    
    #header-actions {
        display: none; /* Hidden by default */
        position: absolute;
        top: 60px;
        right: 0;
        background: var(--panel);
        border: 1px solid var(--edge);
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        z-index: 2000;
        min-width: 200px;
    }
    #header-actions.open {
        display: flex !important;
        animation: slideDown 0.2s ease-out;
    }
    
    /* Ensure text labels are visible in dropdown */
    #header-actions.open .btn span.d-none {
        display: inline !important;
    }
    
    #header-actions.open .btn {
        width: 100%;
        justify-content: flex-start;
        padding: 0.8rem 1rem;
        text-align: left;
    }
    
    /* Hide VR divider in dropdown */
    #header-actions.open .vr {
        display: none !important;
    }

    /* 4. Notif & 5. Profile */
    .header-right {
        gap: 0.5rem;
    }
    .header-profile-trigger .profile-info, 
    .header-profile-trigger .profile-chevron {
        display: none;
    }
    
    /* Sidebar Mobile Fix */
    #tool-sidebar {
        position: fixed;
        left: -100%;
        top: 70px; /* Header Height */
        width: 100%;
        height: calc(100vh - 70px);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1005;
        border-right: none;
        padding-top: 1rem;
    }
    #tool-sidebar.mobile-expanded {
        left: 0 !important;
        height:fit-content;
    }
}

/* Sidebar Collapsed State Fixes */
@media (min-width: 901px) {
    .dashboard-sidebar.collapsed .tools-nav-section {
        display: block !important;
    }
    .dashboard-sidebar.collapsed .tools-list {
        display: block !important;
        max-height: none !important;
    }
    .dashboard-sidebar.collapsed .sidebar-category-header {
        display: none;
    }
    .dashboard-sidebar.collapsed .project-link-item {
        justify-content: center;
        padding: 0.8rem 0;
        font-size: 0;
    }
    .dashboard-sidebar.collapsed .project-link-item .tool-icon-mini {
        margin-right: 0 !important;
        opacity: 1 !important;
    }
    .dashboard-sidebar.collapsed .project-link-item svg {
        width: 24px;
        height: 24px;
    }
}

#view-overview, #view-reports, #view-assets {
    padding: 2rem;
}
/* --- 5. DASHBOARD WIDGETS & CHARTS --- */
.kpi-grid { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.kpi-grid > * { flex: 1; min-width: 220px; }
.kpi-card {
    background: var(--panel); padding: 1.5rem; border: 1px solid var(--edge);
    border-radius: 12px; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}
.kpi-label { font-size: 1.1rem; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-bottom: 0.5rem; }
.kpi-value { font-size: 2.4rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; font-family: var(--font-display); }
.kpi-sub { font-size: 1.1rem; color: var(--muted); margin-top: 0.2rem; }


#portfolio-summary-banner .kpi-card {
    width: 90%;
    padding: 2rem;
}

.dashboard-split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.dashboard-split-layout.split-1-3 { grid-template-columns: 1fr 2.5fr; }
.dashboard-split-layout.split-3-cols { grid-template-columns: 1fr 1fr 1fr; }

.content-card {
    background: var(--panel); border: 1px solid var(--edge); border-radius: 12px;
    padding: 2rem; box-shadow: var(--shadow-sm); height: auto;
}
.card-header-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; border-bottom: 1px solid var(--edge); padding-bottom: 1rem;
}
.card-header-row h3 {
    font-size: 1.7rem;
}
.badge-count {
    background: var(--bg-hover);
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid var(--edge);
}
.mb-4 { margin-bottom: 2rem; }
.mt-4 { margin-top: 2rem; }

.chart-container-wrapper { position: relative; height: 320px; width: 100%; }
canvas#dashboardWaterfallChart { width: 100% !important; height: 320px !important; }
canvas#dashboardPieChart { width: 100% !important; height: 200px !important; max-height: 200px; }
.chart-placeholder-area {
    background: var(--bg); border: 2px dashed var(--edge-strong); border-radius: 8px;
    height: 320px; display: flex; align-items: center; justify-content: center;
}

.simple-list li { padding: 0.8rem 1rem; border-bottom: 1px solid var(--edge); font-size: 1.6rem; color: var(--text); }
.empty-list-item { color: var(--muted); font-style: italic; text-align: center; padding: 1rem; }

/* SCROLLABLE LISTS */
.dashboard-card .card-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 320px; /* Approx 5 items height */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar Styling for Webkit */
.dashboard-card .card-content ul::-webkit-scrollbar {
    width: 6px;
}
.dashboard-card .card-content ul::-webkit-scrollbar-track {
    background: transparent;
}
.dashboard-card .card-content ul::-webkit-scrollbar-thumb {
    background-color: var(--edge);
    border-radius: 10px;
}
.rich-list { list-style: none; padding: 0; margin: 0; }
.rich-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 0; border-bottom: 1px solid var(--edge); cursor: pointer; transition: background 0.2s;
}
.rich-item:hover { background: var(--bg); padding-left: 0.5rem; padding-right: 0.5rem; }
.rich-list.full-width-list .rich-item {
    padding: 1.2rem; border: 1px solid var(--edge); border-radius: 8px;
    margin-bottom: 0.8rem; background: var(--bg);
}
.rich-list.full-width-list .rich-item:hover {
    background: var(--panel); border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px);
}

.item-main { display: flex; flex-direction: column; }
.item-title { font-weight: 700; font-size: 1.3rem; color: var(--text); display: block; }
.item-sub { font-size: 1.1rem; color: var(--muted); }
.item-status { font-size: 1rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 99px; text-transform: uppercase; }
.status-green { background: #DCFCE7; color: #166534; }
.status-blue { background: #E0F2FE; color: #0369A1; }
.status-gray { background: #F1F5F9; color: #64748B; }

.run-item {
    padding: 1rem; border-bottom: 1px solid var(--edge); cursor: pointer;
    transition: all 0.2s ease; border-radius: 6px; margin-bottom: 4px;
    border-left: 3px solid transparent; position: relative; overflow: hidden;
    display: flex; justify-content: space-between; align-items: center;
}
.run-item:hover { background-color: var(--bg); }
.run-item.active { background-color: var(--fep-bg); border-left-color: var(--accent); }
.run-item.active .run-item-title { color: var(--accent-dark) !important; font-weight: 700; }

/* Realized/Active Model Item */
.run-item-realized {
    background-color: var(--fep-bg);
    border-left-color: var(--accent);
    padding-left: 1.5rem; /* Increased padding as requested */
}
.run-item-realized .run-item-title {
    color: var(--accent-dark) !important;
    font-weight: 700;
}

.dashboard-table { width: 100%; border-collapse: collapse; font-size: 1.5rem; }
.dashboard-table th {
    text-align: left; color: var(--muted); font-weight: 700;
    padding: 0.8rem 0.5rem; border-bottom: 1px solid var(--edge);
    font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.dashboard-table td { padding: 1rem 0.5rem; border-bottom: 1px solid var(--edge); color: var(--text); vertical-align: middle; }
.dashboard-table .small { font-size: 1.3rem !important; }
.dashboard-table .text-right { text-align: right; }
.dashboard-table .text-center { text-align: center; }
.dashboard-table .text-muted { color: var(--muted); }
.dashboard-table .text-success { color: #16A34A; font-weight: 700; }
.dashboard-table .text-danger { color: #DC2626; font-weight: 700; }
.dashboard-table tr:last-child td { border-bottom: none; }
.text-success {
    text-align: right !important;
}

/* --- 6. TOOL CARDS & GRID (Generic) --- */
.category-title {
    font-size: 1.8rem; color: var(--muted); margin-bottom: 1.6rem;
    padding-bottom: 0.8rem; border-bottom: 1px solid var(--edge);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.tools-grid { display: flex; flex-wrap: wrap; gap: 2.4rem; }
.tools-grid > * { flex: 1; min-width: 250px; margin-bottom: 2rem; }
.tool-card {
    background: var(--panel); border: 1px solid var(--edge); border-radius: 12px;
    padding: 2.8rem; display: flex; flex-direction: column; min-height: 100%; max-width: 300px;
    position: relative; overflow: hidden; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-sm);
}
.tool-card .tool-header { display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.tool-icon {
    width: 52px; height: 52px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; background: var(--bg); color: var(--muted);
}
.tool-body { flex: 1; }
.tool-body h3 { font-size: 1.8rem; margin-bottom: 0.8rem; }
.tool-body p { font-size: 1.4rem; color: var(--muted); line-height: 1.5; margin-bottom: 2rem; }
.status-badge { font-size: 1.1rem; font-weight: 700; padding: 0.3rem 0.8rem; border-radius: 99px; text-transform: uppercase; }
.status-badge.active { background: #DCFCE7; color: #16A34A; }

.tool-card.inactive { border-left: 5px solid var(--locked-gray); opacity: 0.7; }
.tool-card.inactive:hover { transform: none; box-shadow: none; border-color: var(--edge); cursor: not-allowed; }

/* Finance Card (Keeping in Hub as generic tool) */
.finance-card { --card-color: #0d9488; --card-bg: #f0fdfa; --btn-hover: #0f766e; --shadow-color: rgba(13, 148, 136, 0.15); --grad-end: #2dd4bf; }
.finance-card { border-left: 5px solid var(--card-color); }
.finance-card .tool-icon { background: var(--card-bg); color: var(--card-color); }
.finance-card .btn.primary { background: var(--card-color); color: #fff; }
.finance-card .btn.primary:hover { background: var(--btn-hover); }
.finance-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px var(--shadow-color); border-color: var(--card-color); }
.finance-bar {
    position: absolute; bottom: 0; left: 0; width: 0%; height: 4px;
    background: linear-gradient(90deg, var(--card-color), var(--grad-end));
    transition: width 0.4s ease;
}
.finance-card:hover .finance-bar { width: 100%; }

/* Report List Badges */
.report-list-header {
    display: flex; padding: 0.8rem 1.2rem; border-bottom: 2px solid var(--edge);
    margin-bottom: 0.5rem; font-weight: 700; color: var(--muted);
    font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.report-item-content { display: flex; align-items: center; width: 100%; }
.report-col-name { flex: 2; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.report-col-type { flex: 1; font-size: 0.9rem; }
.report-col-date { flex: 1; font-size: 0.9rem; color: var(--muted); }
.report-col-author { flex: 1; font-size: 0.9rem; color: var(--muted); }
.report-col-actions { width: 100px; text-align: right; }

.type-badge { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.type-badge.diag { background: #F3E8FF; color: #7E22CE; border: 1px solid #D8B4FE; }
.type-badge.sim { background: #ECFDF5; color: #047857; border: 1px solid #6EE7B7; }
.type-badge.fin { background: #F0FDFA; color: #0F766E; border: 1px solid #99F6E4; }

.action-icon-btn {
    background: transparent; border: 1px solid var(--edge); color: var(--muted);
    width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s; margin-left: 4px;
}
.action-icon-btn:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
.action-icon-btn.delete:hover { border-color: #EF4444; color: #EF4444; }


/* --- 8. HUB VIEW & GRID SYSTEM --- */
.hub-wrapper { flex: 1; width: 100%; padding: 3rem 2rem; background-color: var(--bg); }
.hub-container { max-width: 1200px; margin: 0 auto; }
.hub-header-row {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 3rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--edge);
}
.hub-welcome h1 { font-family: var(--font-display); font-size: 2.8rem; margin-bottom: 0.5rem; color: var(--text); }
.hub-welcome p { font-size: 1.4rem; color: var(--muted); }

.project-grid-layout { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 2rem; }
.project-grid-layout > * { flex: 1; min-width: 250px; }
.hub-project-card {
    background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 2rem;
    display: flex; flex-direction: column; justify-content: space-between; min-height: 150px;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); position: relative; overflow: hidden;
}
.hub-project-card:hover { transform: translateY(-4px); box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1); border-color: var(--accent); }
.hub-project-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: var(--edge); transition: background 0.2s;
}
.hub-project-card:hover::before { background: var(--accent); }
.hub-card-top h3 { font-size: 1.4rem; margin-bottom: 0.4rem; color: var(--text); }
.hub-card-top p { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.hub-card-bottom {
    margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--edge);
    display: flex; justify-content: space-between; align-items: center;
}
.hub-role-badge {
    font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
    background: #F1F5F9; color: var(--muted); padding: 4px 8px; border-radius: 4px;
}
.hub-enter-link {
    font-size: 1rem; color: var(--accent); font-weight: 600; 
    display: flex; align-items: center; gap: 6px; opacity: 0; transform: translateX(-10px);
    transition: all 0.2s ease;
}
.hub-project-card:hover .hub-enter-link { opacity: 1; transform: translateX(0); }


/* --- 9. PRODUCT GATEWAY & HOME (Common) --- */
.product-gateway-grid {
    display: flex; flex-wrap: wrap; justify-content:center; gap: 2rem; padding: 1rem 0;
}
.product-gateway-grid > * { flex: 1; min-width: 280px; }
.product-card {
    cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--edge); background: var(--panel); min-height: 220px;
}
.product-card:hover {
    transform: translateY(-4px); box-shadow: 0 12px 24px -10px rgba(0,0,0,0.15); border-color: var(--accent);
}
.metric-pill {
    display: inline-block; background: #f1f5f9; padding: 4px 12px;
    border-radius: 12px; font-size: 0.75rem; color: #64748b; margin-top: 1rem; font-weight: 600;
}
.product-card .tool-icon svg { stroke-width: 1.5; width: 32px; height: 32px; }

/* Status Banner Common */
.status-banner {
    display: flex; justify-content: space-between; align-items: center;
    padding: 2rem 2.4rem; border-radius: 12px; border: 1px solid transparent;
    color: #fff; box-shadow: var(--shadow-sm); flex-wrap: wrap; gap: 1rem;
}
.status-title { font-size: 1.8rem; margin: 0 0 0.5rem 0; display: flex; align-items: center; gap: 1rem; }
.status-indicator { 
    display: inline-block; padding: 0.2rem 0.8rem; border-radius: 99px; 
    font-size: 1rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em;
    background: rgba(255,255,255,0.6); backdrop-filter: blur(4px);
}
.status-indicator.online { color: inherit; }
.status-msg { font-size: 1.4rem; opacity: 0.9; margin: 0; }
.status-actions { margin-left: auto; }
.btn.inverted { background: rgba(255,255,255,0.5); color: inherit; border: 1px solid rgba(255,255,255,0.2); }
.btn.inverted:hover { background: #fff; }

/* Money Card */
.money-card {
    display: flex; flex-direction: column; justify-content: center;
    background: var(--panel); border: 1px solid var(--edge);
}
.money-label { 
    font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.05em; 
    color: var(--muted); margin-bottom: 0.5rem; font-weight: 700;
}
.money-value {
    font-size: 4rem; font-weight: 700; font-family: var(--font-display);
    color: var(--text); line-height: 1.1; margin-bottom: 0.5rem;
}
.money-trend { font-size: 1.2rem; font-weight: 600; }
.money-trend.positive { color: #16A34A; }
.money-trend.negative { color: #DC2626; }


/* Activity & Lists */
.time-badge {
    display: inline-block; width: 80px; font-size: 1.1rem; 
    color: var(--muted); font-variant-numeric: tabular-nums;
}
.activity-list li { font-size: 1.3rem; }

/* --- 11. UTILITIES & CONTROL PANELS --- */
.mission-control-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem; background: #0f172a; color: white;
    border-radius: 8px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); gap: 2rem; flex-wrap: wrap;
}
.mc-metric {
    display: flex; flex-direction: column; align-items: center; flex: 1;
    border-right: 1px solid rgba(255,255,255,0.1);
}
.mc-metric:last-child { border-right: none; }
.mc-metric .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; margin-bottom: 0.25rem; }
.mc-metric .value { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); }
.mc-metric .text-red { color: #F87171; }
.split-2-1 { grid-template-columns: 2fr 1fr; }

.health-table { width: 100%; border-collapse: collapse; font-size: 1.5rem; }
.health-table th {
    text-align: left; padding: 1rem; border-bottom: 2px solid #f1f5f9;
    color: #64748b; font-weight: 600; font-size: 1.3rem; text-transform: uppercase;
}
.health-table td { padding: 1rem; border-bottom: 1px solid #f8fafc; color: #334155; }
.health-table tr:last-child td { border-bottom: none; }
.health-indicator { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.health-green { background-color: #10B981; box-shadow: 0 0 0 4px #D1FAE5; }
.health-yellow { background-color: #F59E0B; box-shadow: 0 0 0 4px #FEF3C7; }
.health-red { background-color: #EF4444; box-shadow: 0 0 0 4px #FEE2E2; }

/* Project Control Panel */
.control-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--edge);
}
.control-title {
    font-size: 1.5rem; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 0.75rem;
}
.control-badge {
    background: rgba(16, 185, 129, 0.1); color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.2); padding: 0.25rem 0.6rem;
    border-radius: 99px; font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.05em; font-weight: 600;
}
.control-kpi-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.control-kpi-grid > * { flex: 1; min-width: 150px; }
.control-kpi {
    background: var(--panel);
    border: 1px solid var(--edge);
    padding: 1rem;
    border-radius: 8px; display: flex; flex-direction: column; gap: 0.25rem;
}
.control-kpi .label { font-size: 1.1rem; color: var(--muted); text-transform: uppercase; }
.control-kpi .value { font-size: 2.2rem; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.control-kpi .sub { font-size: 0.9rem; color: var(--muted); }
.action-panel { display: flex; flex-direction: column; gap: 0.75rem; }
.control-btn {
    display: flex; align-items: center; gap: 0.75rem; width: 100%;
    padding: 1.2rem 1.4rem; background: var(--bg); border: 1px solid var(--edge);
    border-radius: 6px; color: var(--text); font-weight: 600;
    font-size: 1.4rem; transition: all 0.2s; text-align: left;
}
.control-btn:hover { background: var(--hover-bg); border-color: var(--accent); color: var(--accent); }
.control-btn svg { opacity: 0.7; }
.split-main-action { display: grid; grid-template-columns: 3fr 1fr; gap: 1.5rem; }



/* --- DYNAMIC CONTENT CLASSES (Replaces Inline Styles) --- */

/* Empty States */
.empty-state-container { grid-column: 1/-1; text-align: center; padding: 3rem; }
.empty-state-msg { color: #64748b; margin-bottom: 1rem; }
.empty-state-error { color: #DC2626; padding: 2rem; text-align: center; }
.empty-state-error .title { font-weight: 700; }
.empty-state-error .desc { font-size: 0.9rem; }
.empty-state-error .retry-btn { margin-top: 1rem; }

/* Table Helpers */
.table-center-msg { text-align: center; padding: 2rem; color: #94a3b8; }
.cell-owner { font-size: 0.9rem; color: #64748b; }
.cell-model-none { color: #cbd5e1; font-style: italic; }
.cell-subtitle { color: #64748b; }
.cell-action { text-align: right; }

/* KPI Card Variants */
.kpi-card-accent { border-left: 4px solid var(--accent); }
.kpi-value-accent { color: var(--accent); font-size: 2rem; }
.kpi-value-danger { color: #DC2626; }

/* Realized Project Info */
.realized-info-grid { margin-top: 1.2rem; padding-top: 0.8rem; border-top: 1px solid #f1f5f9; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.realized-col-label { font-size: 0.7rem; color: #64748b; font-weight: 700; text-transform: uppercase; }
.realized-val-accent { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.realized-val-dark { font-size: 1.1rem; font-weight: 600; color: #0f172a; }
.realized-footer { font-size: 0.75rem; color: #94a3b8; margin-top: 0.6rem; display: flex; align-items: center; gap: 4px; }
.realized-star { color: #F59E0B; }
.realized-none { margin-top: 1.2rem; padding-top: 0.8rem; border-top: 1px solid #f1f5f9; height: 60px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-style: italic; font-size: 0.9rem; }

/* Project Card Borders */
.border-top-amp { border-top: 4px solid #E11D48 !important; }
.border-top-veritainer { border-top: 4px solid #10B981 !important; }
.border-top-accent { border-top: 4px solid var(--accent) !important; }

/* Status Badges (Dynamic) */
.badge-status-paused { color: #F59E0B !important; background: rgba(245, 158, 11, 0.1) !important; border-color: rgba(245, 158, 11, 0.2) !important; }
.badge-status-active { color: #10B981 !important; background: rgba(16, 185, 129, 0.1) !important; border-color: rgba(16, 185, 129, 0.2) !important; }

/* Run Items */
.run-item-content { flex: 1; }
.run-item-title { font-weight: 500; font-size: 0.9rem; }
.run-item-meta { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.btn-icon-soft { border: none; background: none; color: #cbd5e1; cursor: pointer; padding: 4px; }
.btn-icon-soft:hover { color: #EF4444; } /* specific for delete hover usually */
.run-item-realized { border-left: 3px solid #F59E0B !important; }
.btn-ghost-danger { border: 1px solid #EF4444 !important; color: #EF4444 !important; background: transparent; }
.btn-ghost-danger:hover { background: #FEF2F2 !important; }

/* Partner Table */
.partner-row-group { background: var(--hover-bg); }
.partner-cell-group { font-weight: 700; }
.partner-cell-sub { padding-left: 1.5rem; color: var(--muted); }


/* --- SETTINGS MODAL & DYNAMIC CLASSES --- */

/* Tool Cards - Replaces Inline */
.no-tools-msg { grid-column: 1/-1; color: var(--muted); font-style: italic; }

/* Pending Member List */
.pending-empty { text-align: center; color: var(--muted); font-size: 0.9rem; font-style: italic; }

/* Dynamic Delete Button */
.btn-dynamic-delete {
    background-color: #ef4444 !important;
    color: white !important;
    margin-top: 2rem !important;
    border: none !important;
    padding: 10px !important;
    border-radius: 6px !important;
    width: 100% !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    display: none;
}
.btn-dynamic-delete.visible { display: block; }

/* Team List Items */
.team-list-loading { padding: 1rem; color: var(--muted); text-align: center; }
.team-list-item { padding: 1rem; border-bottom: 1px solid #eee; display: grid; grid-template-columns: 5fr 1fr; justify-content: space-between; align-items: center; }
.team-user-info { display: flex; gap: 12px; align-items: center; }
.team-avatar { width: 32px; height: 32px; background: #F1F5F9; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text); }
.team-details div:first-child { font-weight: 600; color: var(--text); }
.team-details div:last-child { font-size: 0.85rem; color: var(--muted); }
.team-actions { display: flex; gap: 10px; align-items: center; }
.team-spacer { width: 34px; }

/* FLEX UTILITIES (User Preference) */
.flex-column { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { align-items: center; justify-content: center; }
.flex-align-center { align-items: center; }
.flex-space-between { justify-content: space-between; }
.flex-gap-1 { gap: 1rem; }
.flex-gap-2 { gap: 2rem; }

/* --- Tool Sidebar Classes --- */
.nav-separator { height: 1px; background: var(--edge); margin: 0.8rem 1.6rem; }
.projects-toggle-label { display: flex; align-items: center; gap: 12px; }
.role-badge.visible { display: inline-block; }


.activity-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}
/* Scrollbar Styling for Activity List (Webkit) */
.activity-list::-webkit-scrollbar { width: 6px; }
.activity-list::-webkit-scrollbar-track { background: transparent; }
.activity-list::-webkit-scrollbar-thumb { background-color: var(--edge); border-radius: 10px; }

.activity-list li {
    padding: 0.8rem 1rem; /* Match Models list padding */
    border-bottom: 1px solid #f1f5f9;
    font-size: 1.4rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.activity-text { font-size: 1.4rem; color: var(--text); }
.activity-sub-text { opacity: 0.7; }
.fep-action-row { display: flex; align-items: center; gap: 1rem; }
.text-muted-icon { color: var(--muted); }

/* --- RESPONSIVE for HUB ELEMENTS --- */
@media (max-width: 1024px) {
    /* .control-kpi-grid { grid-template-columns: repeat(2, 1fr); } REMOVE GRID OVERRIDE */
    .split-main-action { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .hub-welcome-banner { padding-left: 0.5rem; }
}

@media (max-width: 768px) {
    .view-section, #view-overview, #view-reports, #view-assets { padding: 1rem;}
    .hub-wrapper { padding: 1.5rem 1rem; }
    .hub-container { padding: 0; }
    .hub-header-row { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .hub-welcome h1 { font-size: 2rem; }
    .hub-project-card { min-height: auto; }
    .content-card, .tool-card, .hub-project-card { padding: 1.5rem; }
    .hub-welcome-banner {
        padding: 3rem 0 !important;
        text-align: center;
    }
    .dashboard-split-layout, 
    .dashboard-split-layout.split-1-3, 
    .kpi-grid,
    .project-grid-layout,
    .tools-grid {
        flex-direction: column;
        padding-top: 0 !important;
    }
    .control-kpi-grid {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .control-kpi {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0.8rem 1.2rem;
    }

    .control-kpi .label {
        font-size: 0.85rem;
        margin-bottom: 0px;
    }
    
    .control-kpi .value {
        font-size: 1.4rem;
        margin-bottom: 0px;
    }
    
    .control-kpi .sub {
        display: none; /* Hide sub-label on mobile to keep it clean, or reduce size */
    }
    .category-title {
        text-align: center;
    }
    .tools-grid {
        align-content: center;
    }
    .tool-card {
        width: 100%;
    }
    .kpi-grid { display: flex; flex-direction: row; justify-content: center; align-items: center; }

    .dashboard-split-layout.split-3-cols { display: flex; flex-direction: column; }
    .dashboard-split-layout.split-3-cols > .content-card:nth-child(2) { order: 1; margin-bottom: 1.5rem; }
    .dashboard-split-layout.split-3-cols > .content-card:nth-child(3) { order: 2; margin-bottom: 1.5rem; }
    .dashboard-split-layout.split-3-cols > .content-card:nth-child(1) { order: 3; }
    .dashboard-split-layout.split-1-1{ display: flex; flex-direction: column; }
    .kpi-label { font-size: 1.1rem; }
    .kpi-value { font-size: 1.3rem; }
    .dashboard-table { font-size: 0.9rem; }

    /* Fix: Allow table to scroll horizontally on mobile */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .health-table {
        font-size: 1.1rem;
    }
    
    /* Production Chart Styling */
    .content-card h3 {
        font-size: 2rem;
    }
    
    .hide-mobile-text {
        display: none;
    }
    

    #chart-action-container .btn {
        font-size: 1.3rem;
        padding: 1rem;
        border-radius: 12px;
    }
    #portfolio-summary-banner .kpi-card  {
        width: 100%;
    }
}

/* --- MOBILE REPORT CARDS (Diagnostic Reports) --- */
@media (max-width: 800px) {
    /* Hide the list header */
    .report-list-header { display: none; }

    /* Card Container */
    .rich-item {
        padding: 0;
        border: 1px solid var(--edge);
        border-radius: 12px;
        margin-bottom: 1rem;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
        overflow: hidden;
        display: block; /* Override flex */
    }
    .rich-item:hover { transform: none; box-shadow: 0 4px 8px rgba(0,0,0,0.05); }

    .report-item-content {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* Header: Report Name */
    .report-col-name {
        width: 100%;
        background: var(--bg);
        padding: 1rem;
        border-bottom: 1px solid var(--edge);
        font-size: 1.1rem;
        color: var(--text);
    }

    /* Data Rows */
    .report-col-type, 
    .report-col-date, 
    .report-col-author {
        width: 100%;
        padding: 0.8rem 1rem;
        border-bottom: 1px dashed var(--edge);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        font-size: 1rem;
    }

    /* Pseudo-labels */
    .report-col-type::before { content: "Type"; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
    .report-col-date::before { content: "Date"; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
    .report-col-author::before { content: "Author"; font-weight: 600; color: var(--muted); font-size: 0.9rem; }

    /* Actions Footer */
    .report-col-actions {
        width: 100%;
        padding: 0.8rem 1rem;
        background: var(--panel);
        text-align: right;
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
    }
}

[data-theme="dark"] .health-table td {
    color: #c5ccd8;
}

/* FEP Local Search Bar */
.fep-local-search-bar {
    width: 100%;
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}
.fep-local-search-bar .search-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.5rem;
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.fep-local-search-bar .search-inner:focus-within {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Highlight on focus */
    border-color: var(--accent);
}
.fep-local-search-bar .search-icon {
    color: var(--muted);
    font-size: 1.25rem;
}
.fep-local-search-bar .search-input-field {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text);
    outline: none;
}
.fep-local-search-bar .search-input-field::placeholder {
    color: var(--muted);
}
