:root {
    --primary: #0D9488;
    --primary-light: #2DD4BF;
    --primary-dark: #0F766E;
    --brand-red: #A81C1C;
    --brand-orange: #F97316;
    --secondary: #64748B;
    --accent: var(--brand-orange);
    --success: #10B981;
    --danger: #EF4444;
    --dark: #0F172A;
    --light: #F8FAF9;
    --white: #FFFFFF;
    --sidebar-width: 250px;
    --radius: 16px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow: 0 10px 15px -3px rgba(0,0,0,0.04), 0 4px 6px -2px rgba(0,0,0,0.02);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.06), 0 10px 10px -5px rgba(0,0,0,0.04);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: #f0f4f4;
    background-image: 
        radial-gradient(at 0% 0%, rgba(13, 148, 136, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(45, 212, 191, 0.05) 0px, transparent 50%);
    color: var(--dark);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-size: 0.9rem;
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    
    .card-grid {
        grid-template-columns: 1fr !important;
    }
    
    .main-content {
        padding: 1rem !important;
        margin-left: 0 !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
}

.mobile-card {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .responsive-table thead { display: none; }
    .responsive-table tr { 
        display: block; 
        margin-bottom: 1rem; 
        background: white; 
        border-radius: 12px; 
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        border: 1px solid #e2e8f0;
    }
    .responsive-table td { 
        display: flex; 
        justify-content: space-between; 
        padding: 0.5rem 0; 
        border: none;
        text-align: right;
    }
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 700;
        text-align: left;
        color: #64748b;
    }
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    height: 100vh;
    position: fixed;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid rgba(0,0,0,0.04);
    box-shadow: 4px 0 20px rgba(0,0,0,0.01);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--secondary);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(13, 148, 136, 0.08);
    color: var(--primary);
}

.sidebar-brand {
    margin-bottom: 2rem;
    padding: 0.5rem;
    text-align: center;
    position: relative;
}

.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(13, 148, 136, 0.1), transparent);
}

.sidebar-logo {
    max-width: 130px;
    max-height: 70px;
    object-fit: contain;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
    mix-blend-mode: multiply;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 0.9rem;
    gap: 1rem;
    margin: 0.2rem 0;
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    opacity: 0.8;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(13, 148, 136, 0.04);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-link:hover i {
    opacity: 1;
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary) !important;
    color: var(--white) !important;
    box-shadow: 0 8px 20px -5px rgba(13, 148, 136, 0.4);
}

.nav-link.active i {
    opacity: 1;
    color: var(--white) !important;
}

.nav-link.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px -5px rgba(13, 148, 136, 0.5);
}

.nav-link.submenu-open:not(.active) {
    background: rgba(13, 148, 136, 0.05);
    color: var(--primary);
}

/* Submenu Styling */
.submenu {
    list-style: none;
    padding-left: 2.8rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.submenu::before {
    content: '';
    position: absolute;
    left: 2rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(13, 148, 136, 0.1);
    border-radius: 2px;
}

.submenu li a {
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.25s;
    margin-bottom: 0.25rem;
}

.submenu li a:hover {
    color: var(--primary);
    background: rgba(13, 148, 136, 0.05);
    padding-left: 1.25rem;
}

.submenu li a i {
    width: 18px;
    font-size: 0.85rem;
    margin-right: 0.75rem;
    opacity: 0.6;
}

.submenu li a.active-sub {
    color: var(--primary);
    background: rgba(13, 148, 136, 0.12);
    font-weight: 700;
}

.submenu li a.active-sub i {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.1);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 100%;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.04em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
    background: var(--white);
    border-radius: 9999px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.03);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Cards & Components */
.card {
    background: var(--white);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.02);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover::after {
    opacity: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.02);
    transition: all 0.3s;
}

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

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    font-size: 1.75rem;
    background: rgba(13, 148, 136, 0.1);
    color: var(--primary);
}

.stat-info h3 {
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-info p {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.02em;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border-radius: 14px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    gap: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 10px 20px -5px rgba(13, 148, 136, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(13, 148, 136, 0.5);
}

/* Action Icons in Tables */
.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: var(--secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    margin-right: 4px;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary);
}

/* Specific Action Variants */
.btn-icon.btn-view { color: #6366f1; background: #eef2ff; border-color: #e0e7ff; }
.btn-icon.btn-view:hover { background: #e0e7ff; color: #4338ca; }

.btn-icon.btn-edit { color: #0d9488; background: #f0fdfa; border-color: #ccfbf1; }
.btn-icon.btn-edit:hover { background: #ccfbf1; color: #0f766e; }

.btn-icon.btn-delete { color: #ef4444; background: #fef2f2; border-color: #fee2e2; }
.btn-icon.btn-delete:hover { background: #fee2e2; color: #991b1b; }

.btn-icon.btn-ledger { color: #f59e0b; background: #fffbeb; border-color: #fef3c7; }
.btn-icon.btn-ledger:hover { background: #fef3c7; color: #b45309; }

.btn-icon.btn-download { color: #8b5cf6; background: #f5f3ff; border-color: #ede9fe; }
.btn-icon.btn-download:hover { background: #ede9fe; color: #6d28d9; }

.btn-icon i {
    transition: transform 0.2s;
}

.btn-icon:hover i {
    transform: scale(1.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 1rem;
    color: #475569;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.table tr td {
    padding: 1rem;
    border-bottom: 1px solid #f8fafc;
    vertical-align: middle;
    color: #475569;
    background: transparent;
}

.table tr:hover td {
    background: #f8fafc;
}

.table tr td:first-child, 
.table tr td:last-child {
    border-radius: 0;
    border-left: none;
    border-right: none;
}

/* Login Page Overhaul */
.login-page {
    background: url('../img/login-bg.png') no-repeat center center fixed;
    background-size: cover;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.9) 100%);
    backdrop-filter: blur(2px);
}

.login-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 3.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 32px;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.5);
    text-align: center;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header img {
    max-width: 160px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.login-form .form-label {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--dark);
    display: block;
}

.login-form .form-control {
    height: 3.75rem;
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    padding: 0 1.5rem 0 3.25rem;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-form .input-group {
    position: relative;
}

.login-form .input-group i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
    font-size: 1.1rem;
}

.login-btn {
    width: 100%;
    height: 3.75rem;
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Lightbox Enhancements */
.lb-overlay {
    backdrop-filter: blur(15px);
    background: rgba(0,0,0,0.92);
}

.menu-toggle {
    display: none;
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.05);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-size: 1.25rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.menu-toggle:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(13, 148, 136, 0.3);
}

/* Logo styles consolidated above */

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); width: 300px; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 2rem; }
    .menu-toggle { display: flex; }
    .header h1 { font-size: 1.75rem; }
    
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 999;
    }
}

.lb-nav {
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.05);
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); width: 300px; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 2rem; }
    .menu-toggle { display: flex; }
    .header h1 { font-size: 1.75rem; }
}

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

/* Animations */
.fade-in { animation: fadeIn 0.5s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Desktop Sidebar Collapse */
@media (min-width: 1025px) {
    :root {
        --sidebar-collapsed-width: 80px;
    }
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
        padding: 1.5rem 0.5rem;
    }
    body.sidebar-collapsed .sidebar-brand {
        justify-content: center !important;
        padding: 0.5rem 0 !important;
    }
    body.sidebar-collapsed .sidebar-brand::after {
        left: 0.5rem;
        right: 0.5rem;
    }
    body.sidebar-collapsed .sidebar-logo {
        display: none !important;
    }
    body.sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 0.85rem 0;
    }
    body.sidebar-collapsed .nav-link span {
        display: none !important;
    }
    body.sidebar-collapsed .nav-link .toggle-icon {
        display: none !important;
    }
    body.sidebar-collapsed .submenu {
        display: none !important;
    }
    body.sidebar-collapsed .nav-link:hover {
        transform: none !important;
    }
    body.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
}
