:root {
    /* Primary Colors - High Contrast & Sophisticated */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --primary-soft: #eef2ff;

    /* Secondary Colors */
    --secondary: #ec4899;
    --secondary-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);

    /* Status Colors */
    --success: #059669;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --success-soft: #ecfdf5;

    --warning: #d97706;
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --warning-soft: #fffbeb;

    --danger: #dc2626;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --danger-soft: #fef2f2;

    --info: #2563eb;
    --info-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --info-soft: #eff6ff;

    /* Neutral Colors - Modern Slate */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;

    /* Effects - Softer Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.1);

    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);

    /* Radius */
    --radius-sm: 0.625rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    /* Gradients */
    --bg-gradient: #ffffff;
    --title-gradient: linear-gradient(to right, #1e1b4b, #4338ca, #6366f1);
}

/* ─── Dark Mode ─────────────────────────────────────────────────────────── */
body[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-dark: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-soft: #334155;

    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-gradient: #0f172a;
    --border: rgba(255, 255, 255, 0.12);
    --border-light: rgba(255, 255, 255, 0.06);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;

    --success-soft: #064e3b;
    --info-soft: #1e3a8a;
    --warning-soft: #78350f;
    --danger-soft: #7f1d1d;

    --glass: rgba(30, 41, 59, 0.85);
    --title-gradient: linear-gradient(to right, #818cf8, #a78bfa, #c084fc);

    background: var(--bg-main);
    color: var(--text-main);
}

body[data-theme="dark"] .app-container {
    background: radial-gradient(circle at top left, #1e293b, #0f172a);
}

body[data-theme="dark"] .main-content {
    background: var(--bg-card);
}

body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .card,
body[data-theme="dark"] .table-container {
    background: var(--bg-card);
    border-color: var(--border);
}

body[data-theme="dark"] .search-input,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    background: #0f172a;
    color: var(--text-main);
    border-color: var(--border);
}

body[data-theme="dark"] .search-input::placeholder,
body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
}

body[data-theme="dark"] table thead tr {
    background: #0f172a;
}

body[data-theme="dark"] table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] table td,
body[data-theme="dark"] table th {
    border-color: var(--border);
    color: var(--text-main);
}

body[data-theme="dark"] .btn-outline {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border);
}

/* ─── Night (Eye Protection) Mode ──────────────────────────────────────── */
body[data-theme="night"] {
    --primary: #d97706;
    --primary-light: #f59e0b;
    --primary-dark: #b45309;
    --primary-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --primary-soft: #fef3c7;

    --bg-main: #f2ead3;
    --bg-card: #fdf8ee;
    --bg-gradient: #f2ead3;
    --border: #c4a98a;
    --border-light: #ddd0bb;
    --text-main: #1a0f00;
    --text-muted: #7c5c34;

    --success-soft: #ebf5eb;
    --info-soft: #e3f0f5;
    --warning-soft: #fdf0d5;
    --danger-soft: #fdebef;

    --glass: rgba(253, 248, 238, 0.9);
    --title-gradient: linear-gradient(to right, #92400e, #b45309, #d97706);

    background: var(--bg-main);
    color: var(--text-main);
    filter: sepia(0.25) brightness(1) contrast(0.95);
}

body[data-theme="night"] .app-container {
    background: radial-gradient(circle at top left, #fdfbf7, #f2ead3);
}

body[data-theme="night"] .main-content {
    background: var(--bg-card);
}

body[data-theme="night"] .search-input,
body[data-theme="night"] input,
body[data-theme="night"] select,
body[data-theme="night"] textarea {
    background: #fdf8ee;
    color: var(--text-main);
    border-color: var(--border);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Match the app-container background to avoid the white gap at bottom */
    background: var(--bg-gradient);
    zoom: 0.8; /* Scales entire UI to 80% for 100% zoom level per user request */
    height: 100%;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
    background: var(--bg-main);
}

h1,
h2,
h3,
h4,
.logo-title,
.page-title,
.stat-value {
    font-family: 'Outfit', sans-serif;
}

.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-gradient);
}

/* Mobile Menu Button - Now visible on all screens in the header */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.mobile-menu-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 20rem;
    height: 125vh; /* Reverted to 125vh to fill the screen under 0.8 zoom */
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: white;
    box-shadow: var(--shadow-xl);
    z-index: 200; 
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Collapsed state for desktop (Gmail style) */
@media (min-width: 1024px) {
    .collapsed-sidebar .sidebar {
        width: 5.5rem;
        transform: translateX(0);
    }
    
    .collapsed-sidebar .sidebar:hover {
        width: 20rem;
        box-shadow: 10px 0 25px rgba(0,0,0,0.1);
    }

    /* Hide text elements smoothly when collapsed and not hovered */
    .collapsed-sidebar .sidebar:not(:hover) .logo-text-wrapper,
    .collapsed-sidebar .sidebar:not(:hover) .nav-link span,
    .collapsed-sidebar .sidebar:not(:hover) .subnav-arrow,
    .collapsed-sidebar .sidebar:not(:hover) .user-details,
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-footer-content {
        visibility: hidden;
        opacity: 0;
        width: 0;
        height: 0;
        overflow: hidden;
        position: absolute;
        transition: opacity 0.2s, visibility 0.2s;
        pointer-events: none;
    }

    /* Hide section labels (Main, Operations) completely when collapsed */
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-nav > ul > li > span {
        display: none !important;
    }

    /* Hide section header list items entirely when collapsed */
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-nav ul li[style*="margin-left: -20px"] {
        display: none !important;
    }

    /* Hide elements that interfere with centering */
    .collapsed-sidebar .sidebar:not(:hover) .user-details,
    .collapsed-sidebar .sidebar:not(:hover) .btn-logout,
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-footer-content {
        display: none !important;
    }

    .collapsed-sidebar .sidebar:not(:hover) .subnav {
        display: none !important;
    }

    /* Show elements smoothly on hover */
    .collapsed-sidebar .sidebar:hover .logo-text-wrapper,
    .collapsed-sidebar .sidebar:hover .nav-link span,
    .collapsed-sidebar .sidebar:hover .subnav-arrow,
    .collapsed-sidebar .sidebar:hover .sidebar-nav > ul > li > span,
    .collapsed-sidebar .sidebar:hover .user-details,
    .collapsed-sidebar .sidebar:hover .btn-logout,
    .collapsed-sidebar .sidebar:hover .sidebar-footer-content {
        visibility: visible;
        opacity: 1;
        width: auto;
        height: auto;
        overflow: visible;
        position: static;
        display: flex !important;
        transition: opacity 0.3s 0.2s, visibility 0.3s 0.2s;
    }

    /* Fix span display to inline when hovered */
    .collapsed-sidebar .sidebar:hover .nav-link span {
        display: inline !important;
    }

    /* Show section header items on hover */
    .collapsed-sidebar .sidebar:hover .sidebar-nav ul li[style*="margin-left: -20px"] {
        display: list-item !important;
    }

    /* Special case for footer content display */
    .collapsed-sidebar .sidebar:hover .sidebar-footer-content {
        display: flex !important;
    }

    /* Adjust logo to fit within collapsed sidebar */
    .collapsed-sidebar .sidebar:not(:hover) .logo-circle {
        transform: scale(0.6);
        transform-origin: center center;
        margin: 0 auto;
    }
    
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-header {
        padding: 1.5rem 0;
        display: flex;
        justify-content: center;
    }

    .collapsed-sidebar .sidebar:not(:hover) .sidebar-logo {
        justify-content: center;
    }

    /* Nav positioning when collapsed - ensure icons are centered and visible */
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-nav {
        padding: 0 0.5rem;
    }

    .collapsed-sidebar .sidebar:not(:hover) .nav-link {
        padding: 0.875rem 0;
        justify-content: center;
        gap: 0;
        margin-bottom: 0.25rem;
        border-radius: 12px;
        position: relative;
    }

    /* Ensure icons are properly sized and visible when collapsed */
    .collapsed-sidebar .sidebar:not(:hover) .nav-link i {
        width: 1.375rem;
        height: 1.375rem;
        flex-shrink: 0;
    }

    /* Tooltip on hover for collapsed nav items */
    .collapsed-sidebar .sidebar:not(:hover) .nav-link:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: #1e1b4b;
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 8px;
        font-size: 0.8125rem;
        font-weight: 600;
        white-space: nowrap;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        pointer-events: none;
    }

    /* Profile user section - centered when collapsed */
    .collapsed-sidebar .sidebar:not(:hover) .sidebar-footer {
        padding: 1rem 0.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .collapsed-sidebar .sidebar:not(:hover) .sidebar-user {
        margin: 0 auto;
        padding: 0.625rem;
        background: transparent;
        border-color: transparent;
        justify-content: center;
        width: auto;
    }

    .collapsed-sidebar .sidebar:not(:hover) .user-info {
        justify-content: center;
        width: auto;
        gap: 0;
    }
    
    .collapsed-sidebar .sidebar:not(:hover) .user-avatar-premium {
        transform: scale(1);
        margin: 0 auto;
    }
}

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 1.5rem 1.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.logo-icon i {
    width: 1.75rem;
    height: 1.75rem;
    color: white;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.logo-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 1.25rem;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.nav-link i {
    width: 1.25rem;
    height: 1.25rem;
}

.nav-link:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.subnav {
    margin: 0.5rem 0 1rem 1.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 0.5rem;
}

.subnav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.subnav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.subnav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.subnav-arrow.rotate {
    transform: rotate(180deg);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: none;
}

.sidebar-user {
    margin: 0 1rem 1.25rem;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.user-avatar-premium {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary-gradient);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8125rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.btn-logout {
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.sidebar-footer-content {
    padding: 0 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
    margin: 0;
}

.version-tag {
    font-size: 0.625rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 20rem;
    overflow-y: auto;
    scroll-behavior: smooth;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-card);
    min-height: 100vh;
}

/* Expanded state when sidebar is collapsed on desktop */
@media (min-width: 1024px) {
    .collapsed-sidebar .main-content {
        margin-left: 5.5rem;
    }
}

@media (max-width: 1023px) {
    .main-content {
        margin-left: 0;
    }
}

.page-content {
    padding: 2.5rem 40px;
    max-width: 100%;
    margin: 0;
    transition: padding 0.3s ease;
}

.account-mgmt-page .page-content {
    padding: 1.5rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .page-content {
        padding: 1.5rem 1rem;
    }
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: var(--title-gradient, linear-gradient(to right, #1e1b4b, #4338ca, #6366f1));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
    font-weight: 500;
}

/* Action Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 600px;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 3.5rem;
    padding: 0 1.25rem 0 3.5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-md);
    transform: translateY(-1px);
}

.button-group {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn i {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    background: var(--border-light);
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    position: relative;
    padding: 2rem;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 15rem;
    height: 15rem;
    background: radial-gradient(circle, currentColor 0%, transparent 70%);
    opacity: 0.05;
    transform: translate(30%, -30%);
    pointer-events: none;
}

.stat-card-blue {
    color: var(--info);
}

.stat-card-purple {
    color: var(--primary);
}

.stat-card-pink {
    color: var(--secondary);
}

.stat-card-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.stat-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    background: #f1f5f9;
    border-radius: var(--radius-full);
    width: fit-content;
}

.stat-icon {
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: var(--radius-lg);
    color: inherit;
}

/* Table */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

thead {
    background: var(--bg-main);
    border-bottom: 2px solid var(--border);
}

th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--primary-soft);
}

td {
    padding: 0.875rem 1.5rem;
    vertical-align: middle;
}

.employee-id {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.875rem;
    font-family: 'Outfit', sans-serif;
}

.employee-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: normal;
    min-width: 200px;
}

.employee-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 4px 10px -2px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.employee-info-main {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.employee-name-link {
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: var(--transition);
}

.employee-name-link:hover {
    color: var(--primary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-active {
    background: #ecfdf5;
    color: #065f46;
}

.badge-outline-indigo {
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    padding: 2rem;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalBounce {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

/* Forms */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-input {
    height: 3rem;
    padding: 0 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    animation: slideInLeft 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #064e3b;
}

.alert-icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Empty State */
.empty-state {
    padding: 6rem 2rem;
    text-align: center;
}

.empty-icon {
    color: var(--border);
    margin-bottom: 1.5rem;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    color: var(--text-muted);
}

/* Responsive Overrides */
@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 2.25rem;
    }
}

/* Total Active Badge in Action Bar */
.total-active-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.total-active-badge:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
}

.total-active-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    color: white;
    flex-shrink: 0;
}

.total-active-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.total-active-count {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.total-active-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Compact Table */
.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: auto;
}

.compact-table th,
.compact-table td {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
}

/* Status */

/* Prevent wrapping on short-content columns */
.compact-table .employee-id,
.compact-table td:nth-child(5),
.compact-table td:nth-child(6) {
    white-space: nowrap;
}

.compact-table .employee-cell {
    min-width: unset;
    gap: 0.625rem;
}

.compact-table .employee-avatar {
    width: 2rem;
    height: 2rem;
    font-size: 0.6875rem;
    flex-shrink: 0;
}

.compact-table .employee-id {
    font-size: 0.75rem;
}

.compact-table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
}

.compact-table th {
    padding: 0.75rem;
    white-space: nowrap;
    font-size: 0.6875rem;
}

/* Compact badges inside table */
.compact-table .badge {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

/* Contact Cell - stacked email & phone */
.contact-cell {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.contact-email {
    color: var(--text-main);
    font-size: 0.8125rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-phone {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Employee position subtitle */
.employee-position-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Responsive: action bar */
@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .button-group {
        flex-wrap: wrap;
    }

    .total-active-badge {
        flex: 1;
        justify-content: center;
    }
}

/* Modern Masterlist Card UI */
.master-list-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.master-item-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.5s ease-out both;
}

.master-item-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #4f46e5, #9333ea);
    opacity: 0;
    transition: 0.3s;
}

.master-item-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.2);
    border-color: var(--primary-light);
    background: var(--bg-card);
    z-index: 10;
}

.master-item-card:hover::before {
    opacity: 1;
}

.master-card-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* 3-Layer Master Avatar */
.master-avatar-3layer {
    width: 60px; height: 60px;
    position: relative; flex-shrink: 0;
}
.master-avatar-ring {
    width: 100%; height: 100%;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 50%, #ec4899 100%);
}
body[data-theme="night"] .master-avatar-ring {
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #facc15 100%);
}
.master-avatar-inner {
    width: 100%; height: 100%;
    border-radius: 50%;
    padding: 3px;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
body[data-theme="dark"] .master-avatar-inner { background: #1e293b; }
body[data-theme="night"] .master-avatar-inner { background: #3d2b1f; }

.master-avatar-inner img { width: 100%; height: 100%; object-fit: cover; }
.master-avatar-initials { font-size: 1.1rem; font-weight: 800; color: #3b82f6; font-family: 'Outfit', sans-serif; }
body[data-theme="night"] .master-avatar-initials { color: #fb923c; }

.master-info {
    display: flex;
    flex-direction: column;
}

.master-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
    text-transform: none;
    font-family: 'Outfit', sans-serif;
}

.master-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.master-card-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.master-box-badge {
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.master-action-arrow {
    color: #cbd5e1;
    transition: 0.3s;
}

.master-item-card:hover .master-action-arrow {
    color: #4f46e5;
    transform: translateX(4px);
}

@media (max-width: 640px) {
    .master-item-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .master-card-right {
        width: 100%;
        justify-content: space-between;
    }
    .master-avatar-wrapper {
        width: 60px;
        height: 60px;
    }
}

/* Box Header Styling */
.box-header-card {
    margin: 1.5rem 0 0.5rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.box-number-circle {
    width: 32px;
    height: 32px;
    background: #1e1b4b;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

.box-title-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

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

.pagination-container {
    padding: 2rem 0;
    border-top: 1px solid #f1f5f9;
    margin-top: 2rem;
}

/* Global Dashboard & Summary Card Styles */
.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.summary-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-sm);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-icon-box {
    width: 3rem;
    height: 3rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon-box i { width: 1.5rem; height: 1.5rem; }

.card-primary .card-icon-box { background: rgba(79, 70, 229, 0.1); color: #4f46e5; }
.card-info .card-icon-box { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; }
.card-warning .card-icon-box { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.card-danger .card-icon-box { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.card-stats { display: flex; flex-direction: column; min-width: 0; }
.stats-value { font-size: 1.5rem; font-weight: 800; color: var(--text-main); font-family: 'Outfit', sans-serif; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* Dashboard Specific Layout */
.dashboard-main-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
}

.dashboard-column { display: flex; flex-direction: column; gap: 2rem; }

.dashboard-section {
    background: var(--bg-card);
    border-radius: 28px;
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}