* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #ddd;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --sidebar-width: clamp(180px, 16vw, 220px);
    --sidebar-collapsed-width: clamp(60px, 7vw, 70px);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.2);
}

/* Light Mode Sidebar Variables */
:root {
    --sidebar-bg-light: linear-gradient(180deg, rgba(102, 126, 234, 0.98) 0%, rgba(118, 75, 162, 0.98) 100%);
    --sidebar-header-light: rgba(255, 255, 255, 0.1);
    --sidebar-link-light: rgba(255, 255, 255, 0.1);
    --sidebar-link-hover-light: rgba(255, 255, 255, 0.2);
    --sidebar-link-active-light: rgba(255, 255, 255, 0.25);
    --sidebar-text-light: rgba(255, 255, 255, 0.95);
    --sidebar-border-light: rgba(255, 255, 255, 0.15);
}

/* Dark Mode Variables - Default */
:root {
    --dm-bg-primary: #1a1a1a;
    --dm-bg-secondary: #2d2d2d;
    --dm-bg-tertiary: #3a3a3a;
    --dm-text-primary: #e0e0e0;
    --dm-text-secondary: #b0b0b0;
    --dm-border-color: #404040;
    --dm-card-bg: #252525;
    --dm-sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #2d1b3d 100%);
    --dm-header-bg: linear-gradient(135deg, #1e1e2e 0%, #2d1b3d 100%);
    --dm-body-bg: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    --sidebar-bg-dark: linear-gradient(180deg, rgba(26, 26, 46, 0.98) 0%, rgba(45, 27, 61, 0.98) 100%);
    --sidebar-header-dark: rgba(255, 255, 255, 0.05);
    --sidebar-link-dark: rgba(255, 255, 255, 0.08);
    --sidebar-link-hover-dark: rgba(255, 255, 255, 0.15);
    --sidebar-link-active-dark: rgba(255, 255, 255, 0.2);
    --sidebar-text-dark: rgba(224, 224, 224, 0.95);
    --sidebar-border-dark: rgba(255, 255, 255, 0.1);
}

/* Dark Mode Styles - Applied by default */
body.dark-mode {
    background: var(--dm-body-bg);
    color: var(--dm-text-primary);
}

body.dark-mode .mobile-header {
    background: var(--dm-header-bg);
}

body.dark-mode .sidebar {
    background: var(--sidebar-bg-dark);
    border-right: 1px solid var(--sidebar-border-dark);
}

body.dark-mode .sidebar-header {
    background: var(--sidebar-header-dark);
    border-bottom-color: var(--sidebar-border-dark);
}

body.dark-mode .nav-link {
    color: var(--sidebar-text-dark);
    background: transparent;
}

body.dark-mode .nav-link:hover {
    background: var(--sidebar-link-hover-dark);
    border-left-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 1);
}

body.dark-mode .nav-link.active {
    background: var(--sidebar-link-active-dark);
    border-left-color: rgba(255, 255, 255, 0.9);
    color: rgba(255, 255, 255, 1);
}

body.dark-mode .nav-brand {
    color: var(--sidebar-text-dark);
}

body.dark-mode .sidebar-close {
    background: var(--sidebar-link-dark);
    color: var(--sidebar-text-dark);
}

body.dark-mode .sidebar-close:hover {
    background: var(--sidebar-link-hover-dark);
}

body.dark-mode .sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.dark-mode .main-content {
    background: var(--dm-card-bg);
    color: var(--dm-text-primary);
}

body.dark-mode .card {
    background: var(--dm-bg-secondary);
    color: var(--dm-text-primary);
}

body.dark-mode table {
    background: var(--dm-bg-secondary);
    color: var(--dm-text-primary);
}

body.dark-mode table th {
    background: var(--dm-bg-tertiary);
    color: var(--dm-text-primary);
}

body.dark-mode table th:first-child {
    background: var(--dm-bg-tertiary);
}

body.dark-mode table td {
    border-bottom-color: var(--dm-border-color);
}

body.dark-mode table tbody tr td:first-child {
    background: var(--dm-bg-secondary);
}

body.dark-mode table tbody tr:hover td:first-child {
    background: var(--dm-bg-tertiary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: var(--dm-bg-tertiary);
    border-color: var(--dm-border-color);
    color: var(--dm-text-primary);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
    border-color: var(--primary-color);
    background: var(--dm-bg-secondary);
}

body.dark-mode .page-header {
    border-bottom-color: var(--dm-border-color);
}

body.dark-mode .item-row {
    background: var(--dm-bg-tertiary);
}

body.dark-mode .item-row:hover {
    background: var(--dm-bg-secondary);
}

body.dark-mode .alert-success {
    background: linear-gradient(135deg, #1e3a1e, #2d4a2d);
    color: #90ee90;
    border-left-color: var(--secondary-color);
}

body.dark-mode .alert-error {
    background: linear-gradient(135deg, #3a1e1e, #4a2d2d);
    color: #ff9999;
    border-left-color: var(--danger-color);
}

body.dark-mode .table-container {
    background: transparent;
}

body.dark-mode .table-container::-webkit-scrollbar-track {
    background: var(--dm-bg-tertiary);
}

body.dark-mode .table-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

body.dark-mode .table-container::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    animation: fadeIn 0.5s ease-in;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-size: clamp(14px, 1.5vw, 16px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auto Responsive Header */
.mobile-header {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: clamp(0.5rem, 2vw, 1rem);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    height: clamp(50px, 8vh, 60px);
}

.mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding-left: clamp(3rem, 15vw, 4rem);
}

.mobile-company-name {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    letter-spacing: 0.5px;
}

.mobile-company-name i {
    font-size: clamp(1.2rem, 3.5vw, 1.5rem);
}

.mobile-company-name span {
    white-space: nowrap;
}

/* Menu Toggle Button - Auto responsive */
.mobile-menu-toggle {
    display: flex;
    position: fixed;
    top: clamp(0.5rem, 2vw, 0.75rem);
    left: clamp(0.5rem, 2vw, 0.75rem);
    z-index: 1001;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: clamp(0.5rem, 2vw, 0.75rem);
    border-radius: 50%;
    cursor: pointer;
    font-size: clamp(1rem, 3vw, 1.3rem);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: clamp(40px, 10vw, 48px);
    height: clamp(40px, 10vw, 48px);
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 40px;
    min-height: 40px;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: fixed;
    top: clamp(0.5rem, 2vw, 0.75rem);
    right: clamp(0.5rem, 2vw, 0.75rem);
    z-index: 1001;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: 50%;
    cursor: pointer;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: clamp(36px, 9vw, 44px);
    height: clamp(36px, 9vw, 44px);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 36px;
    min-height: 36px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(20deg);
}

body.dark-mode .theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

body.dark-mode .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-menu-toggle:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mobile-menu-toggle i {
    pointer-events: none;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar - Modern Auto Responsive */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-collapsed-width);
    height: 100vh;
    background: var(--sidebar-bg-light);
    color: var(--sidebar-text-light);
    z-index: 999;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.1),
                inset -1px 0 0 rgba(255, 255, 255, 0.05);
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(0);
    backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid var(--sidebar-border-light);
    display: flex;
    flex-direction: column;
}

/* Sidebar expanded on hover or when active */
.sidebar:hover,
.sidebar.active {
    width: var(--sidebar-width);
}

.sidebar:hover .nav-link span,
.sidebar.active .nav-link span {
    opacity: 1;
    visibility: visible;
    margin-left: 0;
    width: auto;
}


/* Sidebar header always maintains consistent padding */

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--sidebar-bg-light);
    z-index: -1;
    transition: background 0.3s ease;
    opacity: 1;
}

body.dark-mode .sidebar::before {
    background: var(--sidebar-bg-dark);
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 20%, 
        rgba(255, 255, 255, 0.2) 80%, 
        transparent 100%);
    pointer-events: none;
    transition: background 0.3s ease;
}

body.dark-mode .sidebar::after {
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 20%, 
        rgba(255, 255, 255, 0.1) 80%, 
        transparent 100%);
}

.sidebar-header {
    padding: clamp(1rem, 3vw, 1.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border-light);
    background: var(--sidebar-header-light);
    backdrop-filter: blur(20px);
    transition: padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                border-color 0.3s ease;
    white-space: nowrap;
    overflow: visible;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    min-height: clamp(50px, 8vh, 60px);
    width: 100%;
    box-sizing: border-box;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 20%, 
        rgba(255, 255, 255, 0.3) 80%, 
        transparent 100%);
    transition: background 0.3s ease;
}

body.dark-mode .sidebar-header::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.15) 20%, 
        rgba(255, 255, 255, 0.15) 80%, 
        transparent 100%);
}

.nav-brand {
    display: flex;
    align-items: center;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: bold;
    color: white;
    animation: slideInLeft 0.5s ease-out;
    white-space: nowrap;
    overflow: visible;
    position: relative;
    z-index: 2;
    flex: 1;
    min-width: 0;
}

.nav-brand span {
    opacity: 0;
    visibility: hidden;
    margin-left: -10px;
    width: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-block;
}

/* Show header text when sidebar is expanded */
.sidebar:hover .nav-brand span,
.sidebar.active .nav-brand span {
    opacity: 1 !important;
    visibility: visible !important;
    margin-left: clamp(0.5rem, 1.5vw, 0.75rem) !important;
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
}

/* Header text is always visible - no hover/active states needed */

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-brand i {
    margin-right: 0;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    transition: margin-right 0.4s;
    flex-shrink: 0;
}

.sidebar:hover .nav-brand i,
.sidebar.active .nav-brand i {
    margin-right: clamp(0.5rem, 1.5vw, 0.75rem);
}

.sidebar-close {
    display: flex;
    background: var(--sidebar-link-light);
    border: none;
    color: var(--sidebar-text-light);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    cursor: pointer;
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease;
    width: clamp(36px, 8vw, 40px);
    height: clamp(36px, 8vw, 40px);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-close:hover {
    background: var(--sidebar-link-hover-light);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-nav {
    padding: clamp(0.75rem, 2vw, 1rem) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: align-items 0.4s;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar:hover .sidebar-nav,
.sidebar.active .sidebar-nav {
    align-items: stretch;
}

.nav-menu {
    list-style: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: align-items 0.4s;
}

.sidebar:hover .nav-menu,
.sidebar.active .nav-menu {
    align-items: stretch;
}

.nav-menu li {
    margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
    padding: 0;
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
    width: 100%;
    display: flex;
    justify-content: center;
    transition: justify-content 0.4s, padding 0.4s;
}

.sidebar:hover .nav-menu li,
.sidebar.active .nav-menu li {
    justify-content: flex-start;
    padding: 0 clamp(0.25rem, 1vw, 0.5rem);
}

.nav-menu li:nth-child(1) { animation-delay: 0.1s; }
.nav-menu li:nth-child(2) { animation-delay: 0.2s; }
.nav-menu li:nth-child(3) { animation-delay: 0.3s; }
.nav-menu li:nth-child(4) { animation-delay: 0.4s; }
.nav-menu li:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-link {
    display: flex;
    align-items: center;
    padding: clamp(0.75rem, 2vw, 1rem);
    color: var(--sidebar-text-light);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                color 0.3s ease,
                transform 0.2s ease;
    border-left: 3px solid transparent;
    border-radius: 0 16px 16px 0;
    margin: clamp(0.15rem, 0.5vw, 0.25rem) 0;
    position: relative;
    overflow: hidden;
    justify-content: center;
    width: 100%;
    min-height: clamp(44px, 8vh, 56px);
    background: transparent;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.sidebar:hover .nav-link,
.sidebar.active .nav-link {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem);
    justify-content: flex-start;
    margin: 0 clamp(0.25rem, 1vw, 0.5rem);
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    background: var(--sidebar-link-hover-light);
    border-left-color: rgba(255, 255, 255, 0.8);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.15),
                0 0 20px rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
}

.nav-link.active {
    background: var(--sidebar-link-active-light);
    border-left-color: rgba(255, 255, 255, 1);
    font-weight: 600;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                0 0 30px rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
    position: relative;
    color: rgba(255, 255, 255, 1);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.6) 0%, 
        rgba(255, 255, 255, 1) 50%, 
        rgba(255, 255, 255, 0.6) 100%);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6),
                inset 0 0 10px rgba(255, 255, 255, 0.3);
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.6),
                    inset 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
                    inset 0 0 15px rgba(255, 255, 255, 0.5);
    }
}

.nav-link.active::after {
    content: '';
    position: absolute;
    right: clamp(0.5rem, 2vw, 1rem);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.nav-link i {
    width: clamp(20px, 5vw, 24px);
    margin-right: 0;
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    transition: transform 0.3s, margin-right 0.4s;
    flex-shrink: 0;
}

.sidebar:hover .nav-link i,
.sidebar.active .nav-link i {
    margin-right: clamp(0.75rem, 2vw, 1rem);
}

.nav-link:hover i {
    transform: scale(1.2) rotate(5deg);
}

.nav-link span {
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                letter-spacing 0.3s,
                margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    margin-left: -10px;
    width: 0;
    overflow: hidden;
}

.sidebar:hover .nav-link span,
.sidebar.active .nav-link span {
    opacity: 1;
    visibility: visible;
    margin-left: 0;
    width: auto;
}

.nav-link:hover span {
    letter-spacing: 0.5px;
}

/* Tooltip for collapsed sidebar */
.nav-link {
    position: relative;
}

.nav-link[title]::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.75rem, 2vw, 1rem);
    border-radius: 8px;
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.nav-link[title]::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1001;
}

.sidebar:not(:hover):not(.active) .nav-link:hover::after,
.sidebar:not(:hover):not(.active) .nav-link:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Main Wrapper - Auto responsive */
.main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
    min-height: 100vh;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: clamp(0.5rem, 2vw, 1rem);
    padding-top: clamp(4rem, 12vh, 4.5rem);
}

.sidebar:hover ~ .main-wrapper,
.sidebar.active ~ .main-wrapper {
    margin-left: var(--sidebar-width);
}

/* Sidebar auto-responsive - always visible, adapts automatically */
.sidebar {
    transform: translateX(0);
}


/* Main Content - Auto responsive */
.main-content {
    background: white;
    padding: clamp(1rem, 4vw, 2rem);
    border-radius: clamp(12px, 3vw, 20px);
    box-shadow: var(--shadow-lg);
    min-height: calc(100vh - clamp(2rem, 8vh, 4rem));
    max-width: 1400px;
    margin: 0 auto clamp(0.75rem, 2vw, 1rem);
    animation: slideUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
    margin-top: clamp(3.5rem, 10vh, 4rem);
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--warning-color));
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page Header - Auto responsive */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
    padding-bottom: clamp(0.75rem, 2vw, 1rem);
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: clamp(0.75rem, 2vw, 1rem);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: clamp(60px, 15vw, 100px);
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    animation: expandWidth 1s ease-out;
}

@keyframes expandWidth {
    from {
        width: 0;
    }
    to {
        width: clamp(60px, 15vw, 100px);
    }
}

.page-header h1 {
    color: var(--dark-color);
    font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.btn {
    display: inline-block;
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1.2rem, 3vw, 1.5rem);
    border: none;
    border-radius: clamp(8px, 2vw, 12px);
    cursor: pointer;
    text-decoration: none;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    min-height: clamp(40px, 8vh, 48px);
    width: auto;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #357abd);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-color), #45b069);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c0392b);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #d68910);
    color: white;
}

/* Tables - Auto responsive */
.table-container {
    overflow-x: auto;
    margin-top: clamp(1rem, 3vw, 1.5rem);
    -webkit-overflow-scrolling: touch;
    border-radius: clamp(8px, 2vw, 12px);
    box-shadow: var(--shadow-sm);
    touch-action: pan-x;
    scroll-behavior: smooth;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.table-container::-webkit-scrollbar {
    height: clamp(6px, 1.5vw, 8px);
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: clamp(0.75rem, 2vw, 1rem);
    min-width: max(600px, 100%);
    background: white;
    border-radius: clamp(8px, 2vw, 12px);
    overflow: hidden;
    touch-action: pan-x;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
}

table th,
table td {
    padding: clamp(0.75rem, 2vw, 1rem);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    min-width: clamp(100px, 15vw, 120px);
    white-space: nowrap;
}

table th:first-child,
table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 10;
    min-width: clamp(120px, 20vw, 150px);
    max-width: clamp(120px, 20vw, 150px);
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    padding-left: clamp(0.75rem, 2vw, 1rem);
    padding-right: clamp(0.75rem, 2vw, 1rem);
}

table th:first-child {
    background: var(--light-color);
    z-index: 11;
}

table tbody tr td:first-child {
    background: white;
}

table tbody tr:hover td:first-child {
    background: #f5f5f5;
}

table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 600;
    color: var(--dark-color);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    letter-spacing: 0.5px;
}

table tr {
    transition: all 0.3s;
    pointer-events: auto;
}

table tr:hover {
    background: linear-gradient(90deg, rgba(74, 144, 226, 0.05), rgba(80, 200, 120, 0.05));
}

table tr:last-child td {
    border-bottom: none;
}

/* Ensure buttons in tables are clickable */
table .btn,
table .action-buttons a,
table .action-buttons button {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    position: relative;
    z-index: 20;
}

.table-container .btn,
.table-container .action-buttons a,
.table-container .action-buttons button {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    position: relative;
    z-index: 20;
}

/* Forms - Auto responsive */
.form-group {
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: clamp(0.4rem, 1vw, 0.5rem);
    font-weight: 600;
    color: var(--dark-color);
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    border: 2px solid var(--border-color);
    border-radius: clamp(8px, 2vw, 10px);
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-family: inherit;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
    transform: translateY(-2px);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 30vw, 250px), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
}

/* Cards - Auto responsive */
.card {
    background: white;
    border-radius: clamp(12px, 3vw, 16px);
    padding: clamp(1rem, 3vw, 1.5rem);
    box-shadow: var(--shadow-md);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s;
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    font-weight: 600;
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1vw, 0.5rem);
}

.card-header i {
    color: var(--primary-color);
}

/* Dashboard Stats - Auto responsive */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 25vw, 250px), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), #357abd);
    color: white;
    padding: clamp(1.5rem, 4vw, 2rem);
    border-radius: clamp(16px, 4vw, 20px);
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

.stat-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.stat-card.success {
    background: linear-gradient(135deg, var(--secondary-color), #45b069);
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger-color), #c0392b);
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning-color), #d68910);
}

.stat-card h3 {
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    opacity: 0.9;
    margin-bottom: clamp(0.4rem, 1vw, 0.5rem);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: bold;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Badges - Auto responsive */
.badge {
    display: inline-block;
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.75rem, 2vw, 1rem);
    border-radius: clamp(16px, 4vw, 20px);
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.badge:hover {
    transform: scale(1.1);
}

.badge-success {
    background: linear-gradient(135deg, var(--secondary-color), #45b069);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning-color), #d68910);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, var(--danger-color), #c0392b);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, var(--primary-color), #357abd);
    color: white;
}

/* Alerts - Auto responsive */
.alert {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem);
    border-radius: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    border-left: 4px solid;
    animation: slideInRight 0.5s ease-out;
    box-shadow: var(--shadow-sm);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left-color: var(--secondary-color);
}

.alert-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left-color: var(--danger-color);
}

/* Actions - Auto responsive */
.action-buttons {
    display: flex;
    gap: clamp(0.4rem, 1vw, 0.5rem);
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.action-buttons a,
.action-buttons button {
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    font-size: clamp(0.85rem, 1.8vw, 0.9rem);
    border: none;
    border-radius: clamp(6px, 1.5vw, 8px);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 10;
    min-height: clamp(40px, 8vh, 48px);
}

.action-buttons a:hover,
.action-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Invoice Items - Auto responsive */
.invoice-items {
    margin-top: clamp(1rem, 3vw, 1.5rem);
}

.item-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 20vw, 200px), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    align-items: end;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: #f8f9fa;
    border-radius: clamp(8px, 2vw, 10px);
    transition: all 0.3s;
}

.item-row:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: clamp(4px, 1vw, 6px);
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Smooth Transitions */
* {
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
