Index: backend/src/main/java/medora/controller/AppointmentController.java
===================================================================
--- backend/src/main/java/medora/controller/AppointmentController.java	(revision 84249b19ce0ac1cc4b9f406f63132d99f6759053)
+++ backend/src/main/java/medora/controller/AppointmentController.java	(revision a64c772a36870a2e14746a963e20b1e6ec1e1538)
@@ -243,5 +243,5 @@
             }
 
-            // Verify appointment exists and check permissions for patients
+            // Verify appointment exists and check permissions
             Appointment appointment = appointmentService.getAppointmentById(appointmentId)
                     .orElseThrow(() -> new RuntimeException("Appointment not found"));
@@ -251,4 +251,11 @@
                 Long appointmentPatientId = appointment.getPatient() != null ? appointment.getPatient().getPatientId() : null;
                 if (patientIdFromToken == null || !patientIdFromToken.equals(appointmentPatientId)) {
+                    return ResponseEntity.status(HttpStatus.FORBIDDEN)
+                            .body(Map.of("error", "You can only cancel your own appointments"));
+                }
+            } else if (role.equals("DOCTOR")) {
+                Long doctorIdFromToken = securityUtil.getDoctorIdFromRequest(httpRequest);
+                Long appointmentDoctorId = appointment.getDoctor() != null ? appointment.getDoctor().getDoctorId() : null;
+                if (doctorIdFromToken == null || !doctorIdFromToken.equals(appointmentDoctorId)) {
                     return ResponseEntity.status(HttpStatus.FORBIDDEN)
                             .body(Map.of("error", "You can only cancel your own appointments"));
Index: frontend/src/pages/appointments/AppointmentList.js
===================================================================
--- frontend/src/pages/appointments/AppointmentList.js	(revision 84249b19ce0ac1cc4b9f406f63132d99f6759053)
+++ frontend/src/pages/appointments/AppointmentList.js	(revision a64c772a36870a2e14746a963e20b1e6ec1e1538)
@@ -47,5 +47,5 @@
         await appointmentService.cancelAppointment(id);
         setAppointments(appointments.map(apt =>
-          apt.appointmentId === id ? { ...apt, status: 'CANCELLED' } : apt
+            apt.appointmentId === id ? { ...apt, status: 'CANCELLED' } : apt
         ));
       } catch (err) {
@@ -58,28 +58,28 @@
 
   return (
-    <div>
-      <div className="flex justify-between items-center mb-6">
-        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>
-          {patientId ? 'Patient Appointments' : doctorId ? 'My Appointments' : 'All Appointments'}
-        </h1>
-        <Link to="/appointments/new" style={{
-          display: 'inline-block',
-          background: '#bfdbfe',
-          color: '#1e1035',
-          padding: '8px 16px',
-          borderRadius: '6px',
-          textDecoration: 'none',
-          fontSize: '14px',
-          fontWeight: '400'
-        }} onMouseEnter={(e) => e.currentTarget.style.background = '#93c5fd'} onMouseLeave={(e) => e.currentTarget.style.background = '#bfdbfe'}>
-          New Appointment
-        </Link>
-      </div>
+      <div>
+        <div className="flex justify-between items-center mb-6">
+          <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>
+            {patientId ? 'Patient Appointments' : doctorId ? 'My Appointments' : 'All Appointments'}
+          </h1>
+          <Link to="/appointments/new" style={{
+            display: 'inline-block',
+            background: '#bfdbfe',
+            color: '#1e1035',
+            padding: '8px 16px',
+            borderRadius: '6px',
+            textDecoration: 'none',
+            fontSize: '14px',
+            fontWeight: '400'
+          }} onMouseEnter={(e) => e.currentTarget.style.background = '#93c5fd'} onMouseLeave={(e) => e.currentTarget.style.background = '#bfdbfe'}>
+            New Appointment
+          </Link>
+        </div>
 
-      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+        {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
 
-      <div className="bg-white rounded-lg shadow overflow-hidden">
-        <table className="w-full">
-          <thead className="bg-gray-100">
+        <div className="bg-white rounded-lg shadow overflow-hidden">
+          <table className="w-full">
+            <thead className="bg-gray-100">
             <tr>
               <th className="px-6 py-3 text-left text-sm font-semibold">Patient</th>
@@ -90,37 +90,39 @@
               <th className="px-6 py-3 text-left text-sm font-semibold">Actions</th>
             </tr>
-          </thead>
-          <tbody>
+            </thead>
+            <tbody>
             {appointments.map(appointment => (
-              <tr key={appointment.appointmentId} className="border-t hover:bg-gray-50">
-                <td className="px-6 py-3">{appointment.patient?.firstName} {appointment.patient?.lastName}</td>
-                <td className="px-6 py-3">Dr. {appointment.doctor?.firstName} {appointment.doctor?.lastName}</td>
-                <td className="px-6 py-3">{appointment.appointmentDate}</td>
-                <td className="px-6 py-3">{appointment.appointmentTime}</td>
-                <td className="px-6 py-3">
+                <tr key={appointment.appointmentId} className="border-t hover:bg-gray-50">
+                  <td className="px-6 py-3">{appointment.patient?.firstName} {appointment.patient?.lastName}</td>
+                  <td className="px-6 py-3">Dr. {appointment.doctor?.firstName} {appointment.doctor?.lastName}</td>
+                  <td className="px-6 py-3">{appointment.appointmentDate}</td>
+                  <td className="px-6 py-3">{appointment.appointmentTime}</td>
+                  <td className="px-6 py-3">
                   <span className={`px-3 py-1 rounded text-sm font-semibold ${
-                    appointment.status === 'SCHEDULED' ? 'bg-purple-100 text-purple-800' :
-                    appointment.status === 'COMPLETED' ? 'bg-green-100 text-green-800' :
-                    'bg-red-100 text-red-800'
+                      appointment.status === 'SCHEDULED' ? 'bg-purple-100 text-purple-800' :
+                          appointment.status === 'COMPLETED' ? 'bg-green-100 text-green-800' :
+                              'bg-red-100 text-red-800'
                   }`}>
                     {appointment.status}
                   </span>
-                </td>
-                <td className="px-6 py-3">
-                  {appointment.status === 'SCHEDULED' && (
-                    <button
-                      onClick={() => handleCancelAppointment(appointment.appointmentId)}
-                      className="text-red-600 hover:underline px-3 py-2 text-sm font-medium"
-                    >
-                      Cancel
-                    </button>
-                  )}
-                </td>
-              </tr>
+                  </td>
+                  <td className="px-6 py-3">
+                    {appointment.status === 'SCHEDULED' && (
+                        (user.role === 'DOCTOR' && appointment.doctor?.doctorId !== user.doctorId) ? null : (
+                            <button
+                                onClick={() => handleCancelAppointment(appointment.appointmentId)}
+                                className="text-red-600 hover:underline px-3 py-2 text-sm font-medium"
+                            >
+                              Cancel
+                            </button>
+                        )
+                    )}
+                  </td>
+                </tr>
             ))}
-          </tbody>
-        </table>
+            </tbody>
+          </table>
+        </div>
       </div>
-    </div>
   );
 }
Index: frontend/src/pages/billing/BillingDetail.js
===================================================================
--- frontend/src/pages/billing/BillingDetail.js	(revision 84249b19ce0ac1cc4b9f406f63132d99f6759053)
+++ frontend/src/pages/billing/BillingDetail.js	(revision a64c772a36870a2e14746a963e20b1e6ec1e1538)
@@ -78,146 +78,156 @@
   if (loading) return <Loading />;
 
+  // Prevent unauthorized access to billing
+  if (user.role === 'DOCTOR' || user.role === 'LAB_TECHNICIAN') {
+    return (
+        <div style={{ padding: '20px', textAlign: 'center' }}>
+          <h1 className="text-2xl font-bold" style={{ color: '#7c3aed', marginBottom: '10px' }}>Access Denied</h1>
+          <p style={{ color: 'var(--color-neutral-600)' }}>You do not have permission to access billing records.</p>
+        </div>
+    );
+  }
+
   if (!billing) {
     return (
-      <div>
-        <ErrorAlert message="Billing record not found" onClose={() => navigate('/billing')} />
-      </div>
+        <div>
+          <ErrorAlert message="Billing record not found" onClose={() => navigate('/billing')} />
+        </div>
     );
   }
 
   return (
-    <div>
-      <div className="flex justify-between items-center mb-6">
-        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>Billing Record #{billing.billId}</h1>
-        <div className="space-x-2">
-          <button
-            onClick={handleDownloadInvoice}
-            disabled={downloading}
-            className="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 disabled:opacity-50"
-          >
-            {downloading ? 'Downloading...' : 'Download Invoice (PDF)'}
-          </button>
-          <button onClick={() => navigate('/billing')} className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400">
-            Back
-          </button>
-        </div>
-      </div>
-
-      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
-      {success && <SuccessAlert message={success} onClose={() => setSuccess(null)} />}
-
-      <div className={`grid gap-6 mb-6 ${isPatient ? 'grid-cols-1 lg:grid-cols-2' : 'grid-cols-1 lg:grid-cols-3'}`}>
-        <div className="bg-white rounded-lg shadow p-6">
-          <h2 className="text-xl font-bold mb-4">Billing Information</h2>
-          <div className="space-y-3">
-            <InfoRow label="Patient" value={billing.patientName} />
-            <InfoRow label="Total Cost" value={`$${billing.totalCost}`} />
-            <InfoRow label="Current Status" value={billing.paymentStatus} />
-            <InfoRow label="Payment Date" value={billing.paymentDate || 'Not paid'} />
+      <div>
+        <div className="flex justify-between items-center mb-6">
+          <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>Billing Record #{billing.billId}</h1>
+          <div className="space-x-2">
+            <button
+                onClick={handleDownloadInvoice}
+                disabled={downloading}
+                className="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 disabled:opacity-50"
+            >
+              {downloading ? 'Downloading...' : 'Download Invoice (PDF)'}
+            </button>
+            <button onClick={() => navigate('/billing')} className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400">
+              Back
+            </button>
           </div>
         </div>
 
-        {!isPatient && (
+        {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+        {success && <SuccessAlert message={success} onClose={() => setSuccess(null)} />}
+
+        <div className={`grid gap-6 mb-6 ${isPatient ? 'grid-cols-1 lg:grid-cols-2' : 'grid-cols-1 lg:grid-cols-3'}`}>
           <div className="bg-white rounded-lg shadow p-6">
-            <h2 className="text-xl font-bold mb-4">Update Payment Status</h2>
-            <div className="space-y-4">
-              <div>
-                <label className="block text-sm font-semibold mb-2">Payment Status</label>
-                <select
-                  value={paymentStatus}
-                  onChange={(e) => setPaymentStatus(e.target.value)}
-                  className="w-full px-4 py-2 border rounded-lg"
-                >
-                  <option value="PENDING">Pending</option>
-                  <option value="PAID">Paid</option>
-                  <option value="CANCELLED">Cancelled</option>
-                </select>
-              </div>
-              <button
-                onClick={handleUpdatePaymentStatus}
-                disabled={updating || paymentStatus === billing.paymentStatus}
-                className="w-full bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 disabled:opacity-50"
-              >
-                {updating ? 'Updating...' : 'Update Status'}
-              </button>
+            <h2 className="text-xl font-bold mb-4">Billing Information</h2>
+            <div className="space-y-3">
+              <InfoRow label="Patient" value={billing.patientName} />
+              <InfoRow label="Total Cost" value={`$${billing.totalCost}`} />
+              <InfoRow label="Current Status" value={billing.paymentStatus} />
+              <InfoRow label="Payment Date" value={billing.paymentDate || 'Not paid'} />
             </div>
           </div>
-        )}
-
-        <div className="bg-white rounded-lg shadow p-6">
-          <h2 className="text-xl font-bold mb-4">Patient Details</h2>
-          <div className="space-y-3">
-            {billingDetail && (
-              <>
-                <InfoRow label="EMBG" value={billingDetail.patientEmbg} />
-                <InfoRow label="Phone" value={billingDetail.patientPhone} />
-                <InfoRow label="Bill Date" value={billingDetail.billDate} />
-              </>
-            )}
-          </div>
-        </div>
-      </div>
-
-      <div className="bg-white rounded-lg shadow p-6">
-        <h2 className="text-xl font-bold mb-4">Itemized Services</h2>
-
-        {billingDetail && (billingDetail.procedures.length > 0 || billingDetail.labTests.length > 0) ? (
-          <div className="space-y-4">
-            {billingDetail.procedures.length > 0 && (
-              <div>
-                <h3 className="font-semibold text-lg mb-2">Procedures</h3>
-                <table className="w-full">
-                  <thead className="bg-gray-100">
-                    <tr>
-                      <th className="px-4 py-2 text-left">Description</th>
-                      <th className="px-4 py-2 text-right">Cost</th>
-                    </tr>
-                  </thead>
-                  <tbody>
-                    {billingDetail.procedures.map((proc, idx) => (
-                      <tr key={idx} className="border-t">
-                        <td className="px-4 py-2">{proc.description}</td>
-                        <td className="px-4 py-2 text-right">${proc.cost}</td>
-                      </tr>
-                    ))}
-                  </tbody>
-                </table>
+
+          {!isPatient && (
+              <div className="bg-white rounded-lg shadow p-6">
+                <h2 className="text-xl font-bold mb-4">Update Payment Status</h2>
+                <div className="space-y-4">
+                  <div>
+                    <label className="block text-sm font-semibold mb-2">Payment Status</label>
+                    <select
+                        value={paymentStatus}
+                        onChange={(e) => setPaymentStatus(e.target.value)}
+                        className="w-full px-4 py-2 border rounded-lg"
+                    >
+                      <option value="PENDING">Pending</option>
+                      <option value="PAID">Paid</option>
+                      <option value="CANCELLED">Cancelled</option>
+                    </select>
+                  </div>
+                  <button
+                      onClick={handleUpdatePaymentStatus}
+                      disabled={updating || paymentStatus === billing.paymentStatus}
+                      className="w-full bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 disabled:opacity-50"
+                  >
+                    {updating ? 'Updating...' : 'Update Status'}
+                  </button>
+                </div>
               </div>
-            )}
-
-            {billingDetail.labTests.length > 0 && (
-              <div>
-                <h3 className="font-semibold text-lg mb-2">Lab Tests</h3>
-                <table className="w-full">
-                  <thead className="bg-gray-100">
-                    <tr>
-                      <th className="px-4 py-2 text-left">Description</th>
-                      <th className="px-4 py-2 text-right">Cost</th>
-                    </tr>
-                  </thead>
-                  <tbody>
-                    {billingDetail.labTests.map((test, idx) => (
-                      <tr key={idx} className="border-t">
-                        <td className="px-4 py-2">{test.description}</td>
-                        <td className="px-4 py-2 text-right">${test.cost}</td>
-                      </tr>
-                    ))}
-                  </tbody>
-                </table>
-              </div>
-            )}
-
-            <div className="border-t-2 pt-4 mt-4 flex justify-end">
-              <div className="text-right">
-                <p className="text-gray-600">Total Amount:</p>
-                <p className="text-2xl font-bold text-purple-600">${billing.totalCost}</p>
-              </div>
+          )}
+
+          <div className="bg-white rounded-lg shadow p-6">
+            <h2 className="text-xl font-bold mb-4">Patient Details</h2>
+            <div className="space-y-3">
+              {billingDetail && (
+                  <>
+                    <InfoRow label="EMBG" value={billingDetail.patientEmbg} />
+                    <InfoRow label="Phone" value={billingDetail.patientPhone} />
+                    <InfoRow label="Bill Date" value={billingDetail.billDate} />
+                  </>
+              )}
             </div>
           </div>
-        ) : (
-          <p className="text-gray-500">No services itemized for this billing record.</p>
-        )}
+        </div>
+
+        <div className="bg-white rounded-lg shadow p-6">
+          <h2 className="text-xl font-bold mb-4">Itemized Services</h2>
+
+          {billingDetail && (billingDetail.procedures.length > 0 || billingDetail.labTests.length > 0) ? (
+              <div className="space-y-4">
+                {billingDetail.procedures.length > 0 && (
+                    <div>
+                      <h3 className="font-semibold text-lg mb-2">Procedures</h3>
+                      <table className="w-full">
+                        <thead className="bg-gray-100">
+                        <tr>
+                          <th className="px-4 py-2 text-left">Description</th>
+                          <th className="px-4 py-2 text-right">Cost</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        {billingDetail.procedures.map((proc, idx) => (
+                            <tr key={idx} className="border-t">
+                              <td className="px-4 py-2">{proc.description}</td>
+                              <td className="px-4 py-2 text-right">${proc.cost}</td>
+                            </tr>
+                        ))}
+                        </tbody>
+                      </table>
+                    </div>
+                )}
+
+                {billingDetail.labTests.length > 0 && (
+                    <div>
+                      <h3 className="font-semibold text-lg mb-2">Lab Tests</h3>
+                      <table className="w-full">
+                        <thead className="bg-gray-100">
+                        <tr>
+                          <th className="px-4 py-2 text-left">Description</th>
+                          <th className="px-4 py-2 text-right">Cost</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        {billingDetail.labTests.map((test, idx) => (
+                            <tr key={idx} className="border-t">
+                              <td className="px-4 py-2">{test.description}</td>
+                              <td className="px-4 py-2 text-right">${test.cost}</td>
+                            </tr>
+                        ))}
+                        </tbody>
+                      </table>
+                    </div>
+                )}
+
+                <div className="border-t-2 pt-4 mt-4 flex justify-end">
+                  <div className="text-right">
+                    <p className="text-gray-600">Total Amount:</p>
+                    <p className="text-2xl font-bold text-purple-600">${billing.totalCost}</p>
+                  </div>
+                </div>
+              </div>
+          ) : (
+              <p className="text-gray-500">No services itemized for this billing record.</p>
+          )}
+        </div>
       </div>
-    </div>
   );
 }
@@ -225,8 +235,8 @@
 function InfoRow({ label, value }) {
   return (
-    <div className="flex justify-between">
-      <span className="text-gray-800">{label}:</span>
-      <span className="text-gray-800">{value || 'N/A'}</span>
-    </div>
+      <div className="flex justify-between">
+        <span className="text-gray-800">{label}:</span>
+        <span className="text-gray-800">{value || 'N/A'}</span>
+      </div>
   );
 }
Index: frontend/src/pages/billing/BillingList.js
===================================================================
--- frontend/src/pages/billing/BillingList.js	(revision 84249b19ce0ac1cc4b9f406f63132d99f6759053)
+++ frontend/src/pages/billing/BillingList.js	(revision a64c772a36870a2e14746a963e20b1e6ec1e1538)
@@ -13,8 +13,4 @@
   const user = JSON.parse(localStorage.getItem('user') || '{}');
 
-  useEffect(() => {
-    fetchBillings();
-  }, [patientId]);
-
   const fetchBillings = async () => {
     try {
@@ -24,5 +20,4 @@
         response = await billingService.getBillingHistoryForPatient(patientId);
       } else if (user.role === 'PATIENT') {
-        // Patients can only view their own billing history
         response = await billingService.getBillingHistoryForPatient(user.patientId);
       } else {
@@ -38,15 +33,29 @@
   };
 
+  useEffect(() => {
+    fetchBillings();
+  }, [patientId]);
+
+  // Prevent unauthorized access to billing
+  if (user.role === 'DOCTOR' || user.role === 'LAB_TECHNICIAN') {
+    return (
+        <div style={{ padding: '20px', textAlign: 'center' }}>
+          <h1 className="text-2xl font-bold" style={{ color: '#7c3aed', marginBottom: '10px' }}>Access Denied</h1>
+          <p style={{ color: 'var(--color-neutral-600)' }}>You do not have permission to access billing records.</p>
+        </div>
+    );
+  }
+
   if (loading) return <Loading />;
 
   return (
-    <div>
-      <h1 className="text-3xl font-bold mb-6" style={{ color: '#7c3aed' }}>{patientId ? 'Patient Billing History' : 'Billing Records'}</h1>
+      <div>
+        <h1 className="text-3xl font-bold mb-6" style={{ color: '#7c3aed' }}>{patientId ? 'Patient Billing History' : 'Billing Records'}</h1>
 
-      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+        {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
 
-      <div className="bg-white rounded-lg shadow overflow-hidden">
-        <table className="w-full">
-          <thead className="bg-gray-100">
+        <div className="bg-white rounded-lg shadow overflow-hidden">
+          <table className="w-full">
+            <thead className="bg-gray-100">
             <tr>
               <th className="px-6 py-3 text-left text-sm font-semibold">Patient</th>
@@ -56,31 +65,31 @@
               <th className="px-6 py-3 text-left text-sm font-semibold">Actions</th>
             </tr>
-          </thead>
-          <tbody>
+            </thead>
+            <tbody>
             {billings.map(billing => (
-              <tr key={billing.billId} className="border-t hover:bg-gray-50">
-                <td className="px-6 py-3">{billing.patientName}</td>
-                <td className="px-6 py-3">${billing.totalCost}</td>
-                <td className="px-6 py-3">
+                <tr key={billing.billId} className="border-t hover:bg-gray-50">
+                  <td className="px-6 py-3">{billing.patientName}</td>
+                  <td className="px-6 py-3">${billing.totalCost}</td>
+                  <td className="px-6 py-3">
                   <span className={`px-3 py-1 rounded text-sm font-semibold ${
-                    billing.paymentStatus === 'PENDING' ? 'bg-yellow-100 text-yellow-800' :
-                    billing.paymentStatus === 'PAID' ? 'bg-green-100 text-green-800' :
-                    'bg-red-100 text-red-800'
+                      billing.paymentStatus === 'PENDING' ? 'bg-yellow-100 text-yellow-800' :
+                          billing.paymentStatus === 'PAID' ? 'bg-green-100 text-green-800' :
+                              'bg-red-100 text-red-800'
                   }`}>
                     {billing.paymentStatus}
                   </span>
-                </td>
-                <td className="px-6 py-3">{billing.paymentDate || 'Not paid'}</td>
-                <td className="px-6 py-3">
-                  <Link to={`/billing/${billing.billId}`} style={{ color: '#7c3aed', textDecoration: 'none', fontWeight: '400' }} onMouseEnter={(e) => e.currentTarget.style.textDecoration = 'underline'} onMouseLeave={(e) => e.currentTarget.style.textDecoration = 'none'}>
-                    View
-                  </Link>
-                </td>
-              </tr>
+                  </td>
+                  <td className="px-6 py-3">{billing.paymentDate || 'Not paid'}</td>
+                  <td className="px-6 py-3">
+                    <Link to={`/billing/${billing.billId}`} style={{ color: '#7c3aed', textDecoration: 'none', fontWeight: '400' }} onMouseEnter={(e) => e.currentTarget.style.textDecoration = 'underline'} onMouseLeave={(e) => e.currentTarget.style.textDecoration = 'none'}>
+                      View
+                    </Link>
+                  </td>
+                </tr>
             ))}
-          </tbody>
-        </table>
+            </tbody>
+          </table>
+        </div>
       </div>
-    </div>
   );
 }
