:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --appbar-height: 50px;
    --primary-gradient: linear-gradient(135deg, #364865 0%, #2a3a52 100%);
    --bg-light: #f8f9fa;
    --sidebar-bg: #1a1c23;
    --sidebar-hover: #2d2f39;
    --text-muted: #6c757d;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    height: 100vh;
    overflow: hidden;
}

/* Dashboard Grid Layout */
.dashboard-wrapper {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) var(--appbar-height) 1fr;
    height: 100vh;
}

.dashboard-wrapper.no-appbar {
    grid-template-rows: var(--topbar-height) 1fr;
}

/* Sidebar Styling */
.sidebar {
    grid-row: 1 / -1;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: bold;
    border-bottom: 2px solid #364865;
    background: #ffffff;
}

.brand-text {
    color: #364865;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
}

.menu-item {
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    /* Uso de gap para un espaciado consistente y moderno */
    transition: all 0.2s;
}

.menu-item:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.menu-item i {
    width: 20px;
    font-size: 1.15rem;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Icon Colors - Vibrant Palette */
.icon-dashboard {
    color: #4e73df !important;
}

.icon-leads {
    color: #00ff88 !important;
}

.icon-reports {
    color: #00d4ff !important;
}

.icon-settings {
    color: #ffd700 !important;
}

.menu-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 4px solid #364865;
}

/* Topbar Styling */
#sidebarToggle {
    z-index: 10001;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
}

.topbar {
    grid-column: 2;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.topbar-search {
    flex: 0 1 400px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Appbar Styling (Notifications) */
.appbar {
    grid-column: 2;
    background: white;
    border-bottom: 1px solid #eef2f7;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.notif-badge {
    background-color: #ff4757;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 5px;
}

/* Main Content Area */
.main-content {
    grid-column: 2;
    padding: 1.5rem;
    overflow-y: auto;
    background-color: var(--bg-light);
}

/* Premium Card Styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s;
}

.stats-card {
    background: var(--primary-gradient);
    border: none;
}

/* Responsive */
@media (max-width: 992px) {
    .dashboard-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: calc(var(--sidebar-width) * -1);
        /* Fully hidden */
        top: 0;
        bottom: 0;
        width: var(--sidebar-width);
        transition: left 0.3s ease;
        grid-row: auto;
        z-index: 9999 !important;
        display: flex !important;
        transform: none !important;
        /* Disable any transform */
    }

    .sidebar.show {
        left: 0 !important;
        z-index: 10002 !important;
        /* Higher than toggle to cover it if necessary */
    }

    /* Hide the hamburger toggle when sidebar is open to avoid overlap */
    .sidebar.show~.topbar #sidebarToggle {
        visibility: hidden;
    }

    .topbar,
    .appbar,
    .main-content {
        grid-column: 1;
    }
}

/* Keep existing DataTables and Utils styles */
.dataTables_wrapper {
    padding: 0;
}

table.dataTable tbody tr:hover {
    background-color: #f8f9fa !important;
}

.badge-lead-source {
    background-color: #6f42c1;
}

.badge-credit-excellent {
    background-color: #28a745;
}

.badge-credit-good {
    background-color: #ffc107;
    color: #000;
}

.badge-credit-fair {
    background-color: #fd7e14;
}

.badge-status {
    background-color: #17a2b8;
}

.badge-groups {
    background-color: #6c757d;
    font-size: 0.75em;
    margin: 1px;
}

/* Login specific styles */
.login-body {
    background: var(--primary-gradient);
    height: 100vh;
    display: flex;
    align-items: center;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.login-header {
    background: #ffffff;
    color: #364865;
    border-radius: 15px 15px 0 0;
    padding: 2rem;
    text-align: center;
    border-bottom: 2px solid #364865;
}