:root {

            --warning: #f59e0b;

            --right-sidebar-width: 340px;

        }

        body { font-family: 'Inter', 'Sarabun', sans-serif; background-color: var(--bg-body); margin: 0; padding: 0; color: var(--text-primary); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }

        .top-header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-height); background: var(--bg-surface); border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; padding: 0 24px; z-index: 1000; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
        .header-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; color: var(--text-primary); width: var(--sidebar-width); }
        .header-brand img { height: 44px; margin-left: 12px; object-fit: contain; }
        .header-actions { display: flex; align-items: center; gap: 16px; }
        
        .profile-btn { display: flex; align-items: center; gap: 10px; background: #f8fafc; padding: 6px 16px 6px 6px; border-radius: 30px; border: 1px solid var(--border-light); cursor: pointer; transition: 0.2s; }
        .profile-btn:hover { background: #edf7ff; border-color: #badef7; }
        .profile-btn img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
        .profile-info-text { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
        .profile-info-text .user-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.2;}
        .profile-info-text .manage-text { font-size: 11px; font-weight: 600; color: var(--primary); display: flex; align-items: center; gap: 4px; margin-top: 2px;}

        .btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 6px; font-family: inherit; }
        .btn-outline:hover { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }
        .mobile-toggle { display: none; background: transparent; border: none; font-size: 28px; color: var(--text-primary); cursor: pointer; }

        .layout-wrapper { display: flex; flex: 1; margin-top: var(--header-height); height: calc(100vh - var(--header-height)); }
        .left-sidebar { width: var(--sidebar-width); background: var(--bg-surface); border-right: 1px solid var(--border-light); display: flex; flex-direction: column; overflow-y: auto; padding: 24px 0; z-index: 900; transition: left 0.3s ease;}
        .menu-title { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin: 0 24px 12px 24px; }
        .menu-list { list-style: none; padding: 0; margin: 0 0 24px 0; }
        .menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 24px; color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 600; transition: 0.2s; position: relative; cursor: pointer; }
        .menu-item:hover, .menu-item.active { background: #edf7ff; color: var(--primary); }
        .menu-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); border-radius: 0 4px 4px 0; }
        .menu-item i { font-size: 20px; }

        .main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; background: var(--bg-body); }
        .content-padding { padding: 32px; flex: 1; max-width: 1200px; margin: 0 auto; width: 100%; box-sizing: border-box;}

        .hero-banner { 
            background: var(--bg-surface); border: 1px solid var(--border-light);
            border-left: 4px solid var(--primary); border-radius: 8px; padding: 32px; 
            display: flex; justify-content: space-between; align-items: center; 
            margin-bottom: 32px; box-shadow: var(--shadow-sm);
        }
        .hero-info h2 { margin: 0 0 8px 0; font-size: 24px; font-weight: 700; color: var(--primary); letter-spacing: 0.5px; }
        .hero-info p { margin: 0; font-size: 15px; color: var(--text-secondary); }
        
        .hero-kpi { background: #f8fafc; padding: 20px; border-radius: 6px; border: 1px solid var(--border-light); width: 250px; }
        .kpi-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--text-primary); }
        .kpi-head span.lvl { background: var(--primary); color: white; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
        .progress-bg { background: #e2e8f0; height: 6px; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
        .progress-bar { background: var(--primary); height: 100%; width: 0%; border-radius: 3px; transition: 1s ease; }
        .kpi-foot { font-size: 12px; color: var(--text-secondary); text-align: right; font-weight: 500;}

        .section-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0 0 20px 0; display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
        .module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
        
        .module-card { 
            background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 8px; padding: 24px; 
            text-decoration: none; color: inherit; transition: all 0.2s ease; display: flex; 
            flex-direction: column; align-items: flex-start; gap: 16px; box-shadow: var(--shadow-sm); 
        }
        .module-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
        
        .module-icon { width: 48px; height: 48px; border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 24px; }
        .icon-blue { background: #edf7ff; color: #0875c9; }
        .icon-purple { background: #faf5ff; color: #9333ea; }
        .icon-orange { background: #fff7ed; color: #ea580c; }
        .icon-green { background: #f0fdf4; color: #16a34a; }
        
        .module-text h3 { margin: 0 0 6px 0; font-size: 16px; font-weight: 700; color: var(--text-primary); }
        .module-text p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

        .dashboard-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-top: 32px; }
        .widget-card { background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 8px; padding: 24px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;}
        
        .intern-progress-wrapper { margin-top: 10px; border-top: 1px solid var(--border-light); padding-top: 16px;}
        .intern-labels { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
        .intern-bar-bg { background: #e2e8f0; height: 8px; border-radius: 4px; overflow: hidden; position: relative; }
        .intern-bar-fill { background: var(--success); height: 100%; width: 0%; border-radius: 4px; transition: 1.5s ease-out; position: relative; }
        .intern-details { font-size: 13px; color: var(--text-secondary); margin-top: 12px; line-height: 1.6; }
        .intern-highlight { color: var(--primary); font-weight: 700; font-size: 14px;}

        .mini-rank-item { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px; border-radius: 6px; background: #f8fafc; transition: 0.2s; border: 1px solid var(--border-light);}
        .mini-rank-item:hover { background: #ffffff; border-color: #cbd5e1; box-shadow: var(--shadow-sm);}
        .mini-rank-num { font-size: 16px; font-weight: 700; width: 24px; text-align: center; color: var(--text-secondary); }
        .mini-rank-avatar { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
        .mini-rank-info { flex: 1; }
        .mini-rank-name { font-weight: 600; font-size: 14px; color: var(--text-primary); margin-bottom: 2px;}
        .mini-rank-score { font-size: 12px; color: var(--text-secondary); font-weight: 500; display: flex; align-items: center; gap: 4px;}

        .right-sidebar { width: var(--right-sidebar-width); background: var(--bg-surface); border-left: 1px solid var(--border-light); padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; z-index: 800;}
        .news-sidebar-title { font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--border-light); padding-bottom: 12px; margin: 0; display: flex; align-items: center; gap: 8px;}
        .news-card { border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; transition: 0.2s; cursor: pointer; }
        .news-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm);}
        .news-img { width: 100%; height: 160px; object-fit: cover; background: #f1f5f9; }
        .news-body { padding: 16px; }

        .main-footer { background: var(--bg-surface); border-top: 1px solid var(--border-light); padding: 20px 32px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary); margin-top: auto; }

        .loading-screen { position: fixed; inset: 0; background: rgba(248, 250, 252, 0.95); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; flex-direction: column; z-index: 9999; animation: forceHide 0.5s ease-in-out 2.5s forwards; pointer-events: none; }
        .spinner { border: 4px solid var(--border-light); border-top: 4px solid var(--primary); border-radius: 50%; width: 48px; height: 48px; animation: spin 1s linear infinite; margin-bottom: 20px; }
        @keyframes spin { 100% { transform: rotate(360deg); } }
        @keyframes forceHide { 100% { opacity: 0; visibility: hidden; display: none; } }
        
        .modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
        .modal-box { background: var(--bg-surface); width: 100%; max-width: 550px; max-height: 85vh; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); border: 1px solid var(--border-light); }
        .modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
        .btn-close-modal { background: transparent; border: none; font-size: 24px; color: var(--text-secondary); cursor: pointer; transition: 0.2s; }
        .modal-body { padding: 24px; overflow-y: auto; flex: 1; }

        @media (max-width: 1024px) {
            .right-sidebar { display: none; } 
            .dashboard-widgets { grid-template-columns: 1fr; }
        }

        @media (max-width: 768px) {
            .left-sidebar { position: fixed; left: -100%; top: var(--header-height); bottom: 0; box-shadow: 4px 0 10px rgba(0,0,0,0.1); width: 260px; z-index: 1000; }
            .left-sidebar.show { left: 0; }
            .mobile-toggle { display: block; }
            .right-sidebar { display: none; }
            
            .header-brand { width: auto; gap: 8px; font-size: 18px; }
            .header-brand span { display: none; } 
            .header-actions { gap: 10px; }
            .profile-btn { padding: 4px; border-radius: 50%; } 
            .profile-info-text { display: none; } 
            .btn-outline .hide-mobile { display: none; } 
            .btn-outline { padding: 8px; width: 36px; height: 36px; display: flex; justify-content: center; align-items: center; border-radius: 50%; border: none;}

            .content-padding { padding: 16px; }
            
            .hero-banner { flex-direction: column; text-align: center; padding: 24px; gap: 20px; border-left: none; border-top: 4px solid var(--primary);}
            .hero-info h2 { font-size: 20px; }
            .hero-kpi { width: 100%; box-sizing: border-box; }

            .dashboard-widgets { grid-template-columns: 1fr; margin-top: 24px; gap: 16px; }
            .widget-card { padding: 20px; border-radius: 8px; }
            
            .module-grid { grid-template-columns: 1fr; gap: 16px; }
            .module-card { padding: 20px; border-radius: 8px; flex-direction: row; align-items: center; }
            .module-icon { width: 48px; height: 48px; font-size: 24px; flex-shrink: 0; }
            
            .main-footer { flex-direction: column; gap: 12px; padding: 16px; text-align: center; justify-content: center; }
            .main-footer div:last-child { justify-content: center; width: 100%; }

            .modal-overlay { padding: 12px; }
            .modal-box { max-height: 90vh; border-radius: 8px; }
            .modal-header { padding: 16px; }
            .modal-body { padding: 16px; }
        }
