: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%;
    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: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 2.5rem;
}

.sidebar-logo-icon {
    width: 80px;
    height: 60px;
    filter: drop-shadow(0 0 15px rgba(255,255,255,0.2));
}

.sidebar-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Already has navy filter in RCL, but here we want it white for the blue sidebar */
    filter: brightness(0) invert(1);
}

.sidebar-brand-name {
    color: white;
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: -0.8px;
    text-transform: uppercase;
    text-align: center;
}

.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;
}

.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: 1000;
}

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

.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;
}

.system-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 56, 147, 0.05);
    color: #003893;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.breadcrumb-divider {
    color: #cbd5e1;
    display: flex;
    align-items: center;
}

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

.current-page-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.5px;
}


.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: 48px;
    height: 48px;
    border-radius: 14px;
    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: 1100;
    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: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.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;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.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: 1rem;
}

.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);
}

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

.stat-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.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.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

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

.stat-main-val {
    font-size: 2rem;
    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: 1fr 1fr;
    grid-template-areas: 
        "overview activity"
        "insights actions";
    gap: 1rem;
    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; }
#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%;
    background: rgba(255, 255, 255, 0.95);
    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: 9999;
    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;
}

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

.dropdown-info {
    padding: 16px 20px;
    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: 8px 10px;
}

.dropdown-link {
    display: flex !important;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    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: 2000;
    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; }
}