:root {
    --primary: #003893;
    --primary-gradient: linear-gradient(135deg, #003893 0%, #002d76 100%);
    --accent-blue: #003893;
    --accent-blue-glow: rgba(0, 56, 147, 0.4);
    --accent-gold: #FBB03B;
    --accent-red: #E62129;
    --bg-main: #f1f5f9;
    --bg-sidebar: #003893;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --sidebar-width: 300px;
    --topbar-height: 60px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 17px;
    margin: 0;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.dashboard-container {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
}

/* Sidebar - Professional Gradient & Glass */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #003893 0%, #002d76 100%);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 100;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.sidebar-logo-section {
    padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 2.5rem;
}

.sidebar-logo-icon {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 0 30px rgba(255,255,255,0.15));
}

.sidebar-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Optional: Keep it colorful if it looks good, or use brightness(0) invert(1) for pure white */
    filter: brightness(0) invert(1);
}

.sidebar-brand-name {
    color: white;
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sidebar-brand-location {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 800;
    letter-spacing: 0.05em;
    line-height: 1;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.1rem 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    border-radius: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
    font-size: 1.05rem;
    position: relative;
    overflow: hidden;
}

.user-profile-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    transform: translateX(5px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 4px;
    background: var(--accent-gold);
    border-radius: 0 4px 4px 0;
}

.nav-link.active i {
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(251, 176, 59, 0.5);
}

.nav-link i {
    font-size: 24px;
    transition: all 0.3s;
}

/* Main Area - Glass Aesthetic */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
}

.topbar {
    height: auto;
    min-height: var(--topbar-height);
    display: flex;
    flex-direction: column;
    background: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 10000; /* Extremely high z-index to stay above all dashboard content */
}

.topbar-signature-bar {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #003893 60%, #FBB03B 60%, #FBB03B 75%, #E62129 75%);
}

.topbar-main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: var(--topbar-height);
}

.topbar-breadcrumb-context {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.breadcrumb-pill {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 16px 6px 6px;
    border-radius: 100px;
    transition: all 0.3s ease;
}

.breadcrumb-pill:hover {
    background: white;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.pill-logo {
    width: 32px;
    height: 32px;
    background: #003893;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    box-shadow: 0 2px 8px rgba(0, 56, 147, 0.2);
}

.pill-logo img {
    height: 18px;
    width: auto;
    filter: brightness(0) invert(1);
}

.brand-spark {
    font-weight: 900;
    font-size: 0.9rem;
    color: #003893;
    letter-spacing: 0.05em;
}

.pill-divider-v2 {
    width: 1px;
    height: 14px;
    background: #e2e8f0;
    margin: 0 12px;
}

.brand-city {
    font-size: 0.7rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.02em;
}

.breadcrumb-chevron {
    color: #cbd5e1;
    display: flex;
    align-items: center;
    margin: 0 4px;
}

.breadcrumb-chevron i {
    font-size: 20px;
}

.breadcrumb-current-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.05em;
}


.topbar-actions-island {
    display: flex;
    align-items: center;
    background: transparent;
    padding: 6px 10px;
    gap: 8px;
}

.island-time-group {
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 110px;
}

.island-time { font-size: 1.1rem; font-weight: 900; color: #0f172a; line-height: 1; }
.island-date { font-size: 0.75rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.island-divider {
    width: 1px;
    height: 32px;
    background: #f1f5f9;
}

.island-btn-group {
    display: flex;
    gap: 6px;
}

.island-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.island-btn:hover { 
    background: white; 
    color: #3b82f6; 
    border-color: #3b82f6; 
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1); 
    transform: translateY(-1px);
}
.island-btn i { font-size: 26px; }

.island-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.island-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px 6px 6px;
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    font-family: inherit;
    outline: none;
    z-index: 5100;
    width: auto;
    max-width: 320px;
    user-select: none;
}

.island-user .user-dropdown-menu {
    pointer-events: auto; /* Allow interaction with the menu itself */
}

.island-user:hover, .island-user.active {
    background: rgba(0, 56, 147, 0.08);
    border-color: rgba(0, 56, 147, 0.1);
}

.user-avatar-small {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #003893 0%, #002d76 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(0, 56, 147, 0.2);
}

.user-info-slim {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.user-name { font-size: 0.9rem; font-weight: 800; color: #0f172a; }
.user-role { 
    font-size: 0.7rem; 
    font-weight: 900; 
    color: white; 
    background: #003893;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

/* Dashboard Grid */
/* Premium Glass Card V2 */
.glass-card-v2 {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.05),
        0 4px 6px -2px rgba(0, 0, 0, 0.02),
        inset 0 1px 1px rgba(255, 255, 255, 0.8);
    padding: 0.85rem 1.25rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.glass-card-v2:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.08),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.glass-card-v2::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s;
}

.glass-card-v2:hover::before {
    opacity: 1;
}

.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    overflow-y: auto; /* ENABLE SCROLLING WHEN CONTENT EXCEEDS VIEWPORT */
    max-height: calc(100vh - var(--topbar-height));
    gap: 0.75rem;
}

@media (max-width: 1024px) {
    .dashboard-content {
        height: auto;
        overflow-y: auto;
        padding: 1rem;
    }
}

.dashboard-content::-webkit-scrollbar {
    width: 6px;
}

.dashboard-content::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.dashboard-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    height: auto;
    min-height: 0;
    overflow: hidden;
}

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

.stat-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-icon-wrap.green { background: #ecfdf5; color: #10b981; }
.stat-icon-wrap.orange { background: #fff7ed; color: #f59e0b; }
.stat-icon-wrap.red { background: #fef2f2; color: #ef4444; }
.stat-icon-wrap.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon-wrap.purple { background: #f5f3ff; color: #8b5cf6; }

.stat-icon-wrap.blue { background: #dbeafe; color: #1e40af; }
.stat-icon-wrap.green { background: #dcfce7; color: #166534; }
.stat-icon-wrap.orange { background: #fef3c7; color: #92400e; }
.stat-icon-wrap.red { background: #fee2e2; color: #991b1b; }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat-val-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.stat-main-val {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-trend-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.stat-trend-tag.up { background: #dcfce7; color: #166534; }
.stat-trend-tag.down { background: #fee2e2; color: #991b1b; }

/* Content Split Area */
.content-split {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: minmax(300px, 1fr) minmax(300px, 1fr);
    grid-template-areas: 
        "overview activity"
        "insights actions";
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
}

.data-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

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

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
}

/* Line Chart Mock */
.chart-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--card-border);
}

.chart-svg-wrap {
    flex: 1;
    position: relative;
}

/* List Items */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.feed-item-modern {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid #f1f5f9;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.feed-content-row {
    flex: 1;
}

.feed-name-bold {
    font-weight: 700;
    font-size: 1rem;
}

.feed-sub-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.feed-status-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    text-transform: uppercase;
}

.badge-in { background: #dcfce7; color: #166534; }
.badge-out { background: #dbeafe; color: #1e40af; }
.badge-late { background: #fef3c7; color: #92400e; }

/* Table Modern */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.modern-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.modern-table td {
    background: white;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.modern-table tr td:first-child { border-radius: 12px 0 0 12px; }
.modern-table tr td:last-child { border-radius: 0 12px 12px 0; }

.progress-bar-wrap {
    width: 100px;
    height: 6px;
    background: #f1f5f9;
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill-blue { height: 100%; background: var(--accent-blue); }

/* Department Insights Redesign */
.dept-row {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.dept-row:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateX(4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.dept-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.dept-info {
    flex: 1;
}

.dept-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.dept-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
}

.dept-code {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
}

.dept-stats {
    display: flex;
    gap: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.dept-segmented-progress {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: rgba(241, 245, 249, 0.5);
    border-radius: 8px;
}

.dept-segment {
    width: 6px;
    height: 18px;
    border-radius: 2px;
    background: #e2e8f0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dept-segment.active {
    box-shadow: 0 0 8px var(--glow-color, rgba(59, 130, 246, 0.3));
}

.dept-percent-badge {
    min-width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #f1f5f9;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.dept-percent-val {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.dept-percent-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Decorative Corner */
.decor-leaves {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 150px;
    opacity: 0.1;
    pointer-events: none;
}
#attendance-overview-card { grid-area: overview; }
#realtime-activity-card { 
    grid-area: activity; 
    min-height: 250px;
}
#department-insights-container { grid-area: insights; }
#quick-actions-card { grid-area: actions; }

.activity-entry-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px;
    margin-bottom: 0.65rem;
    transition: all 0.2s ease;
}

.activity-avatar-glow {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.dept-pill-small {
    font-size: 0.7rem;
    font-weight: 800;
    color: #475569;
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #e2e8f0;
}

/* User Profile Dropdown */
.island-user.active {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 100%;
    min-width: 250px;
    height: auto !important; /* CRITICAL FIX: Override glass-card-v2 height: 100% */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 10px;
    box-shadow: 
        0 20px 40px -15px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 10001;
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: dropdownPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    pointer-events: all !important;
    overflow: visible !important;
}

@keyframes dropdownPop {
    from { transform: translateY(10px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.user-dropdown-menu:hover {
    transform: none !important;
}

.dropdown-info {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dropdown-info .user-name { 
    font-weight: 900; 
    color: #0f172a; 
    font-size: 1rem; 
    letter-spacing: -0.5px;
}

.dropdown-info .user-email { 
    color: #64748b; 
    font-size: 0.8rem; 
    font-weight: 600; 
}

.dropdown-separator {
    height: 1px;
    background: #f1f5f9;
    margin: 10px 10px;
}

.dropdown-link {
    display: flex !important;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    min-height: 55px;
    border-radius: 16px;
    color: #475569;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    border: none;
    width: calc(100% - 4px);
    margin: 0 2px;
    cursor: pointer !important;
    text-align: left;
    position: relative;
    z-index: 10;
}

.dropdown-link i {
    font-size: 22px;
    color: #94a3b8;
    transition: all 0.2s;
}

.dropdown-link:hover {
    background: rgba(0, 56, 147, 0.06);
    color: #003893;
    transform: translateX(4px);
}

.dropdown-link:hover i {
    color: #003893;
    transform: scale(1.1);
}

.dropdown-link.logout-link {
    color: #ef4444;
}

.dropdown-link.logout-link:hover {
    background: #fef2f2;
    color: #dc2626;
}

.dropdown-link.logout-link i {
    color: #ef4444;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 20px;
    padding: 8px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -6px rgba(0,0,0,0.1);
    z-index: 10001;
    border: 1px solid #e2e8f0;
    animation: menuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.dropdown-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
}

.dropdown-header .header-title { font-weight: 900; color: #0f172a; font-size: 0.95rem; }
.dropdown-header .header-action { 
    font-size: 0.75rem; font-weight: 700; color: #3b82f6; 
    background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.dropdown-header .header-action:hover { background: #eff6ff; }

.notification-list {
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.notification-item:hover { background: #f8fafc; }
.notification-item.unread::after {
    content: '';
    position: absolute;
    top: 14px;
    right: 14px;
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
}

.item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-icon i { font-size: 18px; }
.item-icon.security { background: #fef2f2; color: #ef4444; }
.item-icon.alert { background: #fffbeb; color: #f59e0b; }
.item-icon.info { background: #eff6ff; color: #3b82f6; }

.item-content { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.item-title { font-size: 0.85rem; font-weight: 800; color: #1e293b; line-height: 1.3; }
.item-time { font-size: 0.7rem; font-weight: 600; color: #94a3b8; }

.dropdown-footer {
    padding: 10px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
    text-align: center;
}

.dropdown-footer a {
    font-size: 0.8rem; font-weight: 800; color: #64748b;
    text-decoration: none; display: block; padding: 8px; border-radius: 8px;
}
.dropdown-footer a:hover { color: #3b82f6; background: #f8fafc; }

.dropdown-link i { font-size: 20px; color: #94a3b8; }
.dropdown-link:hover i { color: #3b82f6; }

.logout-link { color: #ef4444; }
.logout-link:hover { background: #fef2f2; color: #dc2626; }
.logout-link:hover i { color: #dc2626; }

@keyframes menuFadeIn {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM
   ========================================================================== */

/* 1. Collapsed Sidebar Logic */
.sidebar.collapsed {
    width: 88px !important;
    padding: 2rem 0.75rem !important;
}

.sidebar.collapsed .sidebar-logo-section {
    align-items: center;
    gap: 0;
}

.sidebar.collapsed .sidebar-logo-icon {
    width: 48px;
    height: 48px;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed #system-status-panel {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 1.1rem;
    gap: 0;
}

.sidebar.collapsed .nav-link i {
    font-size: 28px;
}

/* 2. Media Queries */

/* Large Laptops / Smaller Desktops */
@media (max-width: 1464px) {
    :root {
        --sidebar-width: 260px;
    }
    
    .stats-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Standard Laptops (Collapse Sidebar) */
@media (max-width: 1200px) {
    .content-split {
        grid-template-columns: 1.2fr 1fr;
    }
}

/* Tablets & Small Laptops */
@media (max-width: 1100px) {
    .sidebar:not(.mobile-open) {
        width: 88px !important;
        padding: 2rem 0.75rem !important;
    }
    
    .sidebar:not(.mobile-open) .sidebar-brand-text,
    .sidebar:not(.mobile-open) .nav-link span,
    .sidebar:not(.mobile-open) #system-status-panel {
        display: none !important;
    }

    .sidebar:not(.mobile-open) .sidebar-logo-icon {
        width: 48px;
        height: 48px;
    }

    .sidebar:not(.mobile-open) .nav-link {
        justify-content: center;
        padding: 1.1rem;
    }
}

.stats-carousel-wrapper {
    position: relative;
    width: 100%;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    width: 100%;
}

.carousel-nav {
    display: none; /* Hidden by default */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10;
    cursor: pointer;
    color: #64748b;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.carousel-nav:hover {
    background: #f8fafc;
    color: #3b82f6;
    border-color: #3b82f6;
}

.carousel-nav.prev { left: -18px; }
.carousel-nav.next { right: -18px; }

@media (max-width: 1100px) {
    .stats-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-behavior: smooth;
        -ms-overflow-style: none;
        scrollbar-width: none;
        gap: 1rem;
        padding: 4px;
        scroll-snap-type: x mandatory;
    }

    .stats-container::-webkit-scrollbar {
        display: none;
    }

    .stats-container > div {
        flex: 0 0 240px !important;
        scroll-snap-align: start;
    }

    .carousel-nav {
        display: flex; /* Show arrows on small screens */
    }
}

/* Small Tablets / Large Phones */
@media (max-width: 1024px) {
    .content-split {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "overview"
            "activity"
            "insights"
            "actions";
        overflow-y: visible;
        display: flex;
        flex-direction: column;
    }

    .dashboard-content {
        padding: 1rem;
    }

    .stats-container > div {
        flex: 0 0 200px;
    }
    
    #attendance-overview-card { min-height: 400px; }
    #department-insights-container { min-height: 500px !important; }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100%;
        width: 280px !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
        padding: 2rem 1.5rem !important;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar.mobile-open .sidebar-brand-text,
    .sidebar.mobile-open .nav-link span,
    .sidebar.mobile-open #system-status-panel {
        display: flex !important;
    }
}

/* --- FLUID TOPBAR RESPONSIVENESS --- */

/* 1. Large Laptops (1440px) - Initial Simplification */
@media (max-width: 1440px) {
    .brand-city, .pill-divider-v2 { display: none; }
    .topbar-main-content { padding: 0 1.25rem; }
    .island-time-group { padding: 0 12px; min-width: auto; }
}

@media (max-width: 1356px) {
    .topbar-breadcrumb-context { 
        display: none !important; 
    }
    .menu-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: #f1f5f9;
        border: none;
        color: #003893;
        margin-right: 15px;
    }
}

/* 2. Medium Laptops (1280px) - Text Truncation & Gap Reduction */
@media (max-width: 1280px) {
    .user-name { 
        max-width: 110px; 
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis; 
    }
    .topbar-breadcrumb-context { display: none !important; }
    .breadcrumb-current-label { font-size: 0.9rem; }
}

/* 3. Small Laptops (1100px) - Status Simplification */
@media (max-width: 1100px) {
    .island-date { display: none; } /* Hide date, keep time */
    .island-time { font-size: 1rem; }
    .island-time-group { padding: 0 8px; border: none; }
    .topbar-breadcrumb-context { display: none !important; }
    .breadcrumb-current-label { font-weight: 900; }
}

/* 4. Large Tablets (950px) - User Info Simplification */
@media (max-width: 950px) {
    .user-info-slim { display: none; }
    .island-divider { display: none; }
    .topbar-actions-island { gap: 4px; }
    .topbar-breadcrumb-context { display: none !important; }
    .brand-spark { font-size: 0.75rem; }
}

/* 5. Standard Tablets (768px) - Full Mobile Transformation */
@media (max-width: 768px) {
    .topbar-main-content { padding: 0 0.75rem; }
    .island-time-group { display: none; }
    .brand-spark, .breadcrumb-current-label { display: none; }
    
    .menu-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: #f1f5f9;
        border: none;
        color: #003893;
    }
    
    .breadcrumb-pill { border: none; background: transparent; padding: 0 !important; }
    .pill-logo { width: 34px; height: 34px; margin: 0; box-shadow: none; }
    .pill-logo img { height: 20px; }
    
    .island-btn { width: 40px; height: 40px; border-radius: 10px; }
    .island-btn i { font-size: 22px; }
    .user-avatar-small { width: 36px !important; height: 36px !important; border-radius: 10px !important; }
}

/* 6. Mobile Phones (480px) - Ultra Minimal */
@media (max-width: 480px) {
    .topbar-actions-island { gap: 2px; }
    .island-btn { border: none; background: transparent; width: 36px; }
    .breadcrumb-pill, .breadcrumb-chevron, .breadcrumb-current-label {
        display: none !important;
    }
}

/* Extra Small Phones */
@media (max-width: 480px) {
    .user-info-slim {
        display: none;
    }

    .stat-main-val {
        font-size: 1.5rem;
    }

    .glass-card-v2 {
        padding: 1rem;
    }
}

/* Attendance Overview Internal Styles */
.overview-header-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.overview-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.overview-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.present { background: #10b981; }
.legend-dot.late { background: #f59e0b; }
.legend-dot.absent { background: #ef4444; }

/* Quick Actions Internal Responsive Fixes */
@media (max-width: 600px) {
    #quick-actions-card .list-container {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .quick-action-item {
        padding: 0.75rem 1rem !important;
        gap: 0.85rem !important;
    }
    
    .quick-action-item .avatar-circle {
        width: 38px !important;
        height: 38px !important;
    }
    
    .quick-action-item .action-name {
        font-size: 0.95rem !important;
    }
    
    .quick-action-item .action-desc {
        font-size: 0.75rem !important;
    }
    
    .x-axis-labels {
        font-size: 0.55rem !important;
    }
}

@media (max-width: 380px) {
    .quick-action-item {
        padding: 0.6rem 0.75rem !important;
        gap: 0.6rem !important;
    }
    
    .quick-action-item .chevron-icon {
        display: none;
    }
}

/* Attendance Overview Internal Responsive Fixes */
@media (max-width: 540px) {
    .overview-legend {
        gap: 10px;
    }
    
    .legend-item {
        font-size: 0.7rem;
    }
}

@media (max-width: 420px) {
    .overview-title {
        font-size: 1rem;
    }
    
    #attendance-chart-area {
        margin-top: 0.75rem !important;
    }
}

/* Specific Component Responsive Overrides */
@media (max-width: 640px) {
    #attendance-overview-card .panel-header {
        flex-direction: row !important; /* Keep row but wrap */
        align-items: center !important;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .chart-filter-segment {
        width: 100%; /* Force wrap if tight */
        justify-content: space-between;
    }

    .filter-btn {
        padding: 6px 10px !important;
        font-size: 0.7rem !important;
        flex: 1;
        text-align: center;
    }

    .stat-header {
        margin-bottom: 0.5rem;
    }

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

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
}

@media (max-width: 768px) {
    .sidebar-overlay {
        display: block;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}