:root {
    --primary-color: #6366f1;
    /* Indigo */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --info-color: #0ea5e9;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #0f172a;
    --light-color: #f8fafc;

    --crm-sidebar-width: 280px;
    --crm-sidebar-bg: #0f172a;
    --crm-sidebar-active-bg: rgba(255, 255, 255, 0.1);

    --crm-border-radius: 1rem;
    --crm-card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

body {
    background-color: #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #334155;
    -webkit-font-smoothing: antialiased;
}

/* Typography Enhancements */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.text-xs {
    font-size: 0.75rem;
}

.x-small {
    font-size: 0.8rem;
}

.font-weight-bold {
    font-weight: 700;
}

.letter-spacing-1 {
    letter-spacing: 0.05rem;
}

.line-height-1 {
    line-height: 1.1 !important;
}

.fw-600 {
    font-weight: 600;
}

.fw-800 {
    font-weight: 800;
}

/* Layout Structure */
.crm-sidebar {
    width: var(--crm-sidebar-width);
    min-width: var(--crm-sidebar-width);
    min-height: 100vh;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    flex-direction: column;
    background-color: var(--crm-sidebar-bg) !important;
}

.crm-sidebar .nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    color: #cbd5e1 !important;
}

.crm-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff !important;
    transform: translateX(4px);
}

.crm-sidebar .nav-link.active {
    background: var(--crm-sidebar-active-bg) !important;
    border-left: 4px solid var(--primary-color);
    font-weight: 700;
    color: #fff !important;
}

/* Avatar Utilities */
.crm-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--primary-gradient);
    color: white;
}

.crm-avatar.x-small {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.crm-avatar.lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

/* Dashboard Cards (Glassmorphism & Premium UI) */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--crm-border-radius);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--crm-card-shadow) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
}

.card-header h6 {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-color) !important;
}

/* Forms UI */
.form-control,
.form-select {
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
    background-color: #f8fafc;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-group-text {
    border-radius: 0.75rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* Buttons */
.btn {
    border-radius: 0.75rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
    color: white;
}

.btn-outline-primary {
    border-color: #cbd5e1;
    color: #475569;
}

.btn-outline-primary:hover {
    background: var(--light-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Table Enhancements */
.table {
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0;
}

.table thead th {
    background-color: transparent !important;
    border: none;
    border-bottom: 2px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
}

.table tbody tr {
    background-color: transparent;
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8fafc;
    transform: scale(1.001);
}

.table tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #334155;
}

/* Custom Badge Styles */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 2rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.bg-primary-subtle {
    background-color: rgba(99, 102, 241, 0.1) !important;
    color: var(--primary-color) !important;
    border: 1px solid rgba(99, 102, 241, 0.2) !important;
}

.bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: var(--success-color) !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

.bg-info-subtle {
    background-color: rgba(14, 165, 233, 0.1) !important;
    color: var(--info-color) !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
}

.bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.1) !important;
    color: var(--warning-color) !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
}

.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger-color) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.rounded-pill {
    border-radius: 10rem !important;
}

/* Custom Switch */
.custom-switch-lg .form-check-input {
    width: 2.8em;
    height: 1.5em;
    border-radius: 1rem;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: fadeIn 0.4s ease-out;
}

.text-muted {
    color: #64748b !important;
}